VMware Cloud Community
ganapa2000
Hot Shot
Hot Shot
Jump to solution

Unable to list VMs where Tools is not running

Hi,

I am unable to get the list of VMs where Tools is not running

get-vm | where{$_.'VM PowerState' -eq 'PoweredOn' -and $_.Guest.ToolsRunningStatus -eq "guestToolsNotRunning"}

please assist.

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

With [Math]::Round and a calculated property.

Get-Folder "Client Services Group" | Get-VM |

   where {$_.PowerState -eq 'PoweredOn' -and $_.Guest.State -ne "Running"} |

  Select Name, PowerState, NumCPU, MemoryGB,

   @{N='ProvisionedSpaceGB';E={[math]::Round($_.ProvisionedSpaceGB,1)}},

   @{N='UsedSpaceGB';E={[math]::Round($_.UsedSpaceGB,1)}}


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

View solution in original post

Reply
0 Kudos
12 Replies
HassanAlKak88
Expert
Expert
Jump to solution

Hello,

Try something like this

$vm = Get-VM

$vm | where {$_.Guest.State -eq "Running"} | Shutdown-VMGuest -Confirm:$false
$vm | where {$_.Guest.State -eq "NotRunning"} | Stop-VM -Confirm:$false

The VMs where the VMware Tools are running will get a Guest shutdown, while the VMs that not have the VMware Tools running, will get a poweroff.

To List VMs and VMware tools version use the following : Get-VM | Select-Object -Property Name,@{Name='ToolsVersion';Expression={$_.Guest.ToolsVersion}}

Please consider marking this answer "CORRECT" or "Helpful" if you think your question have been answered correctly.

Cheers,

VCIX6-NV|VCP-NV|VCP-DC|

@KakHassan

linkedin.com/in/hassanalkak


If my reply was helpful, I kindly ask you to like it and mark it as a solution

Regards,
Hassan Alkak
Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

You're looking at the wrong properties.

Get-VM | where {$_.PowerState -eq 'PoweredOn' -and $_.Guest.State -ne "Running"}


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

Reply
0 Kudos
ganapa2000
Hot Shot
Hot Shot
Jump to solution

One last question, How do get the Harddisk details of a VM where VMTools is not installed or not running.

I can see the Used space in webclient but when I run the command, it shows null

Get-Folder "Client Services Group" | Get-VM | where {$_.PowerState -eq 'PoweredOn' -and $_.Guest.State -ne "Running"} | Select Name, PowerState, "NumCPU", "MemoryGB", @{N= "Capacity(GB)"; E = {$_.Summary.Storage | Measure-Object -Property Committed/1GB}}

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Which number in the Web Client are you referring to?


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

Reply
0 Kudos
ganapa2000
Hot Shot
Hot Shot
Jump to solution

vCenter 6.5 webclient

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

I mean which number do you there and on which page in the web client?
Perhaps a screenshot?


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

Reply
0 Kudos
ganapa2000
Hot Shot
Hot Shot
Jump to solution

Hi LucD,

Please find the screenshot

pastedImage_0.png

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Ok, got it. Try like this

Get-Folder "Client Services Group" | Get-VM |

where {$_.PowerState -eq 'PoweredOn' -and $_.Guest.State -ne "Running"} |

Select Name, PowerState, NumCPU, MemoryGB, ProvisionedSpaceGB, UsedSpaceGB


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

Reply
0 Kudos
ganapa2000
Hot Shot
Hot Shot
Jump to solution

Hi LucD,

Thanks you very much. that worked

How can i round the usedspace details 80.

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

With [Math]::Round and a calculated property.

Get-Folder "Client Services Group" | Get-VM |

   where {$_.PowerState -eq 'PoweredOn' -and $_.Guest.State -ne "Running"} |

  Select Name, PowerState, NumCPU, MemoryGB,

   @{N='ProvisionedSpaceGB';E={[math]::Round($_.ProvisionedSpaceGB,1)}},

   @{N='UsedSpaceGB';E={[math]::Round($_.UsedSpaceGB,1)}}


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

Reply
0 Kudos
ganapa2000
Hot Shot
Hot Shot
Jump to solution

Thanks a lot Smiley Happy

Reply
0 Kudos
blocktrev
Contributor
Contributor
Jump to solution

get-vm | where-object {$_.PowerState -eq "PoweredOn" -and $_.ExtensionData.Guest.ToolsRunningStatus -eq "guestToolsNotRunning"}

Reply
0 Kudos