Sign in to follow this  
Followers 0
fardjad

Windows Startup Script

7 posts in this topic

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.

Share this post


Link to post
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!

Share this post


Link to post
Share on other sites

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

thanks for your reply, but I want an automated way to create a scheduled task with autoit.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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!

Share this post


Link to post
Share on other sites

Shutdown()

Try adding Force to the shutdown function.

Change the value to (shutdown + power down + force = 1 + 8 + 4 = 13) Shutdown(13)


AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Well done Posted Image


#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!

Share this post


Link to post
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
Sign in to follow this  
Followers 0