New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

200.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

 

Top Tags


View all Tags


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

Votes:

0

Your Vote:

Up

Down

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]



20 Replies

Accepted Answer

Votes:

0

Your Vote:

Up

Down

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.

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 Aug 12, 2016 1:19:57 PM by  Gerald Schoch [Paessler Support]



Votes:

0

Your Vote:

Up

Down

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 by  Jason Proos (160) 2 1



Votes:

0

Your Vote:

Up

Down

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

Your Vote:

Up

Down

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 by  uozolins (0)



Votes:

0

Your Vote:

Up

Down

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 by  Peter Grant (0)



Votes:

0

Your Vote:

Up

Down

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 by  uozolins (0)

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



Votes:

0

Your Vote:

Up

Down

@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

Your Vote:

Up

Down

@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 by  Peter Grant (0)



Votes:

0

Your Vote:

Up

Down

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

Your Vote:

Up

Down

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 by  Peter Grant (0)



Votes:

0

Your Vote:

Up

Down

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

Your Vote:

Up

Down

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 by  hilfswerk (0)



Votes:

0

Your Vote:

Up

Down

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

Your Vote:

Up

Down

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 by  Wayne Byers (10)

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



Votes:

0

Your Vote:

Up

Down

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

Your Vote:

Up

Down

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

Your Vote:

Up

Down

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 by  friedenthal (0) 1

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



Votes:

0

Your Vote:

Up

Down

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

Your Vote:

Up

Down

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 by  friedenthal (0) 1



Votes:

0

Your Vote:

Up

Down

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]



Please log in or register to enter your reply.


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.