Hi All,
I am trying to extract a VMware Tools status report using PowerShell, the script below does solve my purpose but I am the output is blank for ESX details. Am I missing something?
Can someone please help?
Thanks,
Mohammed
Try it like this
Connect-VIServer xxxxx
Get-VM | `
Select @{N="VMName"; E={$_.Name}},
@{N="HardwareVersion"; E={$_.Extensiondata.Config.Version}},
@{N="ToolsVersion"; E={$_.Extensiondata.Config.Tools.ToolsVersion}},
@{N="ToolsStatus"; E={$_.Extensiondata.Summary.Guest.ToolsStatus}},
@{N="ToolsVersionStatus"; E={$_.Extensiondata.Summary.Guest.ToolsVersionStatus}},
@{N="ToolsRunningStatus"; E={$_.Extensiondata.Summary.Guest.ToolsRunningStatus}},
@{N="Cluster"; E={(Get-Cluster -VM $_.Name).Name}},
@{N="ESX Host"; E={$_.Host.Name}},
@{N="ESX Version"; E={$_.Host.Version}},
@{N="ESX Build"; E={$_.Host.Build}} | `
Export-Csv "P:\Desktop\Tools.csv" -NoTypeInformationDisconnect-VIServer xxxxx -Confirm:$false
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
This thread has been moved from the vCenter Server Community to the vSphere PowerCLI Community for better visibility.
Try it like this
Connect-VIServer xxxxx
Get-VM | `
Select @{N="VMName"; E={$_.Name}},
@{N="HardwareVersion"; E={$_.Extensiondata.Config.Version}},
@{N="ToolsVersion"; E={$_.Extensiondata.Config.Tools.ToolsVersion}},
@{N="ToolsStatus"; E={$_.Extensiondata.Summary.Guest.ToolsStatus}},
@{N="ToolsVersionStatus"; E={$_.Extensiondata.Summary.Guest.ToolsVersionStatus}},
@{N="ToolsRunningStatus"; E={$_.Extensiondata.Summary.Guest.ToolsRunningStatus}},
@{N="Cluster"; E={(Get-Cluster -VM $_.Name).Name}},
@{N="ESX Host"; E={$_.Host.Name}},
@{N="ESX Version"; E={$_.Host.Version}},
@{N="ESX Build"; E={$_.Host.Build}} | `
Export-Csv "P:\Desktop\Tools.csv" -NoTypeInformationDisconnect-VIServer xxxxx -Confirm:$false
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hey, LucD. Thanks a lot. I tried this codes and it works well than before. However, I do encounter some errors on my end, but I think I can already fix it on my own. Way to go.
Which errors do you get ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks LucD, the script worked as expected.
It threw an error that it needed some value for the -Name parameter, so I just provided "*" and the script just worked fine.
Cheers,
Mohammed
The modified script:
Connect-VIServer "Name"
Get-VM -Name "*" | Sort Name | `
Select @{N="VMName"; E={$_.Name}},
@{N="HardwareVersion"; E={$_.Extensiondata.Config.Version}},
@{N="ToolsVersion"; E={$_.Extensiondata.Config.Tools.ToolsVersion}},
@{N="ToolsStatus"; E={$_.Extensiondata.Summary.Guest.ToolsStatus}},
@{N="ToolsVersionStatus"; E={$_.Extensiondata.Summary.Guest.ToolsVersionStatus}},
@{N="ToolsRunningStatus"; E={$_.Extensiondata.Summary.Guest.ToolsRunningStatus}},
@{N="Cluster"; E={(Get-Cluster -VM $_.Name).Name}},
@{N="ESX Host"; E={$_.Host.Name}},
@{N="ESX Version"; E={$_.Host.Version}},
@{N="ESX Build"; E={$_.Host.Build}} | Export-Csv "C:\Tools.csv" -NoTypeInformation
Disconnect-VIServer "name" -Confirm:$false
I removed the -Name parameter.
Specifying -Name * is the same as leaving out the Name parameter alltogether.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
RVtools might also help you out, it's a great tool that is free and allows you to pull a ton of information out of vSphere.
Agreed, but our company (Bank) does not allow us to install any or every third party tools. Besides, PowerCLI is an amazing native vmware product so why not fully utilize it