|
1 | 1 | function AddToStatInfo_SmEnv_SM() { |
2 | | - #region Notification Channel |
3 | | - # Caution: Authentication types are hardcoded to be only Anonymous,OAUTHAuthentication,WindowsIntegrated |
4 | | - $Channel = CreateElementForStatInfo -elemTagName Channel |
5 | | - $ChannelData = GetFileContentInSourceFolder Get-SCSMChannel.csv | ConvertFrom-Csv |
6 | | - $Channel.SetAttribute("IsEnabled", $ChannelData.IsEnabled) |
7 | 2 |
|
8 | | - $ConfigurationSources = CreateElementForStatInfo -elemTagName ConfigurationSources |
9 | | - $ConfigurationSourcesData = GetFileContentInSourceFolder Get-SCSMChannel_WithAuthentication.csv | ConvertFrom-Csv |
10 | | - $authCounts = @{ |
11 | | - "Anonymous" = 0 |
12 | | - "OAUTHAuthentication" = 0 |
13 | | - "WindowsIntegrated" = 0 |
14 | | - } |
15 | | - $count_Total = 0 |
16 | | - $ConfigurationSources.SetAttribute("PrimaryAuth", "None") |
17 | | - foreach($line in $ConfigurationSourcesData) { |
| 3 | + if (IsSourceScsmMgmtServer) { # if running on a WF or Secondary mgmt server. |
| 4 | + |
| 5 | + #region Notification Channel |
| 6 | + # Caution: Authentication types are hardcoded to be only Anonymous,OAUTHAuthentication,WindowsIntegrated |
| 7 | + $Channel = CreateElementForStatInfo -elemTagName Channel |
| 8 | + $ChannelData = GetFileContentInSourceFolder Get-SCSMChannel.csv | ConvertFrom-Csv |
| 9 | + $Channel.SetAttribute("IsEnabled", $ChannelData.IsEnabled) |
18 | 10 |
|
19 | | - if ($line.SequenceNumber -eq "0") { |
20 | | - $ConfigurationSources.SetAttribute("PrimaryAuth", $line.Authentication) |
| 11 | + $ConfigurationSources = CreateElementForStatInfo -elemTagName ConfigurationSources |
| 12 | + $ConfigurationSourcesData = GetFileContentInSourceFolder Get-SCSMChannel_WithAuthentication.csv | ConvertFrom-Csv |
| 13 | + $authCounts = @{ |
| 14 | + "Anonymous" = 0 |
| 15 | + "OAUTHAuthentication" = 0 |
| 16 | + "WindowsIntegrated" = 0 |
21 | 17 | } |
22 | | - $ConfigurationSource = CreateElementForStatInfo -elemTagName ConfigurationSource |
23 | | - $ConfigurationSource.SetAttribute("SequenceNumber", $line.SequenceNumber) |
24 | | - $ConfigurationSource.SetAttribute("Authentication", $line.Authentication) |
| 18 | + $count_Total = 0 |
| 19 | + $ConfigurationSources.SetAttribute("PrimaryAuth", "None") |
| 20 | + foreach($line in $ConfigurationSourcesData) { |
| 21 | + if ($line.SequenceNumber -eq "0") { |
| 22 | + $ConfigurationSources.SetAttribute("PrimaryAuth", $line.Authentication) |
| 23 | + } |
| 24 | + $ConfigurationSource = CreateElementForStatInfo -elemTagName ConfigurationSource |
| 25 | + $ConfigurationSource.SetAttribute("SequenceNumber", $line.SequenceNumber) |
| 26 | + $ConfigurationSource.SetAttribute("Authentication", $line.Authentication) |
25 | 27 |
|
26 | | - $ConfigurationSources.AppendChild( $ConfigurationSource ) | Out-Null |
| 28 | + $ConfigurationSources.AppendChild( $ConfigurationSource ) | Out-Null |
27 | 29 |
|
28 | | - $authCounts[$line.Authentication]++ |
29 | | - $count_Total++ |
30 | | - } |
31 | | - $ConfigurationSources.SetAttribute("Count_Total", $count_Total.ToString() ) |
32 | | - $ConfigurationSources.SetAttribute("Count_Anonymous", $authCounts["Anonymous"].ToString() ) |
33 | | - $ConfigurationSources.SetAttribute("Count_OAUTHAuthentication", $authCounts["OAUTHAuthentication"].ToString() ) |
34 | | - $ConfigurationSources.SetAttribute("Count_WindowsIntegrated", $authCounts["WindowsIntegrated"].ToString() ) |
| 30 | + $authCounts[$line.Authentication]++ |
| 31 | + $count_Total++ |
| 32 | + } |
| 33 | + $ConfigurationSources.SetAttribute("Count_Total", $count_Total.ToString() ) |
| 34 | + $ConfigurationSources.SetAttribute("Count_Anonymous", $authCounts["Anonymous"].ToString() ) |
| 35 | + $ConfigurationSources.SetAttribute("Count_OAUTHAuthentication", $authCounts["OAUTHAuthentication"].ToString() ) |
| 36 | + $ConfigurationSources.SetAttribute("Count_WindowsIntegrated", $authCounts["WindowsIntegrated"].ToString() ) |
35 | 37 |
|
36 | | - $Channel.AppendChild($ConfigurationSources) |
37 | | - $smEnv_SM.AppendChild($Channel) |
38 | | - #endregion |
| 38 | + $Channel.AppendChild($ConfigurationSources) |
| 39 | + $smEnv_SM.AppendChild($Channel) |
| 40 | + #endregion |
39 | 41 |
|
| 42 | + #region Connectors |
| 43 | + |
| 44 | + #endregion |
| 45 | + } |
40 | 46 | } |
0 commit comments