I'm looking for a way to monitor the count of users attached to a session on a file server. I am trying to get an accurate count of how many concurrent users we have so that I can use these numbers for a VDI proposal and its licensing counts.

I don't want to buy 500 licenses when I only ever have 150 users logged in on a heavy day.

Thanks,

Phil Mandryk


Article Comments

Hi p_mandryk_admin

Hmm. How about a vbs/wsh script which counts all the sessions on the server? like (getusers.vbs):

Set objConnection = GetObject("WinNT://fileserver01/LanmanServer")
Set colSessions = objConnection.Sessions

dim users 
users = 0

For Each objSession in colSessions
users = users + 1
Next

wscript.echo users

Please check the manual how to get the returnwert with VBS scripts in the PRTG Manual. I never used it before, but it's possible.


Aug, 2015 - Permalink

Ha.. I was curious. Just use

Set objConnection = GetObject("WinNT://fs01/LanmanServer")
Set colSessions = objConnection.Sessions

dim users 
users = 0

For Each objSession in colSessions
users = users + 1
Next

Wscript.Echo users&":Ok" 

Dont forget to change the Servers name in "winNT: fs01...

cheers Thomas


Aug, 2015 - Permalink

Thanks, Thomas. That worked.


Aug, 2015 - Permalink

Hi, pay attention that every user can have multiple sessions to a server.


Aug, 2015 - Permalink

yes you are right, but maybe this helps as well:

https://helpdesk.paessler.com/en/support/solutions/articles/57613-can-you-monitor-server-share-sessions-with-prtg

Or you add Wscript.Echo "User: " & objSession.User in the FOR NEXT Loop, and save the output to a file. -> use Excel for stats.

or simply

*batch* net sess > %time%sessions.txt *batch*

This file can be imported into excel (delimiter tab and space), then manually sort and count. Please be aware, depending on the system language, you have to parse the %time% first, because return has specialcharaters, which cannot be used as filename.

regards Thomas


Aug, 2015 - Permalink