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.txtquery 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
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
That doesn't seem to workfor me :-(
sorry, was editing vbscript at the time, it should just be echo
echo XXXXT01 >> users.text
and echo. puts in a blank line
Thanks
I wouldn't have realised that - I told you my scripting skills were dismal but...Hurrah! That worked!
Thanks a lot!