@@ -6,9 +6,9 @@ function Get-SCOMNotificationSubscriptionDetails
66 [string ]$Output
77 )
88 # Originally found here: https://blog.topqore.com/export-scom-subscriptions-using-powershell/
9+ # Located here: https://github.com/blakedrumm/SCOM-Scripts-and-SQL/edit/master/Powershell/Get-SCOMNotificationSubscriptionDetails.ps1
910 # Modified by: Blake Drumm (blakedrumm@microsoft.com)
10- # Date Modified: 08/02/2021
11- # TODO: Add Ability to gather multiple Subscribers Channels.
11+ # Date Modified: 08/03/2021
1212 $finalstring = $null
1313 $subs = $null
1414 $subs = Get-SCOMNotificationSubscription | Sort-Object
@@ -153,16 +153,24 @@ function Get-SCOMNotificationSubscriptionDetails
153153 {
154154 $i = $i
155155 $i ++
156- $switchitup = switch ($subscriber.Devices.Protocol )
156+ $MainObject | Add-Member - MemberType NoteProperty - Name " Subscriber Name | $i " - Value $subscriber.Name
157+ (97 .. (97 + 25 )).ForEach ({ [array ]$abc += [char ]$_ })
158+ $number = 0
159+ foreach ($protocol in $subscriber.Devices.Protocol )
157160 {
158- ' sip' { " Instant Message (IM)" }
159- ' Smtp' { " E-Mail (SMTP)" }
160- default { $subscriber.Devices.Protocol }
161+ $protocoltype = switch ($protocol )
162+ {
163+ ' SIP' { ' Instant Message (IM)' }
164+ { $_ -like ' Cmd*' } { ' Command' }
165+ ' SMTP' { ' E-Mail (SMTP)' }
166+ ' SMS' { ' Text Message (SMS)' }
167+ Default { $protocol }
168+ }
169+ $number ++
170+ $MainObject | Add-Member - MemberType NoteProperty - Name " Channel Type | $i $ ( $abc | Select-Object - Index $ ($number )) " - Value $protocoltype
171+ $MainObject | Add-Member - MemberType NoteProperty - Name " Subscriber Address Name | $i $ ( $abc [$number ]) " - Value $ ($subscriber.Devices.Name | Select-Object - Index $ ($number - 1 ))
172+ $MainObject | Add-Member - MemberType NoteProperty - Name " Subscriber Address Destination | $i $ ( $abc [$number ]) " - Value $ ($subscriber.Devices.Address | Select-Object - Index $ ($number - 1 ))
161173 }
162- $MainObject | Add-Member - MemberType NoteProperty - Name " Subscriber Name $i " - Value $subscriber.Name
163- $MainObject | Add-Member - MemberType NoteProperty - Name " Channel Type $i " - Value $switchitup
164- $MainObject | Add-Member - MemberType NoteProperty - Name " Subscriber Address Name $i " - Value $subscriber.Devices.Name
165- $MainObject | Add-Member - MemberType NoteProperty - Name " Subscriber Address Destination $i " - Value $subscriber.Devices.Address
166174 }
167175 $i = 0
168176 $MainObject | Add-Member - MemberType NoteProperty - Name ' ' - Value " `n`n -------- Channel Information --------"
@@ -190,6 +198,7 @@ function Get-SCOMNotificationSubscriptionDetails
190198 $MainObject | Add-Member - MemberType NoteProperty - Name (" Body Encoding | $i " ) - Value ($action.BodyEncoding )
191199 $MainObject | Add-Member - MemberType NoteProperty - Name (" Reply To | $i " ) - Value ($action.ReplyTo )
192200 $MainObject | Add-Member - MemberType NoteProperty - Name (" Headers | $i " ) - Value ($action.Headers )
201+ $MainObject | Add-Member - MemberType NoteProperty - Name (" Is Body HTML? | $i " ) - Value ($action.IsBodyHtml )
193202 $MainObject | Add-Member - MemberType NoteProperty - Name (" Body | $i " ) - Value ($action.body )
194203 }
195204 elseif ($action.RecipientProtocol -like " Cmd*" )
@@ -199,12 +208,25 @@ function Get-SCOMNotificationSubscriptionDetails
199208 $MainObject | Add-Member - MemberType NoteProperty - Name (" Command Line | $i " ) - Value ($action.CommandLine )
200209 $MainObject | Add-Member - MemberType NoteProperty - Name (" Timeout | $i " ) - Value ($action.Timeout )
201210 }
202- elseif ($action.RecipientProtocol -like " Sip *" )
211+ elseif ($action.Endpoint -like " Im *" )
203212 {
204- $MainObject | Add-Member - MemberType NoteProperty - Name (" Application Name | $i " ) - Value ($action.ApplicationName )
205- $MainObject | Add-Member - MemberType NoteProperty - Name (" Working Directory | $i " ) - Value ($action.WorkingDirectory )
206- $MainObject | Add-Member - MemberType NoteProperty - Name (" Command Line | $i " ) - Value ($action.CommandLine )
207- $MainObject | Add-Member - MemberType NoteProperty - Name (" Timeout | $i " ) - Value ($action.Timeout )
213+ $MainObject | Add-Member - MemberType NoteProperty - Name (" Name | $i " ) - Value ($action.Name )
214+ $MainObject | Add-Member - MemberType NoteProperty - Name (" Encoding | $i " ) - Value ($action.Encoding )
215+ $MainObject | Add-Member - MemberType NoteProperty - Name (" Body | $i " ) - Value ($action.WorkingDirectory )
216+ $MainObject | Add-Member - MemberType NoteProperty - Name (" Content Type | $i " ) - Value ($action.ContentType )
217+ $MainObject | Add-Member - MemberType NoteProperty - Name (" Endpoint Primary Server | $i " ) - Value ($action.Endpoint.PrimaryServer.Address )
218+ $MainObject | Add-Member - MemberType NoteProperty - Name (" Endpoint Return Address | $i " ) - Value ($action.Endpoint.PrimaryServer.UserUri )
219+ }
220+ elseif ($action.Endpoint -like " Sms*" )
221+ {
222+ $MainObject | Add-Member - MemberType NoteProperty - Name (" Name | $i " ) - Value ($action.Name )
223+ $MainObject | Add-Member - MemberType NoteProperty - Name (" Encoding | $i " ) - Value ($action.Encoding )
224+ $MainObject | Add-Member - MemberType NoteProperty - Name (" Body | $i " ) - Value ($action.WorkingDirectory )
225+ $MainObject | Add-Member - MemberType NoteProperty - Name (" Content Type | $i " ) - Value ($action.ContentType )
226+ $MainObject | Add-Member - MemberType NoteProperty - Name (" Endpoint Primary Device | $i " ) - Value ($action.Endpoint.PrimaryDevice )
227+ $MainObject | Add-Member - MemberType NoteProperty - Name (" Endpoint Secondary Device | $i " ) - Value ($action.Endpoint.SecondaryDevices | Out-String - Width 2048 )
228+ $MainObject | Add-Member - MemberType NoteProperty - Name (" Endpoint Device Enumeration Interval Seconds | $i " ) - Value ($action.Endpoint.DeviceEnumerationIntervalSeconds )
229+ $MainObject | Add-Member - MemberType NoteProperty - Name (" Endpoint Primary Device Switch Back Interval Seconds | $i " ) - Value ($action.Endpoint.PrimaryDeviceSwitchBackIntervalSeconds )
208230 }
209231 }
210232 $finalstring += $MainObject | Out-String
0 commit comments