We help IT Professionals succeed at work.

Auto start and shutdown of windows domain workstation

Medium Priority
Last Modified: 2012-05-06
I have a Windows 2000 workstation on a Windows 2000 domain that is designated as the 'Internet Workstation'...

It is requested that we configure this workstation to boot up at 7am and shutdown at 7pm.. It is requested that this workstation be inaccessable durring the other hours of the day..
Watch Question


Auto shutdown is easy.  You can set a scheduled task to run shutdown.exe.  Auto boot can probably be accomplished by using Wake-on-LAN, if your workstation supports it.


How do you make it so the workstation can not be turned on and accessed durring the off hours..?

You mean physically?  There's nothing to prevent someone from pushing the power button unless you lock it up in a box that only exposes K/M and monitor.
If you're having it auto-login, you can set that user's account to only be allowed to log on during those hours, or you could write a script that checks the time when Windows starts up, and shuts down if it isn't in the allowed hours.

Or you could go lower tech and use something like this:
(if you can have the power outlet out of reach)

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
However, who tried to login to it? If this is a shared computer, I imagine it is using 1 account. If this is a domain account, you can go to active directory, go to properties of the user account, and then go to the "Account" tab. Once there, you should see a button called "Logon Hours".

You can actually set this up for any domain user accounts that login to that machine. Examples of WakeOnLan/Shutdown scripts are below.

You can download the command line "WakeOnLan" utility here:

The 1st script below can be put into a batch file and ran as a Scheduled Task from the server. Same thing goes for the 2nd script. Put it in a batch file, and put it into a Schedule Task.

*Replace "MAC-Address" with the mac address of the machine in question.

*Replace \\ComputerName with \\ws123456 <--- example
wolcmd MAC-Address
shutdown.exe /m \\ComputerName /s /f /t 300 /c "This machine will Shut Down in 5 minutes. You can either wait for the machine to restart, or save your work now, then select Shut Down and Restart."

Open in new window



How would one go about writing a script that checks the server time and shuts down the workstation if it is not in the allowable hours?


The above item describes the scheduled shutdown.. how does one schedule the bootup..?

I downloaded the wolcmd.exe but I am unsure how to use it..?
Save this as a .vbs file and put it in startup or as a scheduled task to run at startup. It checks that the day of week is higher than Sunday (1), less than Saturday (7), and the hour is between 7 AM and 7 PM, and shuts down if it fails any of those.

intTime = Hour(Now)
intWeekday = Weekday(Date)
if intWeekday > 1 then
   if intWeekday < 7 then
      if intTime > 7 then
         if intTime < 19 then
         end if
      end if
   end if
end if
strComputer = "."
Set objWMIService = GetObject_
    ("winmgmts:{impersonationLevel=impersonate,(Shutdown)}\\" & _
        strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
    ("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems

Open in new window

Also, for the scheduled boot, most PCs have an option in the BIOS to set a power on time.

And if you wanted it to be a 7 day thing and not Monday to Friday, the If statements would be:

if intTime > 7 then
   if intTime < 19 then
   end if
end if


what is the method to boot the machine at 7 am without using the bios... (e.g. wol) we would like this to be domain controllable as the machine(s) will change
You'll still need to go into the BIOS on the PC and make sure wake on LAN is enabled. Then you will need the MAC address of the network card it uses. For that, open a command prompt on the PC and type "ipconfig /all"
The physical address listed is your MAC address. Write it down without the dashes or colons and shut down the PC
Now get your copy of wolcmd that pzozulka posted and from another PC or server go to a command prompt and enter:

The script below should be put into a batch file (saved as a .bat file), somewhere on a server share. Usually kept on a DC in \\domain.local\netlogon.

Create a Scheduled Task on the server, and call your .bat file.

The command line tool wolcmd is run from a dos prompt. The syntax is as follows:

wolcmd [mac address] [ip address] [subnet mask] [port number]

you can also do a local broadcast if you are running on an internal network thus

wolcmd [macaddress]

where mac address is the unique address of the network card. To find the mac address of a card you can either open the computer and read the address on the sticker on the card or much easier is, if you are using TCP/IP, ping the machine from a dos prompt (ping [machine name or ip number] i.e. ping delphi or ping then issue an arp command (arp -a) which will list the ip number and physical address of the card.

If the port number is not specified it will default to port 7

Please take a look at this link, it explains a lot:
wolcmd 0017a4df6aa6

Open in new window

where can i  set scheduled task to run shutdown.exe
Start, Programs, Accessories, System Tools, Task Scheduler.
Shutdown.exe should be in the Windows\system32 directory.
the vbs script you given can be runned
Ultimately did this..

Set user to have logon hours set on domain server.

Set the machine to auto-login when windows starts.. http://support.microsoft.com/kb/315231

set the BIOS to boot the machine just after the login allowed time...

Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.