Welcome to Community Answers

jswadley's reputation

jswadley's reputation

Total 256
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+10
22 May, 2018 Best answer answer
+2
22 May, 2018 Selected answer High CPU Alert Dashboard
+5
05 Apr, 2018 Up vote answer SCOM Reliable Notification
+5
05 Apr, 2018 Up vote answer SCOM Reliable Notification
+10
06 Mar, 2018 Best answer answer
+2
06 Mar, 2018 Selected answer Alert Emails
+5
06 Feb, 2018 Up vote answer Alert Emails
+5
04 Jan, 2018 Up vote answer Event Log readers
+1
07 Nov, 2017 Commented # By Class and object name using wildcards # ie. # "Enabled","Class","Names","Frequency","Length","LastExecution","NextExecution","Comment" # "True","Microsoft.Windows.Computer","BMOJKW*","Weekly|0|6:55","60","10/18/2015 6:50 AM","10/25/2015 6:55 AM","HD Case 987874" import-module OperationsManager New-SCOMManagementGroupConnection -ComputerName "server.domain.com" $Settings = Import-Csv C:\\Scheduled.txt ForEach($Setting in $Settings) { #Check the next execution time... allow for 2.5 minutes since the task cannot run more often than every 5 minutes. If((Get-Date).AddMinutes(5) -gt (Get-Date($Setting.NextExecution)) -and (Get-Date).AddMinutes(-10) -lt (Get-Date($Setting.NextExecution)) -and ($Setting.Enabled -eq "true" -or $Setting.Enabled -eq "test")) { #Start Maintenance Mode $MonitorClass = Get-SCOMClass -Name:$Setting.Class; If($Setting.Names -eq "All") { $Instances = Get-SCOMClassInstance -Class:$MonitorClass } Else { $Instances = Get-SCOMClassInstance -Class:$MonitorClass | Where-Object {$_.DisplayName -match $Setting.Names} } foreach($monitorObject in $Instances) { If($Setting.Enabled -eq "test") { Write-Host $monitorObject } Else { Start-SCOMMaintenanceMode -EndTime:(Get-Date).AddMinutes($Setting.Length) -Instance:$monitorObject -Comment:$Setting.Comment } } #Set Last Execution $Setting.LastExecution = Get-Date -format g #Set Next Exeuction $LastEx = Get-Date If($Setting.Frequency.StartsWith("Once")) { $Setting.Enabled = "False" } If($Setting.Frequency.StartsWith("Daily")) { $Frequency = $Setting.Frequency.Split("|") #Expecting 2: Daily | $Setting.NextExecution = Get-Date((Get-Date($LastEx.AddDays(1)) -format d).ToString() + " " + ($Frequency[1])) -format g } If($Setting.Frequency.StartsWith("Weekly")) { $Frequency = $Setting.Frequency.Split("|") #Expecting 3: Weekly | | $Setting.NextExecution = Get-Date((Get-Date($LastEx.AddDays(7 + $Frequency[1] - [int]$LastEx.DayOfWeek)) -format d).ToString() + " " + ($Frequency[2])) -format g } } } $Settings | Export-Csv C:\\Scheduled.txt -notype
+5
10 Oct, 2017 Up vote answer SCOM Application Performance Monitoring (APM)
+10
11 Aug, 2017 Best answer answer
+2
11 Aug, 2017 Selected answer SCOM 2016 Upgrade
+5
04 Aug, 2017 Up vote answer SCOM 2016 Upgrade
+10
04 Aug, 2017 Answered SCOM 2016 Upgrade