terminal services - need to kick users off

Well it has been awhile since working with terminal services. I have setup a client to backup the system database each night. All the terminal service users need to be logged out. This is what I came up with but it is not working correctly.

query session >session.txt
for /f "skip=2 tokens=3," %%i in (session.txt) DO logoff %%i
del session.txt

I made this a batch file scheduled to run every evening. Am I crazy?

 

 

 

 

Top