vasqu
Contributor
Contributor

You have most likely figured this out by now you but ill post as it may benefit someone. I needed to get all my Windows servers to build a list to ingest into another script.

I did the following:

$VMs = get-vm

$VMs.extensiondata.guest | where {$_.GuestFullName -like "Microsoft*"} | select HostName,IpAddress,GuestFullName | export-csv c:\temp\WinVMs.csv -NoTypeInformation

 

You can also condense to one line and not user a variable:

(get-vm).extensiondata.guest | where {$_.GuestFullName -like "Microsoft*"} | select HostName,IpAddress,GuestFullName | export-csv c:\temp\WinVMs.csv  -NoTypeInformation

 

To get this info for all just drop the where statement:

(get-vm).extensiondata.guest | select HostName,IpAddress,GuestFullName | export-csv c:\temp\WinVMs.csv  -NoTypeInformation

--OR--

$VMs = get-vm

$VMs.extensiondata.guest | select HostName,IpAddress,GuestFullName | export-csv c:\temp\WinVMs.csv -NoTypeInformation

 

 

 

Reply
0 Kudos