![](/img/trans.png)
[英]System Center Configuration Manager - PowerShell Remoting
[英]Error while execution powershell code on System Center Virtual Machine Manager
我面臨將所有虛擬機配置(使用 Get-ScVirtualMachine 命令)從輸入文件導入數組的問題。
代碼是下面這個
$VmsList = Get-Content C:\VmsList.txt
foreach($vm in $VmsList){
$Result += Get-SCVirtualMachine -Name $vm
}
我有這個錯誤
Method invocation failed because [Microsoft.SystemCenter.VirtualMachineManager.VM] does not contain a method named 'op_Addition'.
在行:3 字符:1
+ CategoryInfo: InvalidOperation: (op_Addition:String) [], RuntimeException + FullyQualifiedErrorId: MethodNotFound
方法調用失敗,因為 [Microsoft.SystemCenter.VirtualMachineManager.VM] 不包含名為“op_Addition”的方法。 在行:3 字符:1
+ CategoryInfo: InvalidOperation: (op_Addition:String) [], RuntimeException + FullyQualifiedErrorId: MethodNotFound
Get-SCVirtualMachine:無法驗證參數“名稱”的參數。 參數的字符長度 (0) 太短。 指定長度大於或等於“1”的參數,然后重試該命令。 在行:3 字符:39
~~~
我忘了聲明數組$result = @()
我解決了這個問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.