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.
With [Math]::Round and a calculated property.
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
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|
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
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}}
Which number in the Web Client are you referring to?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
vCenter 6.5 webclient
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
Hi LucD,
Please find the screenshot
Ok, got it. Try like this
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
Hi LucD,
Thanks you very much. that worked
How can i round the usedspace details 80.
With [Math]::Round and a calculated property.
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
Thanks a lot
get-vm | where-object {$_.PowerState -eq "PoweredOn" -and $_.ExtensionData.Guest.ToolsRunningStatus -eq "guestToolsNotRunning"}