Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Application Stability Check v1.01 - SolarWindsMSP friendly.
- # Created by Rich Banke, Banke IT Consulting
- # www.bankeit.com
- #
- # Checks the Application event log for events related to application hanging or crashing.
- # By default this script will check for 5 or more events 1000,1001,1002 in the past 12 hours.
- #
- # These values may be overridden with the following command line parameters.
- # Errors before failing: -errLimit <number>
- # Numbers of hours to check: -timeLimit <number>
- # Events to monitor: -events <number1>,<number2>,<number3>, etc
- param([Int32]$errLimit = 3, [Int32]$timeLimit = 12, [int32[]]$events = (1000,1001,1002))
- $timeLimit = $timeLimit * -1
- $errCount = 0
- $logResult = Get-EventLog Application -After (Get-Date).AddHours($timeLimit) -EntryType Error | Where-Object { $events -contains $_.EventID} |Sort InstanceID
- $errCount = $logResult.count
- $tableFormat = @{Expression={$_.InstanceID};Label="Event ID";},@{Expression={$_.ReplacementStrings};Label="Application";}
- IF($errCount -ge $errLimit) {
- Write-Host "Apps have misbehaved" $errCount "times"
- $logResult | Format-Table $tableFormat
- Exit 1001
- }
- Write-Host "No Misbehaving Apps"
- Exit 0
Add Comment
Please, Sign In to add comment