VMware Cloud Community
MariusRoma
Expert
Expert
Jump to solution

Getting the power state of a VM

I apologize for the very basic question.

How can I get the power status of a VM?

I made several tests but up to now I was unable to find the right syntax...

Regards

marius

1 Solution

Accepted Solutions
HORSTJ
Enthusiast
Enthusiast
Jump to solution

This should do it:

Get-VMHost "host" | Get-VM | Where-Object  {$_.PowerState -eq "PoweredOn"}

View solution in original post

2 Replies
HORSTJ
Enthusiast
Enthusiast
Jump to solution

This should do it:

Get-VMHost "host" | Get-VM | Where-Object  {$_.PowerState -eq "PoweredOn"}

LucD
Leadership
Leadership
Jump to solution

The PowerState is a property that is present in the VirtualMachine object that is returned by the Get-VM cmdlet.

With the Select-Object cmdlet you specify the properties you want to display.

Get-VM | Select Name,PowerState


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