Sign in to follow this  
Followers 0
Theo

Reboot and continue script

8 posts in this topic

If this has been covered already could someone please refer me to the thread?

I am running a bunch of post build scripts that I want to consolidate using auto-it. Is there a way for me to reboot and then continue my auto-it script?

For instance

install sp1

<reboot>

install environment customizations

<reboot>

install applications

<reboot>

patch apps

<reboot>

Thanks for your help. -Theo


Systems AdministratorSiemens: Windows Server SupportFly Fisher, Table Tennis Junkie, and Struggling Coder

Share this post


Link to post
Share on other sites



install sp1

write to the 'run' key in the registry to start your script using an argument (like '1')

<reboot>

script starts with argument '1'

if $cmdline[1] = 1 then start my script here

install environment customizations

etc

etc

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Make two different scripts. One that will do all the things before reboot, which will then copy your script into Startup folder (so it will start at startup) then the second script will do everything then make it delete itself from startup.

Secure

Edit: xcal got there first, but my way might be easier.

Edited by Secure_ICT

Share this post


Link to post
Share on other sites

If this has been covered already could someone please refer me to the thread?

I am running a bunch of post build scripts that I want to consolidate using auto-it. Is there a way for me to reboot and then continue my auto-it script?

For instance

install sp1

<reboot>

install environment customizations

<reboot>

install applications

<reboot>

patch apps

<reboot>

Thanks for your help. -Theo

a few ways to do it. the easiest would probably be a select case structure, with a control file. say you've got a file control.txt that just has a 1 in it.

your select case reads the file, sees the one, then the select case checks first case, runs first set, changes the 1 to a 2, then reboots. the file can be run at startup via registry entry, startup group, autoexec, as a service, etc. and when it reads a 2 on next start, it runs the second step, then increments and repeats.


1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

you could do it with registry stuff too:

<copy to startup folder>

<Write a reg "1">

If <reg>=1 Then

<install sp1>

<Set Reg to 2>

<reboot>

EndIf

If <reg>=2 Then

<install environment customizations>

<reboot>

<Set Reg to 3>

Endif

If <reg> = 3 Then

<install applications>

<Set Reg to 4>

<reboot>

EndIf

If <reg>=4 Then

<patch apps>

<Set Reg to 5>

<reboot>

EndIf

If <reg>=5 then

<Delete self or EXIT or delete from startup>

EndIf

I'll get an example if I can but uh...

grr cameraonsdad u beat me again XD

Edit: Kwah, 4 people beat me XD

Edited by MethodZero

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites

Thanks all, that is kinda what I was thinking but I didn't know if there was built in functionality that might do this for me. Setting the reg value and incrementing it should work fine. -Theo


Systems AdministratorSiemens: Windows Server SupportFly Fisher, Table Tennis Junkie, and Struggling Coder

Share this post


Link to post
Share on other sites

Thanks all, that is kinda what I was thinking but I didn't know if there was built in functionality that might do this for me. Setting the reg value and incrementing it should work fine. -Theo

And....man you guys are fast! That was like 5 response in less than an hour!!! Good forum!


Systems AdministratorSiemens: Windows Server SupportFly Fisher, Table Tennis Junkie, and Struggling Coder

Share this post


Link to post
Share on other sites

I have posted this a couple of time before but this is a model you can use to do installs that requier reboots between installs:

; pgm name DEMO.AU3
$Userid = "Administrator"
$Psw = "adminpsw"
; Remove autologin params from registry to clean up
SetAutoLogon("Off", "")
;
; retrieve param
$param1 = ""
If $CmdLine[0] > 0 Then
    $param1 = $CmdLine[1]
EndIf
; Act on it
Select
    Case $param1 = ""
        ; run your programs with admin account if needed in the first step
        RunAsSet($Userid, @ComputerName, $Psw)
        ;
        ; *** put your stuff here for step1 ***
        RunWait("notepad.exe step1.txt")
        ;
        SetAutoLogon("On", "step1")
        Shutdown(6)
    Case $param1 = "step1"
        ; is already logged on with admin account
        ;
        ; *** put your stuff here for step2 ***
        RunWait("notepad.exe step2.txt")
        ;
        SetAutoLogon("On", "step2")
        Shutdown(6)
    Case $param1 = "step2"
        ; logoff the admin account
        ; *** put your stuff here for step3 ***
        RunWait("notepad.exe step3.txt")
        ; just logoff
        Shutdown(0)
        Exit
EndSelect
Exit
;
;
Func SetAutoLogon($sw, $step)
    Local $s1, $s2, $s3, $s4
    If $sw = "On" Then
        ; set the registry to start this program again after reboot
        ; Read  current settings
        $s1 = RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "AutoAdminLogon")
        $s2 = RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "DefaultDomainName")
        $s3 = RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "DefaultUserName")
        $s4 = RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "DefaultPassword")
        ;Save current settings
        RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "S_AutoAdminLogon", "REG_SZ", $s1)
        RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "S_DefaultDomainName", "REG_SZ", $s2)
        RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "S_DefaultUserName", "REG_SZ", $s3)
        RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "S_DefaultPassword", "REG_SZ", $s4)
        ;Set New Settings
        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RUN", "AutoItInstaller", "REG_SZ", @ScriptFullPath & " " & $step)
        RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "AutoAdminLogon", "REG_SZ", "1")
        RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "DefaultDomainName", "REG_SZ", EnvGet("LOGONSERVER"))
        RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "DefaultUserName", "REG_SZ", $Userid)
        RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "DefaultPassword", "REG_SZ", $Psw)
    EndIf
    ;
    If $sw = "Off" Then
        ; Read  previous settings and reset 
        $s1 = RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "S_AutoAdminLogon")
        If Not @error Then 
            RegDelete("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "S_AutoAdminLogon")
            RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "AutoAdminLogon", "REG_SZ", $s1)
        EndIf
        $s2 = RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "S_DefaultDomainName")
        If Not @error Then 
            RegDelete("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "S_DefaultDomainName")
            RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "DefaultDomainName", "REG_SZ",$s2)
        EndIf
        $s3 = RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "S_DefaultUserName")
        If Not @error Then 
            RegDelete("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "S_DefaultUserName")
            RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "DefaultUserName", "REG_SZ", $s3)
        EndIf
        $s4 = RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "S_DefaultPassword")
        If Not @error Then 
            RegDelete("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "S_DefaultPassword")
            RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "DefaultPassword", "REG_SZ", $s4)
        EndIf
        ; Remove/Reset the registrykey to start this program again after reboot
        RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RUN", "AutoItInstaller")
    EndIf
EndFunc   ;==>SetAutoLogon

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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