$vcen = "vCenterServer" $xmlFile = "VMHost.xml" Connect-VIServer -Server $vcen #Get the File [xml]$xml = Get-Content $xmlFile #Populate the Fields $xml.updatehostcustom.vmhost | foreach { Set-Annotation -Entity (get-vmhost $_.Name) ` -CustomAttribute AssetTag -Value $_.AssetTag Set-Annotation -Entity (get-vmhost $_.Name) ` -CustomAttribute ServiceTag -Value $_.ServiceTag Set-Annotation -Entity (get-vmhost $_.Name) ` -CustomAttribute PurchaseDate -Value $_.PurchaseDate Set-Annotation -Entity (get-vmhost $_.Name) ` -CustomAttribute WarrantyExpires -Value $_.WarrantyExpires } Disconnect-VIServer $vcen -Force -Confirm:$false