Avatar of Doodad Boy
Doodad BoyFlag for Malaysia

asked on 

vmware cli script assistance

i need to run vmware vsphere cli command to check a vm ToolS Version and Tools status

get-vm (vmname ) | select ToolsVersion
get-vm (vmname ) | select ToolsStatus

Attached the command run output, it showing empty result
cli.png
Powershell* PowerCLIvSphereVMware

Avatar of undefined
Last Comment
footech
Avatar of Doodad Boy
Doodad Boy
Flag of Malaysia image

ASKER

meanwhile, when we login vcenter, at VM Summary tab, it will show whether the vm require Upgrade / install Vmware tools, how may i collect this info also via cli

User generated image
Avatar of Andrew Hancock (VMware vExpert PRO / EE Fellow/British Beekeeper)
Do you need a script or will RVTools do ?

https://www.robware.net/rvtools/
Avatar of Doodad Boy
Doodad Boy
Flag of Malaysia image

ASKER

Hi, i prefer a script
Avatar of Murali Sripada
Murali Sripada

You can use this to get tools versions
Get-VM | Select-Object -Property Name,@{Name='ToolsVersion';Expression={$_.Guest.ToolsVersion}}
https://blogs.vmware.com/PowerCLI/2018/09/discovering-vms-with-specific-vmware-tools-versions.html 

or you can try this
Get-VM | Select Name,
    @{N="Tools Installed";E={$_.Guest.ToolsVersion -ne ""}},
    @{N="Tools Status";E={$_.ExtensionData.Guest.ToolsStatus}},
    @{N="Tools version";E={if($_.Guest.ToolsVersion -ne ""){$_.Guest.ToolsVersion}}}


Avatar of Doodad Boy
Doodad Boy
Flag of Malaysia image

ASKER

How can i combine both below command together

1.get-vm | Select-Object Name, Powerstate
2.get-vm | select -expandproperty ExtensionData | select -expandproperty Guest | Select ToolsStatus, ToolsVersionStatus, ToolsVersionStatus2, ToolsRunningStatus,ToolsVersion
Avatar of Doodad Boy
Doodad Boy
Flag of Malaysia image

ASKER

When i running below command, i could not get vm name and its powersate. The rest of output looks fine.

get-vm | Select-Object Name, Powerstate, ExtensionData | select -expandproperty ExtensionData | select -expandproperty Guest | Select ToolsStatus, ToolsVersionStatus, ToolsVersionStatus2, ToolsRunningStatus,ToolsVersion | Format-Table Name, Powerstate, ToolsStatus, ToolsVersionStatus, ToolsVersionStatus2, ToolsRunningStatus, ToolsVersion

ASKER CERTIFIED SOLUTION
Avatar of footech
footech
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
VMware
VMware

VMware, a software company founded in 1998, was one of the first commercially successful companies to offer x86 virtualization. The storage company EMC purchased VMware in 1994. Dell Technologies acquired EMC in 2016. VMware’s parent company is now Dell Technologies. VMware has many software products that run on desktops, Microsoft Windows, Linux, and macOS, which allows the virtualizing of the x86 architecture. Its enterprise software hypervisor for servers, VMware vSphere Hypervisor (ESXi), is a bare-metal hypervisor that runs directly on the server hardware and does not require an additional underlying operating system.

39K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo