Answered by:
Closing alerts with Powershell being sent

Question
-
Hi,
I am using SCOM 2012 Powershell to close a lot of alerts, and my subscriptions are only allowed to send out NEW (0) alerts.
As soon as i run my powershell command, it starts sending out the alerts and states it's closed in e-mails and sending out SMS's which i make sure it doesn't send Closed (255) / Resolved (254) only NEW (0) state.
while its only happening while i close alerts with powershell, but when i normally close the alerts in the console it doesn't send out, So its more a on the Powershell level, also not getting any errors for it, this is also a Fresh installation of SCOM 2012 Sp1.
Why is it still sending out alerts.
Here is an example of the powershell command i am running to name 1.
get-SCOMAlert | where {$_.Name -like "Operations Manager failed to start a process"} | Resolve-SCOMAlert | out-null
Kind Regards
Tuesday, July 9, 2013 12:00 PM
Answers
-
Hi,
Resolve-SCOMAlert is deprecated in OpsMgr 2012. Please use the Set-SCOMAlert -ResolutionState 255 instead of Resolve-SCOMAlert.
http://OpsMgr.ru/
- Proposed as answer by Bob CornelissenMVP Tuesday, July 9, 2013 6:05 PM
- Marked as answer by Nicholas Li Thursday, July 18, 2013 2:34 PM
Tuesday, July 9, 2013 3:07 PM -
Try this...
$closed = "255"
$alerts = get-alert |where {$_.Name -like 'Operations Manager failed to start a process'}
if ($alerts -eq $null) {write "no alerts found"}
Else {
foreach ($alert in $alerts)
{
$alert.ResolutionState = $closed
}
}Thanks, Sarav
- Marked as answer by Nicholas Li Thursday, July 18, 2013 2:34 PM
Tuesday, July 9, 2013 3:45 PM
All replies
-
try to check alert history after you close it thru PS, perhaps you get some clues why it is happening.Tuesday, July 9, 2013 12:51 PM
-
Check the History, there is no differance from when the alert is closed in the console and when i do it with powershell,
All i am guessing is that, using powershell to close the alerts is not a good idea.
Tuesday, July 9, 2013 1:21 PM -
Hi,
Resolve-SCOMAlert is deprecated in OpsMgr 2012. Please use the Set-SCOMAlert -ResolutionState 255 instead of Resolve-SCOMAlert.
http://OpsMgr.ru/
- Proposed as answer by Bob CornelissenMVP Tuesday, July 9, 2013 6:05 PM
- Marked as answer by Nicholas Li Thursday, July 18, 2013 2:34 PM
Tuesday, July 9, 2013 3:07 PM -
Try this...
$closed = "255"
$alerts = get-alert |where {$_.Name -like 'Operations Manager failed to start a process'}
if ($alerts -eq $null) {write "no alerts found"}
Else {
foreach ($alert in $alerts)
{
$alert.ResolutionState = $closed
}
}Thanks, Sarav
- Marked as answer by Nicholas Li Thursday, July 18, 2013 2:34 PM
Tuesday, July 9, 2013 3:45 PM