$list = Get-Cluster
foreach ($view in $list){
Write-Host "Checking on : $view"
[string]$Obj = ($view.MoRef.Type + "-" + $View.MoRef.value)
[string]$bx = ($VC + ":" + $Obj)
$vcdata = [ordered]@{
Obj = $obj
Name = $view.name
ID = $bx
Name = $VCServerName
DC = Get-Datacenter -Cluster
}
}
get-job | Receive-Job -Keep | select Obj, Name, ID, Name, DC
我得到以下消息以及输出
方法调用失败,因为[VMware.VimAutomation.ViCore.Impl.V1.VIServerImpl]不包含名为“op_Addition”的方法。 System.Collections.DictionaryEntry System.Collections.DictionaryEntry System.Collections.DictionaryEntry System.Collections.DictionaryEntry System.Collections.DictionaryEntry System.Collections.DictionaryEntry System .Collections.DictionaryEntry System.Collections.DictionaryEntry System.Collections.DictionaryEntry System.Collections.DictionaryEntry System.Collections.DictionaryEntry System.Collections.DictionaryEntry
答案 0 :(得分:0)
powershell认为你想要添加这些对象。异
[string]$Obj = ($view.MoRef.Type + "-" + $View.MoRef.value)
[string]$bx = ($VC + ":" + $Obj)
尝试
[string]$Obj = "$($view.MoRef.Type)-$($View.MoRef.value)"
[string]$bx = "$($VC):$($Obj)"