New
#1
Logoff users with a script?
Hello,
The issue I have is my co-workers and I share a VM which we remote into, only one person needs access to it at a time. I have been searching for a way that I could set a script to run when I log on which would log off all other users on the system. I have tried to do it with a simple batch file but I couldn't figure out if that was possible with other users or it would only work with the user logged in.
I'm trying to do it by a script not using the task manager to log off users.
Any ideas on how I might be able to accomplish this?
Thank you,
LF4
Batch File to try and log off multiple users:
Code:@echo off rem Genereate a file and store each user name we want to log off in it. set file=templist.txt echo user1 >> %file% echo user2 >> %file% echo user3 >> %file% rem Log off the users found in the file. FOR /f %%i in (./%file%) do ( echo Logging off: %%i rem Shutdown /f /l %%i ) rem Remove the temp file that stored the user names. del %file% pause