Hey all,
Sorry in advance, but I'm terrible with scripting in general. I'm trying to get name, powerstate, IP address and DNS as it shows in vSphere into a CSV file. So far I have:
get-vm | select Name,PowerState,IPAddress,DNSAddress | cexport-csv c:\temp\vc5_austin_vm_list.csv
Obviously IP address and DNS address aren't the right syntax. Help?
Thanks in advance.
Only the IPv4 address, btw
get-vm | select name, Powerstate, @{N="IPAddress"; E={$_.Guest.IPAddress[0]}}, @{N="DnsName"; E={$_.ExtensionData.Guest.Hostname}}
Check this one will be helpful
vGeek: Extended VM inventory using powercli
It works and shows the IP and VM host name.
Can we able to get the ESXi host name and Cluster along with this. Please help to check
Regards
Narayanan.
Try this to get hostname and cluster
get-vm | select name, Powerstate, @{N="IPAddress"; E={$_.Guest.IPAddress[0]}}, @{N="DnsName"; E={$_.ExtensionData.Guest.Hostname}}, VMhost, @{N="Cluster"; E={$_.VMhost.Parent.Name}}
Thank you yosingh..Works Perfectly.
I have added datastore field also and works that also.
Can we able to append some more available fields like cpu, memory,disks & usage if possible in the same line.
Regards
Narayanan.
Use below script to get all the required information you want.
Get-VM | Select-Object Name,PowerState,@{N="IPAddress"; E={$_.Guest.IPAddress[0]}}, @{N="DnsName"; E={$_.ExtensionData.Guest.Hostname}},NumCpu,MemoryGB,ProvisionedSpaceGB,UsedSpaceGB,Guest,VMHost,Notes | Export-CSV ALL_CLuster.csv -NoTypeInformation
Do you need to script it?
Can you just use RVtools and remove the fields you don't need?
https://www.robware.net/rvtools/
Really @nachogonzalez ?!?
You did notice that this community is located under Automation.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Nope, I did not.
Got here from the homepage.
Apologies