Quick Tip: Find the time and reason for Windows server restart using Powershell

As a database administrator, often times, you need to find-out who rebooted a Windows Server running a SQL Server instance.

Using the “Windows Event Manager” is a drag (IMHO). Use this Powershell command to do it quickly

 Get-Eventlog -logname system -message '*restart*' -Newest 10 | Format-Table -wrap

It gets the eventlog of type “system” with the word “restart” anywhere in the message and gets the most recent 10 events.

The format-table with “wrap” is to get a better display of the long messages since the output gets chopped otherwise.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s