Showing posts with label Script. Show all posts
Showing posts with label Script. Show all posts

Monday, February 7, 2011

SCOM: Find Notification Subscriptions for Subscriber

What to do when you want to delete a subscriber in SCOM, but you can't because get an error like this:

The notification recipient is subscribed to at least one notification subscription.
Please remove it from all notification subscriptions before deleting it.
.....cannot be deleted as its currently in use.


To solve this you would have to browse manually through all your notification subscriptions. But how much time would that take.
With this PowerShell script it takes 2 seconds!

Get-NotificationSubscription | foreach {
$ns = $_.DisplayName
$_.ToRecipients | foreach {
If ($_.Name -match "John") {
Write-Host $ns
}
}
}