Disable Laptop After Set Date or Time Period

wyhelpofficer used Ask the Experts™

I'm trying to manage a pool of Windows 7 loan laptops that are intended for our users to borrow short term. We are having a hard time persuading people to bring them back, which means we never have any available when people need them.

So, I would like to try and find a way to loan out a machine for say 30 days, and somehow disable the computer after that amount of time.

Users do log in using their AD credentials so I don't want to disable their accounts because they will still need to log in to their desktop PCs at the office.

I can't see any built-in way of doing this, is anybody aware of any third party software that could do this for us? One thing I did think of is to write a script that runs on startup, checks the date and runs a shutdown command if a certain date is exceeded - would this potentially work and if so could anyone help with the script???

Of course any other ideas would be appreciated.

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Muhammad MullaSystems Administrator

set a scheduled task to run shutdown.exe -f -t 00 with the trigger set to the date that is after 30 days and repeat the task every 5 minutes. Set it to run as a particular user, whether or not the user is logged in.

This will, however, require some admin to change the start date of the trigger.
Scott CSenior Engineer

What version of Windows Server are you running?  

If it's 2012 you can use the Disable-ADAccount -identity <machine name> command.

Unfortunately this command is not available in Server 2008.


Scheduled task is an idea. But how would I set the trigger to the date.. the only options I see are to either trigger on a schedule, choose "one time" and then set the date. Or, trigger at startup and set the activation date accordingly.

The settings for both of these options suggest that the task would only run on the specified date, unless I have misunderstood that. Would either of these options cause the task to run even after the user restarted and logged in again the day after?
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.


ScottCha - I believe the DCs are 2012. Would this method work if the users are logging into the laptops off site using cached credentials?
Scott CSenior Engineer
Now that I think about it that way, probably not.  Unless they are on the network, the loaner wouldn't know that the account was disabled.

I'd give them a grace period of a couple of days and disable their network account.  

Have them sign an agreement saying they will bring the laptop back within 30 days with the understanding that their account will be disable if they don't bring it back on time or make arrangements if they are not able to bring it back.

I've found that if there is a signed agreement users tend to think about it a bit differently.
Systems Administrator
As far as scheduled tasks go, the date should be a start date.

You could import the following code as an xml file into task scheduler, and edit as per your needs.

This runs the shutdown.exe -s -t 00 1 minute after system startup (to give you a chance to login and stop it, when you need to) starting midnight on 01/10/2015 .

<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
    <Description>1 minute grace period after startup.</Description>
    <Principal id="Author">
  <Actions Context="Author">
      <Arguments>-s -t 00</Arguments>

Open in new window


Thanks, well this gives me a couple of options. I'll test out the task and see how well that works, and if that doesn't work I'll have to think about disabling accounts.

Thanks again.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial