Opsmgr 2007 / Powershell: Change command line parameters in the Notification Channel

I have found a PowerShell commands to change the command line parameters in the notification channel. This one works only for SCOM 2007.  This is the only way to change or update the subscription.

NOTE: this one works only on channel type: Command.


#Get the channel by name
$channel = Get-NotificationAction | Where-Object {$_.DisplayName -imatch “%NAME OF THE CHANNEL%”}

#The change for the command line parameters.
$channel.CommandLine = “-command C:\TEST\test.ps1 ‘$Data/Context/DataItem/ManagedEntityPath$\$Data/Context/DataItem/ManagedEntityDisplayName$’ -a ‘$Data/Context/DataItem/AlertName$’”

#Update the channel in SCOM
$channel.update()


 

Good luck! 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.