question

KamWaiChan avatar image
0 Votes"
KamWaiChan asked Crystal-MSFT commented

2016 SCOM update channel SMTP server in bulk

Hi,

I am looking for a powershell script to "update" or "add and remove" all the SCOM subscriptions/channels' SMTP server information from internal server to third party with user credential.

Thank you!122423-aug11-scom.png


msc-operations-manager
aug11-scom.png (22.0 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Crystal-MSFT avatar image
1 Vote"
Crystal-MSFT answered Crystal-MSFT commented

@KamWaiChan, To update SMTP server address in SMTP notification Channels, maybe we can try the following script:

 Import-Module OperationsManager
 $newSMTP = "new SMTP server name";
 $SMTPChannels = Get-SCOMNotificationChannel |  Where-Object {$_.displayName -eq "the Notification channel name"}
 Foreach ($item in $SMTPChannels)
 {
   $item.Endpoint.PrimaryServer.Address = $newSMTP
   $item.Endpoint.update()
 }

Here are some other scripts for the reference:
Cleanup the subscribers:
http://bakerhughes-andreprins.blogspot.com/2017/10/scom-20122016-automated-subscribers.html
Note: Non-Microsoft link, just for the reference:

Export all subscriptions:
https://github.com/Sameer-Mhaisekar/scripts/blob/main/export-scomsubscriptions.txt

To Remove all the subscription, maybe we can try the following commands:
Import-Module OperationsManager
Get-SCOMNotificationSubscription | where {$_.displayname -like $subscription} | Remove-SCOMNotificationSubscription
https://docs.microsoft.com/en-us/powershell/module/operationsmanager/remove-scomnotificationsubscription?view=systemcenter-ps-2016

To add a notification subscription, we can choose "Add-SCOMNotificationSubscription" command, we can see more details in the following link:
https://docs.microsoft.com/en-us/powershell/module/operationsmanager/add-scomnotificationsubscription?view=systemcenter-ps-2016

Hope it can help.


If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.






· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@KamWaiChan, Hope things are going well! I am writing to see fi the above information can help. If there's anything unclear, feel free to let us know.

0 Votes 0 ·