Reading Hyper-V Event logs with PowerShell

Here is a handy tip – it is quite easy to gather any information that Hyper-V puts in the event log from PowerShell.

You can get all Hyper-V related events by running:

Get-WinEvent -FilterHashTable @{LogName ="Microsoft-Windows-Hyper-V*"}

But I would not recommend that, as you will get a lot of events!  What is more useful is just displaying any error messages that were logged in the last 24 hours – with a command like this:

Get-WinEvent -FilterHashTable @{LogName ="Microsoft-Windows-Hyper-V*"; StartTime = (Get-Date).AddDays(-1); Level = 2}

Alternatively – you can look at the warnings with this command:

Get-WinEvent -FilterHashTable @{LogName ="Microsoft-Windows-Hyper-V*"; StartTime = (Get-Date).AddDays(-1); Level = 3}

Which gives an output like this: