Reply to Message

View discussion in a popup

Replying to:
Maryland
Contributor
Contributor

@LucD

If I just need to pull FQDN of VM's in vCenter, could I just do this?

$Report = @()

 

$vms = Get-VM

 

{$vms | Where-Object {$_.ExtensionData.Guest.Hostname -like "*$($server)*"} | %{

        $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

 

Thanks in advance for any help, kind sir :slightly_smiling_face:

- DM

Reply
0 Kudos