Using Terminal Services 'query' in batch file
- by dboarman-FissureStudios
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.