Disable Laptop After Set Date or Time Period

wyhelpofficer
wyhelpofficer used Ask the Experts™
on
Hi

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.

Thanks
Comment
Watch Question

Do more with

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

Commented:
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

Commented:
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.

Author

Commented:
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.

Author

Commented:
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
Commented:
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
Commented:
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">
  <RegistrationInfo>
    <Date>2015-09-17T13:56:41.3374967</Date>
    <Author>localpc\user</Author>
    <Description>1 minute grace period after startup.</Description>
  </RegistrationInfo>
  <Triggers>
    <BootTrigger>
      <Repetition>
        <Interval>PT5M</Interval>
        <StopAtDurationEnd>false</StopAtDurationEnd>
      </Repetition>
      <StartBoundary>2015-10-01T00:00:00</StartBoundary>
      <Enabled>true</Enabled>
      <Delay>PT1M</Delay>
    </BootTrigger>
  </Triggers>
  <Principals>
    <Principal id="Author">
      <UserId>localpc\Administrator</UserId>
      <LogonType>Password</LogonType>
      <RunLevel>HighestAvailable</RunLevel>
    </Principal>
  </Principals>
  <Settings>
    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
    <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
    <AllowHardTerminate>true</AllowHardTerminate>
    <StartWhenAvailable>false</StartWhenAvailable>
    <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
    <IdleSettings>
      <StopOnIdleEnd>true</StopOnIdleEnd>
      <RestartOnIdle>false</RestartOnIdle>
    </IdleSettings>
    <AllowStartOnDemand>true</AllowStartOnDemand>
    <Enabled>true</Enabled>
    <Hidden>false</Hidden>
    <RunOnlyIfIdle>false</RunOnlyIfIdle>
    <WakeToRun>false</WakeToRun>
    <ExecutionTimeLimit>P3D</ExecutionTimeLimit>
    <Priority>7</Priority>
  </Settings>
  <Actions Context="Author">
    <Exec>
      <Command>C:\Windows\System32\shutdown.exe</Command>
      <Arguments>-s -t 00</Arguments>
    </Exec>
  </Actions>
</Task>

Open in new window

Author

Commented:
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