本文介绍了拼写-输入字符串的格式不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我似乎无法在我的 Invoke-WmiMethod 命令中发挥作用。我这样声明哈希表:

I can't seem to get my splatting to work in my Invoke-WmiMethod command. I declare the hash table like so:

$HKU = 2147483651

$MyParams = @{
  'Class' = 'StdRegProv';
  'Name' = 'EnumKey';
  'ArgumentList' = "$HKU,''";
  'ComputerName' = '';
}

# additional code determining ComputerName... #

$MyParams['ComputerName'] = $MyComputer;
$Vals = Invoke-WmiMethod @MyParams

此行给我以下错误: / p>

This line gives me the following error:

Invoke-WmiMethod : Input string was not in a correct format.
At C:\Users\Person\Desktop\tmp.ps1:160 char:20
+         $Vals = Invoke-WmiMethod @MyParams

您知道可能是什么问题吗?

Do you know what the problem could be?

推荐答案

尝试一下:

$HKU = 2147483651

$MyParams = @{
  'Class' = 'StdRegProv';
  'Name' = 'EnumKey';
  'ArgumentList' = @($HKU,'');
  'ComputerName' = '';
}

$MyParams['ComputerName'] = $MyComputer;
$Vals = Invoke-WmiMethod @MyParams

这篇关于拼写-输入字符串的格式不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 04:00