SQL Server Operators and Notifications with Powershell – Strange Enumerate issue fixed by @napalmgram

alt

$server | Get-Member
$Server.JobServer|gm
$Server.JobServer.Operators | gm

alt

alt

alt

alt

alt

alt

alt

alt

#############################################################################    ################
#
# NAME: Show-SQLServerOperators.ps1
# AUTHOR: Rob Sewell https://blog.robsewell.com
# DATE:03/09/2013
#
# COMMENTS: Load function for Enumerating Operators and Notifications
# ————————————————————————

Function Show-SQLServerOperators ($SQLServer) {
    Write-Output "############### $SQLServer ##########################"
    Write-Output     "#####################################################`n"     

    $server = new-object "Microsoft.SqlServer.Management.Smo.Server"     $SQLServer
        
        
    foreach ($Operator in $server.JobServer.Operators) {
        $Operator = New-Object ("$SMO.Agent.Operator") ($server.JobServer,     $Operator)

        $OpName = $Operator.Name
        Write-Output "Operator $OpName"
        Write-Output "`n###### Job Notifications   ######"
        $Operator.EnumJobNotifications()| Select JobName | Format-Table
        Write-Output     "#####################################################`n"  
        Write-Output "`n###### Alert Notifications  #######"
        $Operator.EnumNotifications() | Select AlertName | Format-Table
        Write-Output     "#####################################################`n"  
                 
    }
 
}        
Built with Hugo
Theme Stack designed by Jimmy