PowerShell Snip of the Week (Get-WinEvent)

VMs that went into Saved State in the Last Day

imageDuring the migration of VMs to a Hyper-V in Windows Server 2012 R2 environment you may find that some of your VMs go in to Saved State when the backup process kicks off.  This may be because you have not updated the Integration Components, there is a problem with the Integration Component install or some other issue where the Hyper-V Writers determine that the VM should be backed up offline (Look for a post on this soon).  During this time of troubleshooting you can go to the Windows-Hyper-V-Worker-Admin event log on each server to identify which VMs are having this issue by looking for event 18510.  If you have a larger environment this gets a little inefficient.

I have used the script below during my troubleshooting.  You could easily change this to either look to a server list text file or even to accept a switch.

 

 

$s = “”SERVERNAME1”, “SERVERNAME2”


foreach ($server in $s) {Get-WinEvent -ComputerName $server -FilterHashTable @{LogName =”Microsoft-Windows-Hyper-V-worker-admin”; StartTime = (Get-Date).AddDays(-1)} | ? id -eq 18510}

Advertisements
This entry was posted in Hyper-V, PowerShell, Virtual Server Technology, Windows Server 2012 R2 and tagged , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s