Using Terminal Services 'query' in batch file
Posted
by dboarman-FissureStudios
on Super User
See other posts from Super User
or by dboarman-FissureStudios
Published on 2010-04-26T17:39:34Z
Indexed on
2010/04/26
17:43 UTC
Read the original article
Hit count: 303
I have a batch file that checks several of our servers for a user. From the command:
query user %userID% /server:ServerName
I want to capture the output before it goes to the screen. Is there a way to redirect the output to a variable?
The basic gist of what I want to accomplish is this - we iterate through our servers:
query user %userID% /server:Server1
query user %userID% /server:Server2
query user %userID% /server:Server3
query user %userID% /server:Server4
Instead of outputting a message that the user could not be found on a specific server, I would like for it to only notify me if it finds the user on a server.
© Super User or respective owner