Automation

 View Only
  • 1.  VMware Tools Report

    Posted Aug 07, 2011 05:39 AM

    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



  • 2.  RE: VMware Tools Report

    Posted Aug 07, 2011 05:49 AM

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



  • 3.  RE: VMware Tools Report
    Best Answer

    Posted Aug 07, 2011 08:38 AM

    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


  • 4.  RE: VMware Tools Report

    Posted Aug 07, 2011 12:41 PM

    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



  • 5.  RE: VMware Tools Report

    Posted Aug 07, 2011 02:35 PM

    Which errors do you get ?



  • 6.  RE: VMware Tools Report

    Posted Aug 08, 2011 03:51 AM

    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



  • 7.  RE: VMware Tools Report

    Posted Aug 08, 2011 05:22 AM

    I removed the -Name parameter.

    Specifying -Name * is the same as leaving out the Name parameter alltogether.



  • 8.  RE: VMware Tools Report

    Posted Aug 08, 2011 01:12 PM

    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/



  • 9.  RE: VMware Tools Report

    Posted Aug 10, 2011 04:01 AM

    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 :smileyhappy: