0

If I try to run the following lines of code I get the following exception:

Error

Get-TroubleshootingPack : Es wurde kein Positionsparameter gefunden, der das Argument "Invoke-TroubleshootingPack" akzeptiert.
In Zeile:4 Zeichen:16
+ $PrinterPack = Get-TroubleshootingPack @TroubleshootingPack Invoke-Troubleshooti ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidArgument: (:) [Get-TroubleshootingPack], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.Windows.Diagnosis.Commands.GetTroubleshootingPack

Code

$TroubleshootingPack = @{
Path = "$env:windir\diagnostics\system\printer"
}
$PrinterPack = Get-TroubleshootingPack @TroubleshootingPack Invoke-TroubleshootingPack -Pack $PrinterPack

I do not understand the problem because my code looks for me like an modification of the code from the help:

get-troubleshootingpack -path C:\Windows\Diagnostics\System\Aero | invoke-troubleshootingpack
Marcel Janus
  • 233
  • 4
  • 12

2 Answers2

0

Try this

Get-TroubleshootingPack @TroubleshootingPack | Invoke-TroubleshootingPack

or this

$PrinterPack = Get-TroubleshootingPack @TroubleshootingPack
Invoke-TroubleshootingPack -Pack $PrinterPack
Roman Kuzmin
  • 40,627
  • 11
  • 95
  • 117
0

The only problem was a missing line break

$TroubleshootingPack = @{
Path = "$env:windir\diagnostics\system\printer"
}
$PrinterPack = Get-TroubleshootingPack @TroubleshootingPack
Invoke-TroubleshootingPack -Pack $PrinterPack

The above code works now without any problem

Marcel Janus
  • 233
  • 4
  • 12