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
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
yes you are right, but maybe this helps as well:
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
Hi p_mandryk_admin
Hmm. How about a vbs/wsh script which counts all the sessions on the server? like (getusers.vbs):
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