Python Forum
Query number of Logged in users?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Query number of Logged in users?
#4
OK got it.

SO when i got home i played around with this and am getting closer to what i want to do, but essentially, this question is answered. So here is the solution I came up with in case anyone is interested :

Windows CMD/Powerhshell has :

query user /server:<hostname>

which return all logged in users from the command line/powershell prompt.

So using this in conjuction with the rest goes something like this...

Dropping into a python box :

>>> import os
>>> os.system('query user /server:myservername')
USERNAME SESSIONNAME ID STATE IDLE TIME LOGON TIME
john.doe ica-tcp#70 1 Active 7 13/02/2017 8:11

now all i need to do is put this into a count loop, maybe counting each line and dropping the first one.

Hope this helps someone else. Please feel free to post another solution. Always happy to learn!
Say NO to TROLLs!!  **naughty**
Reply


Messages In This Thread
Query number of Logged in users? - by S0undwav3 - Feb-13-2017, 01:33 PM
RE: Query number of Logged in users? - by S0undwav3 - Feb-13-2017, 07:41 PM
RE: Query number of Logged in users? - by S0undwav3 - Feb-13-2017, 09:24 PM
RE: Query number of Logged in users? - by Larz60+ - Feb-13-2017, 10:16 PM
RE: Query number of Logged in users? - by S0undwav3 - Feb-15-2017, 01:45 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Logged On User - Remote Machines mickrobinson567812 0 1,579 Apr-20-2020, 11:43 AM
Last Post: mickrobinson567812

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020