Follow sqlserver-dba.com

Subscribe to RSS feed  Follow @jackvamvas - Twitter

*Use the Comments section for questions

SQLServer-DBA.com Links

Dba_db2_button

dba-ninja.com

SQL Server DBA Jobs

How to List Task Scheduler Eventlog with messages using Powershell

06 September,2014 by Tom Collins

Question: I have  jobs scheduled through Windows task Scheduler on multiple servers. How can I return the Task Scheduler Event Log information with the messages appearing?

I’ve executed this code , but the messages are not appearing , how can I fix? I’m using Powershell version 3

 

get-winevent -logname microsoft-windows-taskscheduler/operational -maxevents 20 | ft id,message

 

Answer: If you execute the Powershell cmdlet Get-Culture   , you’ll notice the name is not en-US. There is a bug . If the Current culture is not set to en-US  the messages will not appear. The command will run , but not return the content in the Messages column

A workaround to make the messages appear is to set the current thread as en-US

 

[System.Threading.Thread]::CurrentThread.CurrentCulture = New-Object "System.Globalization.CultureInfo" "en-US"
get-winevent -logname microsoft-windows-taskscheduler/operational -maxevents 20 | ft id,message

 

See Also

Powershell Scripts for DBA

Powershell , Excel charts and data presentation

Powershell to HTML

Powershell sql server security audit


Author: Tom Collins (http://www.sqlserver-dba.com)


Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on How to List Task Scheduler Eventlog with messages using Powershell


sqlserver-dba.com | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer