Quantcast
Channel: VMware Communities : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 193198

How to check a VIObject's status

$
0
0

I am planning to write a PowerCLI script to do cold-migrate of VMs.  Move-VM will fail

if a VM is not completely powered off.

 

My script looks something like this:

------------

$vm = get-vm $vmname

 

if ($vm.PowerState -eq "PoweredOn") {

    Shutdown-VMGuest -VM $vm.Name

}

 

<Check guest OS or VM state here>

 

Move-VM -Destination $newhost

--------------

 

I can call get-vmguest to check the state of the OS.  But OS shutdown takes time.

I don't want to keep calling get-vmguest every minute, for example.  What is the

correct or better way to assess the VM state before I call Move-VM?

 

Thanks!


Viewing all articles
Browse latest Browse all 193198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>