VMware Cloud Community
SBaldridge
Contributor
Contributor
Jump to solution

Detecting if a VM if really powered down or powered on?

Hello friends,

I am writing some scripts and I (dumb) relied on the value "poweredstate" to determine if a VM is ready for some maintenance. I now found out that if a VM is poweredOn and I begin a Power>Shutdown Guest, the state immediately changes to PoweredOff even as the VM operating system is still shutting down.  This is causing me issues since I want the VM totally powered off.

Example:   $powerstate = ((get-vm | where {$_.name -like $variable}).powerstate)

Please direct me to a more reliable way to determine if the VM is powered down 'all the way'.

Thanks,

Scott

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Would a ping be sufficient.

In PowerShell v3 you have the very handy Test-Connection cmdlet for that.


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

View solution in original post

Reply
0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

Would a ping be sufficient.

In PowerShell v3 you have the very handy Test-Connection cmdlet for that.


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

Reply
0 Kudos
SBaldridge
Contributor
Contributor
Jump to solution

You know, I think that would work.  Thanks for the suggestion.

Reply
0 Kudos