blinkdt Posted December 4, 2005 Share Posted December 4, 2005 @Tomcat76 I understand the frustration with AVG, but I believe they made the right call in identifying compiled scripts as a potential danger. And after reading the thoughts of others who use AutoIt, in this case, there really was no downside to running the script in raw form: you edit the final product directly (no need to compile) and uses less space. It took a little time to revamp my routines, but once I was finished it was all good. @MHz Wow, you are the master. I would love to adapt the countdown feature for a simple SplashText box, but I suspect such an option is a no-go with AutoIt(?). Link to comment Share on other sites More sharing options...
gunsmokingman Posted December 4, 2005 Share Posted December 4, 2005 (edited) Here is a HTA that uses a VBS script to reboot the computer.Save As ReBoot.HtaNotes This needs to made activeInactive 'Set WMISrv = GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}\\" & strComputer & "\root\cimv2") 'Set ObjOS = WMISrv.ExecQuery("Select * from Win32_OperatingSystem") ' For Each StrOS in ObjOS ' StrOS.Win32Shutdown(Reboot + 4) 'Next To Make Active Copy And Paste This Into The Red Spot In The Script Or Remove The Quotes In Front Of The Red text ' Set WMISrv = GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}\\" & strComputer & "\root\cimv2") Set ObjOS = WMISrv.ExecQuery("Select * from Win32_OperatingSystem") For Each StrOS in ObjOS StrOS.Win32Shutdown(Reboot + 4) Next This Is Set To A 60 Second Delay Before It Runs The ReBoot ScriptINTA = 60Change This To Suit Your NeedsThis Color Text Is Safe To Remove From The HTA As It Only A Message Box Place Holder For The ScriptThis Color Is The Icon I Use For The HTA and Might Alert YourFirewall And Or Anti-Virus<TITLE> Gunsmokingman Reboot Hta</TITLE> <HTA:APPLICATION ID="GsmReBoot" APPLICATIONNAME="GsmReBootHta" SYSMENU="yes" MaximizeButton="No" MinimizeButton="No" SCROLL="No" SCROLLFLAT ="No" Icon="http://www3.telus.net/GSMJAK1E/AUABuilder/BgImgs/Hta2.ico"><head> <!-- ;;;;; RESIZES THE WINDOW ;;;;; --> <script language="vbscript"> window.resizeTo 500,275 window.moveTo 550, 375 Const LogOff = 0, Shutdown = 1, Reboot = 2,PowerOff = 8 Dim INTA,WMISrv, StrOS, ObjOS '''' VARIBLES FOR THE REBOOT FUNCTION Dim Act : Set Act = CreateObject("Wscript.shell") Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject") Dim Sd : Sd = Act.ExpandEnvironmentStrings("%systemdrive%") Dim UName : UName = Act.ExpandEnvironmentStrings("%UserName%") </script> <!-- ;;;;; MAIN BODY AND BACK GROUND ;;;;; --> <Table><body SCROLL="No" Title="This Is The Main Body Pop Up Text" STYLE= "9.75pt Palatino Linotype; color:#006c6c; filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0, StartColorStr='#e8e4de', EndColorStr='#c7c3be')"> </Table><Center><BR><span id=DataArea0></Span> <BR><span id=DataArea1></Span> <script language="vbscript"> On_Load Function On_Load Dim Ts : Set Ts = Fso.OpenTextFile(SD & "\Rest1.vbs", 2, true) Ts.WriteLine "Wscript.sleep 1000" Ts.close Set Ts = Fso.OpenTextFile(SD & "\CleanIt.vbs", 2, true) Ts.WriteLine " Dim Act : Set Act = CreateObject(""Wscript.shell"")" Ts.WriteLine " Dim Fso : Set Fso = CreateObject(""Scripting.FileSystemObject"")" Ts.WriteLine " If Fso.FileExists(""Reboot.hta"") Then" Ts.WriteLine " Fso.DeleteFile(""Reboot.hta"")" Ts.WriteLine " Fso.DeleteFile(""CleanIt.vbs"")" Ts.WriteLine " End If" Ts.close RunTheTest End Function Function Reboot window.alert "Temp Script Place Holder" & vbcrlf & Uname & ", This Is Safe To Remove From The HTA" &_ vbcrlf & "This Is When The Reboot Script Will Run" '''' ----> VARIBLES TO USE FOR OTHER FUNCTION OF THIS WMI CLASS '''' ForcedLogOff = LogOff + 4,ForcedShutdown = Shutdown + 4, ForcedReboot = Reboot + 4,ForcedPowerOff = PowerOff + 4 '''' UNCOMMENT THE FIVE BELOW LINES TO MAKE ACTIVE 'Set WMISrv = GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}\\" & strComputer & "\root\cimv2") 'Set ObjOS = WMISrv.ExecQuery("Select * from Win32_OperatingSystem") ' For Each StrOS in ObjOS ' StrOS.Win32Shutdown(Reboot + 4) 'Next '''' UNCOMMENT THE FIVE ABOVE LINES TO MAKE ACTIVE Exit Function End Function Function Rst1 '''' <!-- ;;;;; SCRIPT THIS IS THE AMOUNT OF TIME IT STOPS 1000 = 1 SECOND ;;;;; --> Act.run(SD & "\Rest1.vbs"), 1 , True End Function Function RunTheTest '''' <!-- ;;;;; SCRIPT COUNT DOWN ;;;;; --> Dim INTA INTA = 60 DataArea0.InnerHTML = Uname & ", Preparing To Reboot The Local Computer" Do INTA = INTA - 1 DataArea1.InnerHTML = "This Will Reboot In = " & INTA Rst1 Loop Until INTA = 0 DataArea1.InnerHTML = "Preparing to Reboot The Local Machine" Rst1 Rst1 Reboot DataArea1.InnerHTML = "" Fso.DeleteFile(SD & "\Rest1.vbs") If Fso.FileExists(SD & "\CleanIt.vbs") Then Act.Run(SD & "\CleanIt.vbs") end if Window.close exit Function End Function </script> Edited December 4, 2005 by gunsmokingman Link to comment Share on other sites More sharing options...
MHz Posted December 4, 2005 Share Posted December 4, 2005 @MHz Wow, you are the master. I would love to adapt the countdown feature for a simple SplashText box, but I suspect such an option is a no-go with AutoIt(?).SplashText box can accept variables so you can have a similar effect.Demo:For $i = 30 To 1 Step -1 SplashTextOn("", "" & @CRLF & "Restarting the machine in " & $i & " seconds" & @CRLF & "", 300, 58, -1, -1, 1, "Arial", 12, 12) Sleep(1000)NextSplashOff() Link to comment Share on other sites More sharing options...
blinkdt Posted December 5, 2005 Share Posted December 5, 2005 Beautiful, MHz. Thank you. Link to comment Share on other sites More sharing options...
Yzöwl Posted December 5, 2005 Share Posted December 5, 2005 just add something like this single line to your usual batch fileping -n 31 127.0.0.1>nul&wmic OS WHERE Primary="TRUE" CALL Win32Shutdown 6Where 31 is 30 seconds delay (16 would be 15 seconds delay), and the 6 at the end is 2 (reboot) + 4 (force) Link to comment Share on other sites More sharing options...
Wesmosis Posted December 15, 2005 Author Share Posted December 15, 2005 thanx guyz for enriching the topic, alot of new ideas came over @Mathewkfew pals don't know a **** thing about Windows Installtion Link to comment Share on other sites More sharing options...
GALAracunala Posted December 18, 2005 Share Posted December 18, 2005 Caution!If u use driver packs, it may be leftovers on the disk if you force restart for 00 seconds.I mean, clean up may not finish, that was my case.Just leave the message, like me: shutdown -r -f -t 60 -c "Restarting to complete installation"plz guyzis there any way to hide the restart window with countdown to 0?some friends of mine, called and told me that my uAXPSP2 CD has got a balster worm! of course they are newbies and kinda (Idiots!) then how come a blsater restart your somputer only once and then the windows start normally however, any help in this?this is my reboot.cmd:cmdow @ /HIDshutdown.exe -r -f -t 60 -c "Windows XP will now restart in 60 Seconds..."net user aspnet /deleteEXIT 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