我无法通过我的Invoke-WmiMethod
命令让我的splatting工作。我像这样声明哈希表:
$HKU = 2147483651
$MyParams = @{
'Class' = 'StdRegProv';
'Name' = 'EnumKey';
'ArgumentList' = "$HKU,''";
'ComputerName' = '';
}
# additional code determining ComputerName... #
$MyParams['ComputerName'] = $MyComputer;
$Vals = Invoke-WmiMethod @MyParams
这一行给出了以下错误:
Invoke-WmiMethod : Input string was not in a correct format. At C:\Users\Person\Desktop\tmp.ps1:160 char:20 + $Vals = Invoke-WmiMethod @MyParams
你知道问题是什么吗?
答案 0 :(得分:1)
试试这个:
$HKU = 2147483651
$MyParams = @{
'Class' = 'StdRegProv';
'Name' = 'EnumKey';
'ArgumentList' = @($HKU,'');
'ComputerName' = '';
}
$MyParams['ComputerName'] = $MyComputer;
$Vals = Invoke-WmiMethod @MyParams