Wednesday, October 28, 2015

VMware Virtual Machine Reporting from VSphere

VMware PowerCLI is a powerful utility to generate virtual machine information and status. This is very cool and handy tool. I use to generate VMTools status, Datacenter and ESX host name information.
Command to connect vCenter:
Connect-VIServer vcenter1, vcenter2, vcenter
Initialize VMTools Version:
New-VIProperty -Name ToolsVersion -ObjectType VirtualMachine -ValueFromExtensionProperty ‘Config.tools.ToolsVersion’ -Force
Initialize VMTools Status:
New-VIProperty -Name ToolsVersionStatus -ObjectType VirtualMachine -ValueFromExtensionProperty ‘Guest.ToolsVersionStatus’ -Force
Verify VMTools status on all virtual machines and export the output to excel:
Get-VM | Select Name, ToolsVersion, ToolsVersionStatus | Export-Csv -NoTypeInformation -UseCulture -Path C:\Temp\VMToolsInfo.csv
Export VM name, cluster and ESX Host:
Get-VM | Select Name, @{N=”Cluster”;E={Get-Cluster -VM $_}}, @{N=”ESX Host”;E={Get-VMHost -VM $_}} | Export-Csv -NoTypeInformation C:\temp\VM_CLuster_Host-.csv
Export VM name and Cluster name:
Get-VM | Select Name, @{N=”Cluster”;E={Get-Cluster -VM $_}} | Export-Csv -NoTypeInformation C:\temp\test-VM_CLuster.csv

Original: