Hi Ganesh, i am doing this in many different environments, using a SCOM command channel and a simple PowerShell script and it works like a charm. Here are the detailed steps: Update your alert custom fields with SCOM notification channels I am using the following script:
Param([parameter(mandatory=$true)][GUID] $AlertID)
#Load all assemblies
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.EnterpriseManagement.OperationsManager.Common") | Out-Null
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.EnterpriseManagement.Core") | Out-Null
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.EnterpriseManagement.OperationsManager") | Out-Null
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.EnterpriseManagement.Runtime") | Out-Null
#Create the connection
$mgConnSetting = New-Object Microsoft.EnterpriseManagement.ManagementGroupConnectionSettings($env:computername)
$mg = New-Object Microsoft.EnterpriseManagement.ManagementGroup($mgConnSetting)
#Receive alert information
$myAlert = $mg.GetMonitoringAlert($AlertId)
# Set the fields and update the alert
$myAlert.CustomField7 = "YourGroupName"
$myAlert.Update("")
exit
and I am using the following Command Channel Settings:
- Full Path of the command file:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
- Command line parameters:
-ExecutionPolicy Bypass -Command "& '"C:\Scripts\SCOMAlertUpdate.ps1"'" '$Data/Context/DataItem/AlertId$'
Important note: As the script can be executed by any management server that is part of the notification ressource pool, you need to ensure that all the members of the pool have the folder with the script in it under the same file path. Please go through this: What account will command channel notifications Run As in SCOM?
I hope I could help you with that.
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Regards
Stoyan Chalakov