2016 SCOM update channel SMTP server in bulk

Kam Wai Chan 216 Reputation points
2021-08-11T15:20:42.18+00:00

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

Operations Manager
Operations Manager
A family of System Center products that provide infrastructure monitoring, help ensure the predictable performance and availability of vital applications, and offer comprehensive monitoring for datacenters and cloud, both private and public.
1,495 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Crystal-MSFT 49,596 Reputation points Microsoft Vendor
    2021-08-12T01:33:43.847+00:00

    @Kam Wai Chan , 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://learn.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://learn.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 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.