How to force users to logoff

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!

Advertisements

2 Responses to “How to force users to logoff”


  1. 1 David August 8, 2008 at 12:57 pm

    Have you considered the -t 600 and -c switch for folk who work back they can cancel the shutdown and they ten minutes should be enough time to come back from making coffee or the loo

  2. 2 Richard August 8, 2008 at 5:27 pm

    Great tip David – thanks for your comment.


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




Archives

Tubblog on Twitter

LinkedIn

Enter your email address to subscribe to Tubblog and receive notifications of new posts by email.

Join 48 other followers

Microsoft Small Business Specialist Logo
Computer Weekly Blog Awards 2010 Logo
MSP Mentor 250 Logo
SMB 150 List Logo
International Association of Microsoft Channel Partners Logo
MyFreeCopyright.com Registered & Protected

%d bloggers like this: