Asked by:
log off other user accounts in Windows via batch script (.bat)

Question
-
All replies
-
Hi,
If possible, please take a screenshot for the error and upload the images in our forum directly so that I can do further analysis based on the error.
The scripts run with users standard privileges, it might need to run as administrator.
For your reference:
https://www.tenforums.com/user-accounts-family-safety/118389-log-off-all-but-current-user.html
Note: This is a third-party link and we do not have any guarantees on this website. And Microsoft does not make any guarantees about the content.
Hope above information can help you.
Please remember to mark the replies as answers if they help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com. -
Script
"query session
logoff 1
pause"Batch file execute :
C:\Users\USER\Desktop>query session
SESSIONNAME USERNAME ID STATE TYPE DEVICE
services 0 Disc
>console USER 1 Active
C:\Users\USER\Desktop>logoff 1C:\Users\USER\Desktop>query session
SESSIONNAME USERNAME ID STATE TYPE DEVICE
services 0 Disc
>console USER 1 Active
C:\Users\USER\Desktop>logoff 1-----------------------------------------
In this way it keeps on repeating instead of logoff 1 (ID)
-
For default Windows/OS scripts,only one place to go.
- Proposed as answer by FarenaMicrosoft contingent staff Friday, July 5, 2019 2:52 AM
-
Hi,
Any update? Please let us know if you need more help.
Please remember to mark the replies as answers if they help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.