I was reading Alan Renouf his post about reading the vmkernel log files with PowerCLI. Carter Shanklin posted a comment with the Powershell v2 way of doing this task. I grabbed his one-liner and added a foreach ( % ) loop and the Out-GridView cmdlet. Now with the foreach loop, the one-liner will run against all my ESX Servers.
Get-VMHost |% {Get-Log -VmHost $_ vmkernel |Select -expand Entries } |Out-GridView
The Out-GridView cmdlet will show us all the vmkernel logfiles together in one window.
If want to filter on Warning messages only, run the following one-liner:
Get-VMHost | % { Get-Log -VmHost $_ vmkernel | Select -expand Entries | Select-String WARNING } | Out-GridView
If there are Warnings in the vmkernel log, the following GridView will be created:
If you want to filter the output in the GridView, just use the filter box and if necessary, you can add a criteria:
One thought on “PowerCLI: Reading the VMKERNEL logfiles with Powershell v2”