Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [string] $ConfigurationFilePath = ((Get-ItemProperty -Path "hklm:SOFTWARE\Wow6432Node\Paessler\PRTG Network Monitor\Server\Core" -Name "Datapath").DataPath) + "PRTG Configuration.dat"
- [xml] $configuration = New-Object -TypeName XML;
- $configuration.Load($ConfigurationFilePath)
- [System.Collections.ArrayList]$ADEnabledGroups = @();
- [System.Collections.ArrayList]$ADEnabledDevices = @();
- $Groups = ($configuration.SelectNodes("//group"))
- $Devices = ($configuration.SelectNodes("//device"))
- foreach($Device in $Devices){
- if($device.data.discoverytype.trim() -ne 0)
- { $ADEnabledDevices.Add($device.id); }
- }
- foreach($Group in $Groups){
- if($group.data.discoverytype.trim() -ne 0)
- { $ADEnabledGroups.Add($group.id); }
- }
- if($ADEnabledDevices.Count -eq 0)
- { $DeviceMsg = "No devices with AutoDiscovery found." }
- else
- { $DeviceMsg = [string]::Format("Devices with AutoDiscovery found: {0} ({1})",$ADEnabledDevices.Count,$ADEnabledDevices -join ", ") }
- if($ADEnabledGroups.Count -eq 0)
- { $GroupMsg = "No groups with AutoDiscovery found." }
- else
- { $GroupMsg = [string]::Format("Groups with AutoDiscovery found: {0} ({1})",$ADEnabledGroups.Count,$ADEnabledGroups -join ", ") }
- $Msg = [string]::Format("{0} | {1}",$GroupMsg,$DeviceMsg);
- $Count = $ADEnabledGroups.Count + $ADEnabledDevices.Count;
- Write-Host ([string]::Format("{0}:{1}",$Count,$Msg))
Advertisement
Add Comment
Please, Sign In to add comment