nicholas1982
Hot Shot
Hot Shot

This is basic but should do the job, if "VM _Name" is blank most likely tools isn't running

$ServerList = Get-Content C:\scripts\servers.txt

$Report = @()

foreach ($Server in $ServerList){

$VM = Get-VM | Where-Object {$_.ExtensionData.Guest.Hostname -like $server}

$Report += New-Object PSObject -Property @{

VM_Name = $VM

DNS_Name = $server}

}

$Report | select VM_Name,DNS_Name | Export-Csv C:\scripts\listvm.csv -NoTypeInformation

Nicholas