fardjad Posted March 15, 2010 Share Posted March 15, 2010 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 More sharing options...
Fulano Posted March 15, 2010 Share Posted March 15, 2010 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 More sharing options...
fardjad Posted March 15, 2010 Author Share Posted March 15, 2010 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. Link to comment Share on other sites More sharing options...
Fulano Posted March 15, 2010 Share Posted March 15, 2010 (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 March 15, 2010 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 More sharing options...
Danny35d Posted March 15, 2010 Share Posted March 15, 2010 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 Link to comment Share on other sites More sharing options...
fardjad Posted March 15, 2010 Author Share Posted March 15, 2010 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:SSCreateScheduledTask.au3 Link to comment Share on other sites More sharing options...
Fulano Posted March 15, 2010 Share Posted March 15, 2010 Well done #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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now