3
我有以下PowerShell腳本如何顯示使用PowerShell的XML標籤?
$MyVM= [XML] @"
<VM>
<IPAddress>X.Y.Z.T</IPAddress>
<VMName>R2-VM</VMName>
<Vsphere-host>X.X.X.X</Vsphere-host>
<OS>W2K8-R2</OS>
<AssignedTo>Tester</AssignedTo>
</VM>
"@
Write-host " Your VM details"
Write-host "------------------"
Write-host "IPaddress: " $MyVM.VM.IPAddress
Write-host "Host Machine IP:" $MyVM.VM.Vsphere-host
而不是顯示的Vsphere主機信息它只是顯示如下
Host Machine IP: System.Xml.XmlDocument.VM.Vsphere-host
如何使它工作?
謝謝您的回答。它現在有效。 – Samselvaprabu 2011-12-22 11:43:07