Where Did I Put My Tools? Are They In Sync? – Checking the VMware Tools with PowerShell

by bunchc on February 23, 2009

It’s 7PM, do you know where your VMware Tools are? Rather, do you know if all your VM’s have them installed and running?

Here is a one-liner to check that with PowerShell:

get-vm | where { $_.PowerState -eq "PoweredOn" } | Get-VMGuest | where { $_.State -ne "Running" } | select vmName, State

What this does, is get a list of VM’s, selects those that are running, and then gets the tools status and selects those that do not have a status of “Running”. Easy… no?

Here’s another one-liner to check to see if you have the tools configured to sync time with the host system:

get-vm |where { ( %{ get-view $_.Id } | where { $_.Config.Tools.SyncTimeWithHost -ne "True" } ) } | select name

This one, gets a list of VM’s, then takes from that list, the VM’s that do not have tools set to sync with the host system. There is a lot of { and ( action there… because that info is pretty well hidden.

What else do you check for on your VM’s… tools versions? etc? Leave me a note in the comments.

  • http://engineering.ucsb.edu/~duonglt/vmware/ William Lam

    I know in the past other important values are (for v2v migrations):

    VMware Tools Status
    Time Sync w/Host
    Tools Version
    Tools Upgrade Policy
    Tools is mounted

    I'm sure you can query for this additional information using ps.

    I also wrote a VI Perl Toolkit script that extracts this along with other pieces of information:

    http://communities.vmware.com/docs/DOC-9420

    You can see some of the output here:
    http://engineering.ucsb.edu/~duonglt/vmware/sam
    http://engineering.ucsb.edu/~duonglt/vmware/sam

  • Gurjit Dhillon

    Hi,

    Can you tell me how can I find out the poweroff Vm and also when it is poweroff and by whom with powershell script.

    I know how to get the poweroff vm, but not able to get the other details.

    If possible can you put your comments on this.

    Regards
    Gurjit Dhillon

  • http://professionalvmware.com professionalvmware

    Gurjit,

    Please see the following post (generated based on this comment):
    http://professionalvmware.com/2009/10/a-quick-p

    Let me know if you have any questions.

  • http://professionalvmware.com professionalvmware

    Gurjit,

    Please see the following post (generated based on this comment):
    http://professionalvmware.com/2009/10/a-quick-p

    Let me know if you have any questions.

Previous post:

Next post: