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

How can I monitor the number of users logged in to Windows?

Votes:

0

Previous PRTG versions included the Windows Logged in Users sensor to monitor the number of users logged in to a Windows computer. This sensor type is marked as “deprecated” as of version 16.2.23 removed from PRTG with version 16.x.25.

Is there a way to still monitor the number of logged in Windows users? How can I do this?

cleanup custom-script-exe custom-sensor deprecated prtg remove userloggedin users windows

Created on Apr 26, 2016 4:17:36 PM by  Gerald Schoch [Paessler Support]



39 Replies

Accepted Answer

Votes:

0

This article applies to PRTG Network Monitor 16.2.23 or later

Monitoring the Number of Logged in Windows Users

The Windows Logged In Users sensor is one of the sensor types that we remove in context of the The PRTG Sensor Cleanup. You could use this sensor to monitor the number of users logged in to a Windows device. As of PRTG version 16.2.23 you cannot add this sensor anymore and running Windows Logged In Users sensors are removed from PRTG with version 16.x.25.

Although this sensor type is not available out of the box anymore, you can still monitor the number of logged in users on a Windows computer with a custom sensor. Please download it from PRTG Tools Family and add it to your PRTG installation.

Requirement: .NET Framework

This sensor type requires the Microsoft .NET Framework to be installed on the computer running the PRTG probe: either on the local system (on every node, if on a cluster probe), or on the system running the remote probe. The required .NET version is .NET 4.0 (Client Profile is sufficient), .NET 4.5, or .NET 4.6. For more information, please see this article. Please additionally install .NET 3.5 on the probe system if the sensor shows an error.

Steps to Go

  1. Download PTF.UserLoggedin.zip from PRTG Tools Family.
  2. Extract the ZIP-file and copy UserLoggedin.exe into the \Custom Sensors\EXE subfolder of your PRTG installation and on the computers on which you run remote probes.
  3. Add an EXE/Script sensor to your PRTG installation.
  4. In sensor settings section EXE/Script choose the file UserLoggedin.exe
  5. In the Parameters field specify the following parameters:
ParameterDescription
-c=computerThe IP address or hostname of the computer that you want to monitor.
-u=usernameOptionally define the name of the user account that has access to the computer via WMI service.
-p=passwordOptionally define the password or passhash of the user account that has access to the computer via WMI service.
-f=filterOptionally define a filter to not or only count the users specified (comma separated list).
-fxOptional switch which defines that users in the filter are not counted (default).
-fiOptional switch that defines that only users in the filter are counted.
-xuOptional switch that defines that the number of users logged in is shown instead of their names.
-nodwmOptional switch excluding DWM-xxx users.
-pcOptional comma seperated list of processes to check. default = 'explorer.exe,rdpinit.exe'

Save the settings to start monitoring the number of users logged in on the target Windows device.


Alternative: UsersLoggedinXML Sensor

The UsersLoggedin sensor we describe above is basically the same sensor as the deprecated Windows Logged In Users sensor that used to be available as native sensor type in PRTG. Moreover, PRTG Tools Family provides an XML version of this sensor type.

This custom sensor retrieves the user accounts logged in to a Windows computer and parses this data as multi-channel result to an EXE/Script Advanced sensor in PRTG. It creates one channel for every user who has logged in, or you can monitor only specific user accounts. See PRTG Tools Family for more information about this sensor.

You can download the UsersLoggedinXML sensor here:

Created on Apr 26, 2016 4:19:57 PM by  Gerald Schoch [Paessler Support]

Last change on May 11, 2022 1:31:24 PM by  Florian Lesage [Paessler Support]



Votes:

0

This sensor doesn't seem to work correctly on Windows Server 2008 R2. It's reporting that I have 5 users logged onto the server but there are actually many more than that (24, actually).

Created on May 17, 2016 4:23:57 PM



Votes:

0

Hi Jason,

I've send you an email, since we would need a few details for further investigating the issue.

Kind regards.

Created on May 19, 2016 10:12:51 AM by  Erhard Mikulik [Paessler Support]



Votes:

0

Can You please put some examples how parameter entry will look like? Somehow I am getting 0x800706BA) error. Thanks

Created on Jul 12, 2016 4:16:50 PM



Votes:

0

I'm having a few problems with setting this up - if I run the exe from the the command line it produces the correct info, but it claims "Access denied. Please check your Windows credentials. (code: PE095)". But I'm sure they're correct as other sensors are using them on the same device. I've tried slight variations on domain but no luck. Any suggestions?

Created on Jul 13, 2016 11:22:05 AM



Votes:

0

I spent half day on this, but at least I work now. Here what I have under settings:

  • EXE/Script: Userloggedin.exe
  • Parameters: -c=myservername -f=DWM-1,DWM-2 -fx
  • Enviroment: Default Enviroment
  • Security Context: Use Windows credentials of parent device
  • Mutex name: left empty
  • Timeout(sec): 60
  • Value type: Integer
  • If value changes: Trigger 'change' notification ............

Created on Jul 13, 2016 1:48:26 PM

Last change on Jul 13, 2016 2:15:42 PM by  Erhard Mikulik [Paessler Support]



Votes:

0

@uozolins: Good to hear you figured it out!

@Peter: When running from commandline it automatically applies the security context of the user you're currently logged in with. In the settings of the sensor you can switch the security context to "Use Windows credentials of parent device". Otherwise it's running in the context of the probe service (which is "Local System").

Created on Jul 13, 2016 2:14:02 PM by  Erhard Mikulik [Paessler Support]

Last change on Jul 13, 2016 2:16:46 PM by  Erhard Mikulik [Paessler Support]



Votes:

0

@Erhard Mikulik [Paessler Support]: I already had that option set. Having changed the user to my own credentials, it now works - but I don't want to have my credentials in there. I had already added the user it previously had to the administrator group on the server we're monitoring, I'm wondering what other permissions it needs.

Created on Jul 13, 2016 3:53:57 PM



Votes:

0

Hi Peter,

Thing is, you need a user that is able to access the target's WMI Service, usually this is a user with administrative privileges. You can run the command manually from commandline additionally passing username and password as parameters. There you might get a more detailed error.

Kind regards.

Created on Jul 14, 2016 8:18:55 AM by  Erhard Mikulik [Paessler Support]



Votes:

0

Hi Erhard: Weirdly it works fine using the aternative account on the command line, no errors at all. Still doesn't work from inside PRTG with that account. I've now added the same account details as parameters to the sensor and change it back to 'Use security context of the probe' and it's working fine.

Created on Jul 14, 2016 11:03:41 AM



Votes:

0

Hi Peter,

Yes, some executables require "wiring" the credentials explicitly as paramaters and are not pulling it from the parent device, should have mentioned that earlier, sorry. Good thing you figured it out and it's working now.

Kind regards.

Created on Jul 15, 2016 8:26:23 AM by  Erhard Mikulik [Paessler Support]



Votes:

0

Is there a possibility to show only online Users and not all Users who logged in the past?

Created on Sep 14, 2016 12:05:11 PM



Votes:

0

Hello hilfswerk,

UserLoggedin.exe (without XML) mentioned above can do that, only showing currently logged in users in the sensor's message. The required parameters would be

-c=%host -u=%windowsdomain\%windowsuser -p=%windowspassword

Kind regards,

Erhard

Created on Sep 15, 2016 11:18:22 AM by  Erhard Mikulik [Paessler Support]



Votes:

1

For users who don't want to run some .EXE, I just figured out how to form PowerShell scripts & execute as a Custom/EXE probe.

First of all, I will mention that my PRTG core service & probe are running as service accounts in my domain. This account was given the privileges to execute remote commands on any machine I am running my PS scripts against.

I wrote a simple PS script that is the following:

param($compname) $x= query user /server:$compname $y = $x.count.toString() write-host $y":OK"

Remark: See adjusted version below that won't return "-1" in case no user is logged in.

To break this script down to its components: The first line takes IN a PARAMETER which will be set up for the PROBE later. Then it executes the Query User command, specifying the computername passed to the script from the PRTG probe. The next line gets the .count and converts it to a string, because PRTG seemed to not be able to handle it if it was not. Then, finally it puts the value, and the Required ':OK' string that PRTG custom EXE's and scripts seem to require.


This script must be saved as "Something.ps1" in the PRTG EXE/Script Area, which by default in Windows appears to be C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXE\.

From there, I followed the instructions on this article: https://www.paessler.com/manuals/prtg/exe_script_sensor

But some details: USE INTEGER, not "Counter", for all these!

Created on Oct 7, 2016 6:36:01 PM

Last change on Oct 11, 2016 7:54:25 AM by  Erhard Mikulik [Paessler Support]



Votes:

0

Hello Wayne,

Thank you for contributing.

Kind regards,

Erhard

Created on Oct 10, 2016 1:12:34 PM by  Erhard Mikulik [Paessler Support]



Votes:

1

Hello Wayne,

One remark about your script: You're basically counting the lines of the output. In case no user is logged in, the query fails and the result would be "-1".

Here's a slightly adjusted version (courtesy of Luciano Lingnau) that takes this into account and returns "0" if no user is found: param($compname) $x= query user /server:$compname if ($x) { $y = $x.count.toString()-1 } write-host $y":OK"

Kind regards,

Erhard

Created on Oct 11, 2016 7:52:50 AM by  Erhard Mikulik [Paessler Support]



Votes:

0

Althought the sensor works I cannot find a way to use it properly. On a certain machine we need that a certain users is always logged in, PRTG is able to see if is logged or not however it does not trigger any alarm which I need whenever this user is not connected to machine. I've set this string : -c=10.10.11.155 -u=*-p=h:**== -fi=XYZ .

Kind regards F.

Created on Sep 27, 2017 7:30:35 AM

Last change on Sep 29, 2017 9:07:08 AM by  Erhard Mikulik [Paessler Support]



Votes:

0

Hi F.,

If I see correctly, you configured the sensor to look only for a particular user. There should be channel "Value" in the sensor that shows how often this user is being found. So when this user is not logged in, channel "Value" will show "0". So all you need to do is click on the channel to enter its settings, enable limits there and set lower error limit to 1. The sensor will switch then to error state, when "Value" is smaller than "1".

Kind regards,

Erhard

Created on Sep 27, 2017 1:08:00 PM by  Erhard Mikulik [Paessler Support]



Votes:

0

Thanks Erhard, it works, but the problem is that there is a chance that not only that user but also another one is logged on the machine and in this case it won't generate an alarm because at least one user is logged.

Thanks for a support F.

Created on Sep 28, 2017 1:48:58 PM



Votes:

0

Hi F,

You need to have parameter "-f" to pass along the username and the switch "-fi" to restrict the sensor to count only login sessions of this particular user, so in the end it should look something like this: -c=%host -f=username -fi -nodwm

Kind regards,

Erhard

Created on Sep 28, 2017 3:31:18 PM by  Erhard Mikulik [Paessler Support]



Votes:

0

I have to dig it out again. With the parameters: here I enter the server to which the sensor belongs correctly? I get the error message every time: 0x80070005 (E_ACCESSDENIED))

what am I doing wrong? and why do I have to specify the server in the parameters? I already put the sensor under the server?

Created on Feb 28, 2020 7:55:01 AM



Votes:

0

Hi there,

This error message is directly returned by Windows and means that either the configured credentials are wrong or missing needed permissions. Please check this accordingly.


Kind regards,
Birk Guttmann, Tech Support Team

Created on Feb 28, 2020 11:54:00 AM by  Birk Guttmann [Paessler Support]



Votes:

0

Hi Birk,

after i used the Domainadmin i got these Failure: 0x800706BA)

Created on Feb 28, 2020 2:25:49 PM



Votes:

0

Hi there,

This message is directly returned by the target Windows device and means that there is some issue with the RPC server.

Please check out the following article for some troubleshooting steps, especially the RPC section.


Kind regards,
Birk Guttmann, Tech Support Team

Created on Mar 2, 2020 3:23:19 PM by  Birk Guttmann [Paessler Support]



Votes:

0

Hey Birk,

the strange thing is that other WMI sensors work on this server. Only the WMI query for the logged in users does not work.

RPC is available on this Server.

Any other ideas?

Created on Mar 9, 2020 10:18:03 AM



Votes:

0

Hi there,

If you want to, we can analyse this issue in more detail, but that's not possible in the Knowledge Base. Therefore, please open a new ticket ([email protected]).


Kind regards,
Birk Guttmann, Tech Support Team

Created on Mar 9, 2020 11:03:32 AM by  Birk Guttmann [Paessler Support]

