The current setup is that the VMs are filtered by their FQDN.
If the FQDN of a VM matches (in fact if the FQDN contains the string you sopecify in $server), it passes.
But if you want to have all VMs in your vCenter in the report, you can just leave out the Where-clause.
And If you only want to have the VMs in your text file in your report, you could do
$vmNames = Get-Content -Path .\vmlist.txt
Get-VM -Name $vmNames | % {
$report += New-Object PSObject -Property @{
VM_Name = $_.Name
DNS_Name = $_.ExtensionData.Guest.Hostname
}
}
$Report | select VM_Name, DNS_Name | Export-Csv C:\scripts\listvm.csv -NoTypeInformation
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference