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!
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!
@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.
@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.
6 people are following this question.