sabmo
Enthusiast
Enthusiast

VMware Tools Report

Jump to solution

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?

Connect-VIServer xxxxx
$esx = Get-VMHost
Get-VM | Get-View | `
Select  @{N="VMName"; E={$_.Name}},
@{N="HardwareVersion"; E={$_.Config.Version}},
@{N="ToolsVersion"; E={$_.Config.Tools.ToolsVersion}},
@{N="ToolsStatus"; E={$_.Summary.Guest.ToolsStatus}},
@{N="ToolsVersionStatus"; E={$_.Summary.Guest.ToolsVersionStatus}},
@{N="ToolsRunningStatus"; E={$_.Summary.Guest.ToolsRunningStatus}},
@{N="Cluster"; E={$_ | Get-Cluster}},
@{N="ESX Host"; E={$esx.Name}},
@{N="ESX Version"; E={$esx.Version}},
@{N="ESX Build"; E={$esx.Build}} | `
Export-Csv "P:\Desktop\Tools.csv" -NoTypeInformation
Disconnect-VIServer xxxxx -Confirm:$false
Unable to retreive the stats for Cluster and ESX host corresponding to the Virtual Machine.

Can someone please help?

Thanks,

Mohammed

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership

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

View solution in original post

0 Kudos
8 Replies
eeg3
Commander
Commander

This thread has been moved from the vCenter Server Community to the vSphere PowerCLI Community for better visibility.

Blog: http://blog.eeg3.net
0 Kudos
LucD
Leadership
Leadership

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

View solution in original post

0 Kudos
warriorfullight
Enthusiast
Enthusiast

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.http://imagicon.info/cat/5-59/1.gif

0 Kudos
LucD
Leadership
Leadership

Which errors do you get ?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
sabmo
Enthusiast
Enthusiast

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

0 Kudos
LucD
Leadership
Leadership

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

0 Kudos
bckirsch
Enthusiast
Enthusiast

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.

http://www.robware.net/

0 Kudos
sabmo
Enthusiast
Enthusiast

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 Smiley Happy

0 Kudos