Jump to content

Windows Startup Script


Recommended Posts

Hello,

I want to create a startup script to run on each computer on the network and turn them off at 10:00 AM.

I made this simple script but it is useless since windows waits until the script termination ( and users can't login to their accounts ):

While (true)
    if (@HOUR = 10) then
        if (@MIN = 0) then
            Shutdown(9)
        EndIf
    EndIf
WEnd

It would be ok if you can help me with this problem.

I think one way to solve this problem is to create a scheduled task on each computer with the startup script, but I don't khow how. please help.

thanks in advance.

Link to comment
Share on other sites

Here is a good tutorial on how to create a scheduled task to shutdown a computer at a given time.

#fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja!

Link to comment
Share on other sites

It will be the same path, only instead of creating it manually, you will have the program walk through the steps using ControlSend, etc.

Update: Alternately you can use the command line utility schtasks with ShellExecute, provided it's installed on your version of Windows (2000 or later, I believe)

Edited by Fulano

#fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja!

Link to comment
Share on other sites

Update: Alternately you can use the command line utility schtasks with ShellExecute, provided it's installed on your version of Windows (2000 or later, I believe)

Thank you very much, problem solved.

here is the solution (also attached):

$time = $CmdLine[1]
ShellExecute('schtasks','/create /RU "SYSTEM" /SC ONCE /TR "shutdown -f -s -t 0" /TN "Shutdown" /ST ' & $time ,"","open",@SW_HIDE)
Exit

Usage:

CreateScheduledTask.exe HH:MM:SS

CreateScheduledTask.au3

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
 Share

  • Recently Browsing   0 members

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