I have an awful lot of devices and groups using different accounts for monitoring. One of them has changed and PRTG keeps locking the account because it's still using the old username.
Is there any way to retrieve a list of usernames configured in the groups and devices?
Can I Get A List Of Used Usernames In Of PRTG?
Votes:
0
9 Replies
Votes:
5
The following script will give you a sortable list of all usernames configured in devices and groups, which can be filtered as necessary.
Simply save it as PRTG-GetCredentials.ps1 and execute it in a PowerShell window. The list will look like this:
Note that inherited can also mean "not configured".
Attention You can't retrieve passwords with this. Only configured domains and usernames.
Here's the actual script:
#requires -version 4.0 # ___ ___ _____ ___ #| _ \ _ \_ _/ __| #| _/ / | || (_ | #|_| |_|_\ |_| \___| # Credential Lister ################### # # What exactly is this? ################### # This script shows you all the configured credentials in PRTG (only domain and username). # This will allow you to discern where a faulty account is stored in case it gets locked due to PRTG # still using outdated credentials. It will show all types of credentials. ################### # # How does it work? ################### # Simply execute the script on your PRTG server and it will show a filterable and sortable list. # Depending on the size of your configuration, it may take a while, please be patient. ################### # # How do I configure the script itself? ################### # The script doesn't need any configuration. # # Version History # ---------------------------- # 1.1 [Bugfix] Groups were discarded and are now included in the view # 1.0 Initial Release # # # # # # # # # # # # # # # # # # # # # # # # # # #region configuration ## PRTG configuration [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) ## nodes $prtgGroups = $configuration.SelectNodes("//group") $prtgDevices = $configuration.SelectNodes("//device") #endregion #region function <# Function Section ################################# All functions of the script are defined here. ############################### #> <# Function Name: This-GetXMLValue ################################# Used For: Retrieving XML values. Returns inherited if the trim fails (i.e. if there's nothing to trim ################################# Parameters: # [xml] object - the object that should have it's node extracted # [string] node - the node you want retrieved ################################# #> function This-GetXMLValue($object,[string]$node){ try { $value = $object.data.$node.trim(); } catch { $value = "Inherited" } return $value; } #endregion $Credentials = foreach($prtgGroup in $prtgGroups){ [pscustomobject]@{ ID = $prtgGroup.ID Name = $prtgGroup.data.name.Trim() Type = "Group" "Windows Domain" = (This-GetXMLValue -node "windowslogindomain" -object $prtgGroup) "Windows Login" = $prtggroup.data.windowsloginusername.InnerText.trim() "Linux Login" = (This-GetXMLValue -node "linuxloginusername" -object $prtgGroup) "ESX Login" = (This-GetXMLValue -node "esxuser" -object $prtgGroup) "Database Login" = (This-GetXMLValue -node "dbuser" -object $prtgGroup) "SNMP Community" = (This-GetXMLValue -node "snmpuser" -object $prtgGroup) } } $Credentials += foreach($prtgDevice in $prtgDevices){ [pscustomobject]@{ ID = $prtgDevice.ID Name = $prtgDevice.data.name.Trim() Type = "Device" "Windows Domain" = (This-GetXMLValue -node "windowslogindomain" -object $prtgDevice) "Windows Login" = $prtgdevice.data.windowsloginusername.InnerText.trim() "Linux Login" = (This-GetXMLValue -node "linuxloginusername" -object $prtgDevice) "ESX Login" = (This-GetXMLValue -node "esxuser" -object $prtgDevice) "Database Login" = (This-GetXMLValue -node "dbuser" -object $prtgDevice) "SNMP Username" = (This-GetXMLValue -node "snmpuser" -object $prtgDevice) } } $Credentials | Out-GridView -Title "PRTG Credentials"
Created on Oct 26, 2016 9:20:41 AM by
Stephan Linke [Paessler Support]
Last change on Jun 19, 2019 6:18:02 AM by
Stephan Linke [Paessler Support]
Votes:
1
does not show windowsloginusername correctly (shows "inherited" for all names)
used following line instead to get the correct login name:
"Windows Login" = $prtggroup.data.windowsloginusername.InnerText.trim() instead of: "Windows Login" = (This-GetXMLValue -node "windowsloginusername" -object $prtgGroup)
analog for $prtgDevice
Created on Dec 6, 2018 9:37:36 AM
Last change on Dec 6, 2018 10:45:25 AM by
Sven Roggenhofer [Paessler Technical Support]
Votes:
0
@computerix Thanks for the hint, fixed it in the initial post :)
PRTG Scheduler |
PRTGapi |
Feature Requests |
WMI Issues |
SNMP Issues
Kind regards,
Stephan Linke, Tech Support Team
Votes:
0
Where i need to Run this script? Core Server or Probes? Are you sure this script works in last versions of PRTG? Trying to use at 18.4.46.1754+ and it show none of my SNMP community of entire PRTG and it shows some of my Windows Servers Logins.
Votes:
0
This needs to be run on the PRTG Server itself. It's normal for the communities not to show up, as they're encrypted (since they're considered passwords internally).
PRTG Scheduler |
PRTGapi |
Feature Requests |
WMI Issues |
SNMP Issues
Kind regards,
Stephan Linke, Tech Support Team
Votes:
0
The following line worked with me well: "Windows Login" = $prtggroup.data.windowsloginusername.InnerText.trim() instead of: "Windows Login" = (This-GetXMLValue -node "windowsloginusername" -object $prtgGroup)
Meanwhile, the original lline returned all as "Inherited"
Votes:
0
The line is already part of the script - where exactly did you put that one in?
Votes:
0
Hello, why I get the same result after editing accounts in sensors?
Votes:
0
Hi,
it could be possible that the configuration file was not yet saved and the "old" one was checked. Please check whether the configuration file was saved after editing accounts.
Kind regards
Felix Wiesneth - Team Tech Support
Add comment