Brian Madden Logo
Your independent source for application and desktop virtualization.
advertisement

Help needed with a batch file to report user sessions, in the Management, Maintenance & Reporting forum on BrianMadden.com

rated by 0 users
This post has 4 Replies | 1 Follower

Not Ranked
Points 50
Slingo Posted: Thu, Jan 26 2012 8:23 AM

I have a cmd file which reports all sessions running across all servers (125) in our server farm, which pipes out to a text file.

query user /Server:XXXXT001 >> users.txt
query user /Server:XXXXT002 >> users.txt

etc

This basically shows me that there are sessions running across all servers like this:-

 USERNAME              SESSIONNAME        ID  STATE   IDLE TIME  LOGON TIME
 xxxxxxxxxxxxx        ica-tcp#3           1  Active         18  26/01/2012 09:36
 USERNAME              SESSIONNAME        ID  STATE   IDLE TIME  LOGON TIME
 yyyyyyyyyyyy          ica-tcp#31          1  Active          4  26/01/2012 07:44

etc etc for the rest of the farm (usernames substituted for obvious reasons).

Can anyone tell me how to include the server names? It's probably dead simple but my command line skills are pretty dismal.

 

Any help would be appreciated

  • | Post Points: 20
Not Ranked
Points 290

I know this is going to extreme, but notice that you are using append.... so why not just add the server in before each query?

wscript.echo XXXXT001 >> users.txt

query user /Server:XXXXT001 >> users.txt

you could put in a blank line between the servers then, make it easy to read by adding a 

wscipt.echo .

 

Hope this helps

  • | Post Points: 20
Not Ranked
Points 50
Slingo replied on Wed, Apr 25 2012 5:38 AM

That doesn't seem to workfor me :-(

  • | Post Points: 20
Not Ranked
Points 290

sorry, was editing vbscript at the time, it should just be echo

echo XXXXT01 >> users.text

 

and echo. puts in a blank line

 

Thanks

  • | Post Points: 20
Not Ranked
Points 50
Slingo replied on Wed, Apr 25 2012 5:58 AM

I wouldn't have realised that - I told you my scripting skills were dismal but...Hurrah! That worked!

 

Thanks a lot!

  • | Post Points: 5
Page 1 of 1 (5 items) | RSS