Jump to content

Shutdown scripts


Recommended Posts

Hi guys,

Sorry if this has been asked before (I have looked ). Can anyone give me any advice/ guidence on the following problem I have.

The situation is I work for the IT dept of a school, probably about 600 pc`s maybe more. currently I have thenm all set to autopower on at 8:00AM

but there are an awfull lot of them that just get left on all night.

What I am looking for is a script or something that will run at a specific time and shut the pc`s down. The only issue I can possibly see is that all the students have there own logon on the domain. so the pc`s are usually locked when a student is not using them so the script would need to run in the background I guess.

Any help or advice would be great

Thanks in advance :thumbup

Link to comment
Share on other sites


A scheduled task would be what you would want. The question that remains is how, and to that end you would need to identify the main OS in question. Very easy if it's XP (and probably Vista) - look into the shutdown command.

You could try something like:

C:\> at 18:00 /interactive /every:M,T,W,Th,F,S,Su c:\windows\shutdown.exe -i -l 600 
-m “It is way past the time you should be at home. Come back tomorrow.”

Documentation:

AT

SchTasks - more proper for XP perhaps

Shutdown

Link to comment
Share on other sites

  • 3 weeks later...

Don't know if all OS's have shutdown.exe so you can google and download it as the previous thread says. I believe the one I have used is a stand-alone executable that shuts down the PC and can be called through a script. Or a batch file called from a scheduled task, etc., whichever you like.

Link to comment
Share on other sites

Here is a vbs script that you might be able to use. Since it using WMI you can run it

against remote machines.

 Const LogOff = 0,  Shutdown = 1, Reboot = 2,PowerOff = 8
Dim ObjOS, strComputer, StrOS, Wmi
strComputer = "."
Set Wmi = GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}!\\" & _
strComputer & "\root\cimv2")
Set ObjOS = Wmi.ExecQuery("Select * from Win32_OperatingSystem")
For Each StrOS in ObjOS
'-> 4 Means Force The System
StrOS.Shutdown(Shutdown + 4)
Next

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...