Last change on Mar 9, 2020 11:04:13 AM by  Birk Guttmann [Paessler Support]



Votes:

0

Is it safe to use this solution to add this sensor? Why was this sensor removed/deprecated?

Created on Apr 2, 2020 7:32:31 PM



Votes:

0

Hi there,

Most likely the usage rate of this sensor was very low and there changes were needed to maintain the sensor with a good working here. Most of the time this is the case when we deprecate features. You read this in more detail in this post.

The Sensors from the PTF (PRTG Tools Family) are quite nice and offer additional options to monitor your system.


Kind regards,
Birk Guttmann, Tech Support Team

Created on Apr 3, 2020 9:06:43 AM by  Birk Guttmann [Paessler Support]

Last change on Mar 28, 2022 12:11:19 PM by  Frank Hadasch [Paessler Support] (0) 1



Votes:

0

Hi am receiving the error Object reference not set to an instance of an object. Has anyone seen this before?

Created on Aug 11, 2020 9:20:22 PM



Votes:

0

Hi guys,

maybe this helps: I'm querying the amount of active users on my TS with a custom Powershell sensor which is a simple "qwinsta" command:

write-host (qwinsta /Server:SERVERNAME | findstr Active).count,":OK"

Created on Apr 15, 2021 11:37:39 AM



Votes:

0

Hi guys,

unfortunately I get the following error with the sensor: Channels count exeeded the limit of 50

Is there a way to adjust the counter or any other way to avoid the error?

Created on May 11, 2021 5:47:18 AM



Votes:

0

Hello Pete,

Have you tried to use the option -xu to only get the number of users connected ? If not, please give it a try.

Regards.

Created on May 11, 2021 6:30:55 AM by  Florian Lesage [Paessler Support]



Votes:

0

Hello Florian,

the error also exists with the -xu option.

Regards

Created on May 11, 2021 6:34:45 AM



Votes:

0

I have checked the documentation of PRTG Tools Family and also tested the script on our side. Unfortunately, the option -xu doesn't seem to be usable anymore.

As the application is not developed by Paessler, I do not have any information/control on it. Therefore I invite you to contact PRTG Tools Family directly, via [email protected].

Regards.

Created on May 11, 2021 7:21:38 AM by  Florian Lesage [Paessler Support]



Votes:

0

Hi Tech Support Team,

The sensors works well. The program checks 3 processes (explorer.exe, rdpinit.exe, dwm.exe) to show currently logged in users. I would like to check other processes (ex: abc.exe) to monitor loggedin users. Could you help this or give me some suggestions?

Created on May 8, 2022 8:27:53 AM



Votes:

0

Hi,

According to the documentation provided by PRTG Tools Family, you should be able to monitor other processes by providing a comma separated list to the option -pc, as illustrated below:

Parameters

This should help you to monitor the processes you want.

Note: the article above is now up to date and provides the latest parameters for the application UserLoggedIn.

Regards.

Created on May 11, 2022 1:26:24 PM by  Florian Lesage [Paessler Support]

Last change on May 11, 2022 1:34:39 PM by  Florian Lesage [Paessler Support]



Votes:

0

with regards to this Sensor (UserLoggedin.exe) counting only the current online User, I tried the parameter solution above:

-c=%host -u=%windowsdomain\%windowsuser -p=%windowspassword

but so far, it is still detecting and counting also the users in Disconnected state. Am I doing something wrong or missing other parameters? Thank you. :)
- Mark G.

PRTG core server service: V21.4.73.1656
PRTG probe service: V21.4.73.1656
PRTG Administration Tool: V21.4.73.1656

Created on Aug 3, 2022 8:03:34 AM

Last change on Aug 4, 2022 5:47:29 AM by  Felix Wiesneth [Paessler Support]



Votes:

0

Maybe this helps you: https://github.com/Jannos-443/PRTG-LoggedOnUser

You can include/exclude User

Created on Aug 6, 2022 2:07:21 PM



Votes:

0

Hi there,

As the application is developed by PRTG Tools Family, we are limited in the support unfortunately. Therefore, I invite you to contact them directly at [email protected]. This way, they can fix potential issues or improve the application if needed.

Regards.

Created on Aug 17, 2022 1:07:54 PM by  Florian Lesage [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.