How to force users to logoff a networked PC

Even on the smallest network, one of the issues every system administrator faces is that of getting a “clean” backup – a backup which doesn’t show errors due to open files being locked and therefore unable to backup properly.

True, backup applications such as Backup Exec have Advanced Open File options that allow you to overcome these issues – but if you’re not using such an application, you’re left in the position of politely reminding your users to logoff each night… again… and again… and again… and again…

The simple fact is, when the clock hits 1730 for “knocking off” – the last thing on a users mind is the fact that if they don’t logoff then the server backup may be affected. More likely they are already in the pub ordering a cold one.

So how do you force users to log-off? There are 3rd Party applications to do this, but they cost money – money that the MD is unlikely to sanction spending (“Remind them again to logoff” is a more likely response).

There are also Group Policy settings that are supposed to force logoff’s for you – but in my experience these simply don’t work reliably.

Step in SysInternals PSShutdown. PSShutdown is a free tool, part of the PS Toolkit, that can be run from a command line to force logoff’s and reboot’s of remote machines.

Download the tool, extract the file psshutdown.exe to a folder on your server, then create a text file containing the names of all the computers you’d like to automatically logoff each night. i.e.

COMPUTER001

COMPUTER002

Save this file as COMPUTERS.TXT in the same folder as PsShutdown.exe

Then, create another text file and fill it with a command line something similar to this:-

PsShutdown.exe -e p:0:0 -r @computers.txt

The above command line simply says, run PsShutdown.exe and set the Shutdown Reason (-e) to Scheduled Maintenance (p:0:0) then reboot (-r) the computers in the file @computers.txt

The full command line switch list for PsShutdown.exe can be found here.

Save this new file as a Batch file called PsShutdown.bat and then use the servers Scheduled Tasks (Start > Programs > Accessories > System Tools > Scheduled Tasks) to run this batch file at a convenient time, say 20:30, when all the users have left for the day.

Each night at 20:30, any users left logged onto the systems will now be “kicked” off and their machines given a clean-boot.

Your Backups should now be squeaky clean and free of any open-file issues!

Reader Interactions

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Send this to a friend