Hello list,
I was trying to see the VIevents using the command get-vievent as below
Get-VIEvent -Type Error -MaxSamples 20 | Format-Table CreatedTime,FullFormattedMessage -autosize
In this case, if its a big message, the fullFormattedMessage shows incomplete messages ( For eg/- Error detected on <ESX IP> in <datacenter-name>..... ) ... what should i set to see the complete message using Get-VIevent command?
Thanks,
Krishnaprsad
It's the Format-Table cmdlet that shows only part of the message.
If you want to see the complete message you could do
Get-VIEvent -Type Error -MaxSamples 20 | %{Write-Host $_.CreatedTime $_.FullFormattedMessage}
The alternative is to adapt the format instructions in the VMware.VimAutomation.Format.ps1xml file.
But that could impact other cmdlets and is a bit more tricky.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
It's the Format-Table cmdlet that shows only part of the message.
If you want to see the complete message you could do
Get-VIEvent -Type Error -MaxSamples 20 | %{Write-Host $_.CreatedTime $_.FullFormattedMessage}
The alternative is to adapt the format instructions in the VMware.VimAutomation.Format.ps1xml file.
But that could impact other cmdlets and is a bit more tricky.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Can you specify a time frame for the error logs needed.. say between the 20th and 21st of last week??
Yes, you can with the -Start and -Finish parameters of the Get-VIEvent cmdlet.
Something like this:
Get-VIEvent -Type Error -Start ([DateTime]"2008-11-20") -Finish ([DateTime]"2008-11-21 23:59")
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
There's a dozen other way to do this aside from LucD's suggestion:
1. Use Format-List instead of Format-Table
2. Add the -Wrap parameter to Format-Table
3. Export to CSV using the Export-CSV cmdlet
Ok, I can only think of three.
There is a bit of confusion added here by the output subsystem. It wants to truncate the output to the width of your console which does not make sense in a lot of situations.
[PowerShell MVP|https://mvp.support.microsoft.com/profile=5547F213-A069-45F8-B5D1-17E5BD3F362F], VI Toolkit forum moderator
Author of the upcoming book: Managing VMware Infrastructure with PowerShell
Co-Host, PowerScripting Podcast (http://powerscripting.net)
Need general, non-VMware-related PowerShell Help? Try the forums at PowerShellCommunity.org