@@ -5,9 +5,9 @@ function Get-SCOMNotificationSubscriptionDetails
55 [Parameter (Mandatory = $false )]
66 [string ]$Output
77 )
8- # Originally found here: https://blog.topqore.com/export-scom-subscriptions-using-powershell/
9- # Modified by: Blake Drumm (blakedrumm@microsoft.com)
10- # Date Modified: 07/16/2021
8+ # Originally found here: https://blog.topqore.com/export-scom-subscriptions-using-powershell/
9+ # Modified by: Blake Drumm (blakedrumm@microsoft.com)
10+ # Date Modified: 07/16/2021
1111 $finalstring = $null
1212 $subs = $null
1313 $subs = Get-SCOMNotificationSubscription
@@ -38,7 +38,7 @@ function Get-SCOMNotificationSubscriptionDetails
3838 $val = Select-Xml - Content $templatesub - XPath " //Value" | foreach { $_.node.InnerXML }
3939 $operators = Select-Xml - Content $templatesub - XPath " //Operator" | foreach { $_.node.InnerXML }
4040 $property = Select-Xml - Content $templatesub - XPath " //Property" | foreach { $_.node.InnerXML }
41-
41+
4242 for ($i = 0 ; $i -lt $property.length ; $i ++ )
4343 {
4444 if ($property [$i ] -eq " ProblemId" )
@@ -155,29 +155,39 @@ function Get-SCOMNotificationSubscriptionDetails
155155 $MainObject | Add-Member - MemberType NoteProperty - Name " Subscriber Address Name $i -" - Value $subscriber.Devices.Name
156156 }
157157 $i = 0
158- $MainObject | Add-Member - MemberType NoteProperty - Name ' ' - Value " `n`n -------- Channel Information --------"
158+ $MainObject | Add-Member - MemberType NoteProperty - Name ' ' - Value " `n`n -------- Channel Information --------"
159159 foreach ($action in $sub.Actions )
160160 {
161161 $i = $i
162- $MainObject | Add-Member - MemberType NoteProperty - Name (" Channel Name " + ($i + 1 )) - Value ($action.Displayname )
163- $MainObject | Add-Member - MemberType NoteProperty - Name (" ID " + ($i + 1 )) - Value ($action.ID )
164- $MainObject | Add-Member - MemberType NoteProperty - Name (" Channel Description " + ($i + 1 )) - Value ($action.description )
162+ $MainObject | Add-Member - MemberType NoteProperty - Name (" Channel Name " + ($i + 1 )) - Value ($action.Displayname )
163+ $MainObject | Add-Member - MemberType NoteProperty - Name (" ID " + ($i + 1 )) - Value ($action.ID )
164+ $MainObject | Add-Member - MemberType NoteProperty - Name (" Channel Description " + ($i + 1 )) - Value ($action.description )
165165 if ($action.Endpoint -like " Smtp*" )
166166 {
167- $MainObject | Add-Member - MemberType NoteProperty - Name (" From " + ($i + 1 )) - Value ($action.From )
168- $MainObject | Add-Member - MemberType NoteProperty - Name (" Subject " + ($i + 1 )) - Value ($action.Subject )
169- $MainObject | Add-Member - MemberType NoteProperty - Name (" Endpoint " + ($i + 1 )) - Value ($action.Endpoint )
170- $MainObject | Add-Member - MemberType NoteProperty - Name (" Body Encoding " + ($i + 1 )) - Value ($action.BodyEncoding )
171- $MainObject | Add-Member - MemberType NoteProperty - Name (" Reply To " + ($i + 1 )) - Value ($action.ReplyTo )
172- $MainObject | Add-Member - MemberType NoteProperty - Name (" Headers " + ($i + 1 )) - Value ($action.Headers )
173- $MainObject | Add-Member - MemberType NoteProperty - Name (" Body " + ($i + 1 )) - Value ($action.body )
167+ # Get the SMTP channel endpoint
168+ $action.Endpoint.PrimaryServer
169+ $MainObject | Add-Member - MemberType NoteProperty - Name (" Primary SMTP Server " + ($i + 1 )) - Value ($action.Endpoint.PrimaryServer.Address )
170+ $MainObject | Add-Member - MemberType NoteProperty - Name (" Primary SMTP Port " + ($i + 1 )) - Value ($action.Endpoint.PrimaryServer.PortNumber )
171+ $MainObject | Add-Member - MemberType NoteProperty - Name (" Primary SMTP Authentication Type " + ($i + 1 )) - Value ($action.Endpoint.PrimaryServer.AuthenticationType )
172+ $MainObject | Add-Member - MemberType NoteProperty - Name (" Primary SMTP ExternalEmailProfile " + ($i + 1 )) - Value ($action.Endpoint.PrimaryServer.ExternalEmailProfile )
173+ $MainObject | Add-Member - MemberType NoteProperty - Name (" Secondary SMTP Server " + ($i + 1 )) - Value ($action.Endpoint.SecondaryServers.Address )
174+ $MainObject | Add-Member - MemberType NoteProperty - Name (" Secondary SMTP Port " + ($i + 1 )) - Value ($action.Endpoint.SecondaryServers.PortNumber )
175+ $MainObject | Add-Member - MemberType NoteProperty - Name (" Secondary SMTP Authentication Type " + ($i + 1 )) - Value ($action.Endpoint.SecondaryServers.AuthenticationType )
176+ $MainObject | Add-Member - MemberType NoteProperty - Name (" Secondary SMTP ExternalEmailProfile " + ($i + 1 )) - Value ($action.Endpoint.SecondaryServers.ExternalEmailProfile )
177+ $MainObject | Add-Member - MemberType NoteProperty - Name (" From " + ($i + 1 )) - Value ($action.From )
178+ $MainObject | Add-Member - MemberType NoteProperty - Name (" Subject " + ($i + 1 )) - Value ($action.Subject )
179+ $MainObject | Add-Member - MemberType NoteProperty - Name (" Endpoint " + ($i + 1 )) - Value ($action.Endpoint )
180+ $MainObject | Add-Member - MemberType NoteProperty - Name (" Body Encoding " + ($i + 1 )) - Value ($action.BodyEncoding )
181+ $MainObject | Add-Member - MemberType NoteProperty - Name (" Reply To " + ($i + 1 )) - Value ($action.ReplyTo )
182+ $MainObject | Add-Member - MemberType NoteProperty - Name (" Headers " + ($i + 1 )) - Value ($action.Headers )
183+ $MainObject | Add-Member - MemberType NoteProperty - Name (" Body " + ($i + 1 )) - Value ($action.body )
174184 }
175185 elseif ($action.RecipientProtocol -like " Cmd*" )
176186 {
177- $MainObject | Add-Member - MemberType NoteProperty - Name (" Application Name " + ($i + 1 )) - Value ($action.ApplicationName )
178- $MainObject | Add-Member - MemberType NoteProperty - Name (" Working Directory " + ($i + 1 )) - Value ($action.WorkingDirectory )
179- $MainObject | Add-Member - MemberType NoteProperty - Name (" Command Line " + ($i + 1 )) - Value ($action.CommandLine )
180- $MainObject | Add-Member - MemberType NoteProperty - Name (" Timeout " + ($i + 1 )) - Value ($action.Timeout )
187+ $MainObject | Add-Member - MemberType NoteProperty - Name (" Application Name " + ($i + 1 )) - Value ($action.ApplicationName )
188+ $MainObject | Add-Member - MemberType NoteProperty - Name (" Working Directory " + ($i + 1 )) - Value ($action.WorkingDirectory )
189+ $MainObject | Add-Member - MemberType NoteProperty - Name (" Command Line " + ($i + 1 )) - Value ($action.CommandLine )
190+ $MainObject | Add-Member - MemberType NoteProperty - Name (" Timeout " + ($i + 1 )) - Value ($action.Timeout )
181191 }
182192 $i ++
183193 }
0 commit comments