Search results matching tags 'Troubleshooting', 'SQL Server', 'Monitoring', and 'PowerShell'http://sqlblog.com/search/SearchResults.aspx?o=DateDescending&tag=Troubleshooting,SQL+Server,Monitoring,PowerShell&orTags=0Search results matching tags 'Troubleshooting', 'SQL Server', 'Monitoring', and 'PowerShell'en-USCommunityServer 2.1 SP2 (Build: 61129.1)PowerShell for the DBA: Search the Windows Event Logs for Errorshttp://sqlblog.com/blogs/buck_woody/archive/2010/08/04/powershell-for-the-dba-search-the-windows-event-logs-for-errors.aspxWed, 04 Aug 2010 13:43:30 GMT21093a07-8b3d-42db-8cbf-3350fcbf5496:27605BuckWoody<p>This is a very simple script - but it's one I run each morning. It searches the Windows System Event Log for an error condition. You can replace "System" here with "Application" or "Security", or any of the other logs that are created on your Windows Server. This is run at the server, since I have each server check itself and make a file of the results - then I swing by and pick up the files each morning with another script that builds a web page.</p>
<p><span style="color:#339966;">&nbsp;# Parse for errors<br />Get-eventlog System | Where-Object { $_.entryType -eq "error" }</span></p>
<p class="MsoNormal" style="margin:0in 0in 0pt;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"><span style="font-family:Calibri;"><b><i style="mso-bidi-font-style:normal;"><span style="color:maroon;font-size:10pt;mso-bidi-font-size:11.0pt;mso-bidi-font-family:Calibri;mso-ansi-language:EN;">Script Disclaimer, for people who need to be told this sort of thing: </span></i></b><b><i style="mso-bidi-font-style:normal;"><span style="color:maroon;font-size:10pt;mso-bidi-font-family:Calibri;mso-ansi-language:EN;"><o:p></o:p></span></i></b></span></p>
<p class="MsoNormal" style="margin:0in 0in 0pt;"><i style="mso-bidi-font-style:normal;"><span style="color:maroon;font-size:10pt;mso-bidi-font-family:Calibri;mso-ansi-language:EN;"><span style="font-family:Calibri;">Never trust any script, including those that you find here, until you understand exactly what it does and how it will act on your systems. Always check the script on a test system or Virtual Machine, not a production system. Yes, there are always multiple ways to do things, and this script may not work in every situation, for everything. It&rsquo;s just a script, people. All scripts on this site are performed by a professional stunt driver on a closed course. Your mileage may vary. Void where prohibited. Offer good for a limited time only. Keep out of reach of small children. Do not operate heavy machinery while using this script. If you experience blurry vision, indigestion or diarrhea&nbsp;during the operation of this script, see a physician immediately.</span></span></i></p>