Hi!,
I 'll advise you to do a bit more testing. The only statement that updates the
history, is the $alert.update("text") . Infact, if you omit the text (like
$alert.update("") ) you won't get any history entry at all.
/Henrik
Fra: [email protected] [mailto:[email protected]] På
vegne af Orlebeck, Geoffrey
Sendt: 20. august 2015 19:52
Til: '[email protected]'
Emne: [msmom] Upate Resolution State with Comment History
Is there a way to update the resolution state of an alert and add a comment
without creating two separate entries in the Alert History?
I setup a test alert and want to modify the Resolution State ID to a custom ID
of '2'. Using this (there is only one alert), I semi-achieve what I want:
$Alert = Get-SCOMAlert -ResolutionState 0 -Severity 2 -Name "Geoff_Test*"
$Alert.ResolutionState = 2
$Alert.Update("Testing comment function")
If there are multiple alerts, I can pass them through a foreach loop:
$Alerts = Get-SCOMAlert -ResolutionState 0 -Severity 2 -Name "Geoff_Test*"
foreach ($Alert in $Alerts)
{
$Alert.ResolutionState = 2
$Alert.Update("Testing comment function")
}
I understand my code is two steps, so it creates two entries in the alert
history: a generic "Alert modified by user" when the Resolution State changes
and a second entry with the 'Testing comment function' text. My goal is to have
the resolution state change with the comment I'm defining. I've tried a few
different ways of wrapping the commands without luck. Is anyone currently doing
this?
Thanks.
-Geoff
Confidentiality Notice: This is a transmission from Community Hospital of the
Monterey Peninsula. This message and any attached documents may be confidential
and contain information protected by state and federal medical privacy
statutes. They are intended only for the use of the addressee. If you are not
the intended recipient, any disclosure, copying, or distribution of this
information is strictly prohibited. If you received this transmission in error,
please accept our apologies and notify the sender. Thank you.