What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Can I Get A List Of Used Usernames In Of PRTG?

Votes:

0

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?

credentials devices groups list powershell

Created on Oct 26, 2016 9:12:45 AM by  Stephan Linke [Paessler Support]

Last change on Dec 14, 2016 7:14:31 AM by  Stephan Linke [Paessler Support]



9 Replies

Accepted Answer

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:

Credential Overview

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

Created on Dec 10, 2018 10:47:31 AM by  Stephan Linke [Paessler Support]



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.

Created on Dec 14, 2018 8:55:59 AM



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

Created on Dec 14, 2018 9:05:29 AM by  Stephan Linke [Paessler Support]



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"

Created on Jun 28, 2020 8:17:10 AM



Votes:

0

The line is already part of the script - where exactly did you put that one in?

Created on Jun 29, 2020 8:28:26 AM by  Stephan Linke [Paessler Support]



Votes:

0

Hello, why I get the same result after editing accounts in sensors?

Created on Sep 30, 2021 6:23:09 AM



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

Created on Oct 5, 2021 5:26:59 AM by  Felix Wiesneth [Paessler Support]




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.