Note: This tip requires PowerShell 3.0 or above.
When using the Hyper-V PowerShell cmdlets in Windows Server 2012, the VM objects can be retrieved using Get-VM cmdlet.
$vm = Get-VM
By default, these VM objects refresh based on the events from the virtual machines. For example, take a look at this screen capture:
As you see, the VM object in $vm gets refreshed automatically. This is possible because, by default, virtual machine eventing is enabled. We can disable this behavior by using Disable-VMEventing cmdlet. This might be useful in cases when we want to use the VM object in a script, work on the VM’s captured object state and not refresh the object.