VMware Cloud Community
krishnaprasad
Hot Shot
Hot Shot
Jump to solution

how to see the full message using Get-VIEvent command

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

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

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

View solution in original post

Reply
0 Kudos
4 Replies
LucD
Leadership
Leadership
Jump to solution

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

Reply
0 Kudos
gboskin
Enthusiast
Enthusiast
Jump to solution

Can you specify a time frame for the error logs needed.. say between the 20th and 21st of last week??

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

Reply
0 Kudos
halr9000
Commander
Commander
Jump to solution

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. Smiley Happy

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

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000
Reply
0 Kudos