Network

AutoIt

Q #1: Is there an easy way to change the Gateway IP (in TCP/IP) for a
      network card using AutoIt?

      ---------------------------------------------------------------------

A #1: If you must automate this, I would suggest using the built in tool
      netsh, or the resource kit tool netset.

      For example try this at the command line:

      netsh interface ip set address name="Local Area Connection" gateway=10.10.123.2

      For AutoIt, try below:  Note that 010010123002 corresponds to
      10.10.123.2

      ; ======= Scriptlet Starts Here =======
      send, ^{ESC}sn
      Winwaitactive, Network and Dial-up Connnections
      send, l{ENTER}
      Winwaitactive, Local Area Connection Status
      Sleep, 250
      Send, !p
      Winwaitactive, Local Area Connection Properties
      Sleep, 500
      Send, i!r
      Winwaitactive, Internet Protocol (TCP/IP) Properties
      Sleep, 250
      Send, !s!d010010123002{ENTER}
      Winwaitactive, Local Area Connection Properties
      Sleep, 250
      Send, !w!w{TAB}{ENTER}
      Winactivate, Local Area Connection Status
      Winwaitactive, Local Area Connection Status
      Send, !c
      Winactivate, Network and Dial-up Connnections
      Winwaitactive, Network and Dial-up Connnections
      Send, !fc
      ; ======= Scriptlet Ends Here =======

-----------------------------------------------------------------------------

Q #2: How do I run an AutoIt script at or before the logon screen in
      Windows NT?

      ---------------------------------------------------------------------

A #1: Using the RunServices key in the registry will allow you to have an
      AutoIt program run before login.

      Microsoft has a Knowledge Base article on the various Run keys in the
      registry, and what order they are executed in the startup process:

      http://support.microsoft.com/support/kb/articles/Q179/3/65.ASP


      Here is some of it:

      Under Windows 9x, where all keys are supported, the keys  are loaded
      in the following order:                                        

      HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\

            RunServicesOnce                                                              

      HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServices                                                                  

      <Logon Prompt>                                                       

      HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce 

      HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run     

      HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run      

      StartUp Folder                                                       

      HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce  

      With the exception of the HKEY_LOCAL_MACHINE\...\RunOnce key, all
      keys and their entries are loaded asynchronously. Therefore, all
      entries in the RunServices and RunServicesOnce keys can potentially
      run at the same time.

      Entries in the HKEY_LOCAL_MACHINE\...\RunOnce key are loaded
      synchronously in an undefined order.                                                    

      Because the HKEY_LOCAL_MACHINE\...\RunOnce key is loaded
      synchronously,    all of its entries must finish loading before the
      HKEY_LOCAL_MACHINE\...\Run, HKEY_CURRENT_USER\...\Run,
      HKEY_CURRENT_USER\...\RunOnce, and Startup Folder entries can be
      loaded.                                     

      The RunServicesOnce and RunServices keys are loaded before the user
      logs into Windows 95. Because these two keys run asynchronously with
      the Logon dialog box, they can continue to run after the user has
      logged on.  However, since HKEY_LOCAL_MACHINE\...\RunOnce must load
      synchronously, its entries will not begin loading until after the
      RunServicesOnce and RunServices keys have finished loading.                                   

      Because of different system configurations (such as a computer that
      is configured to automatically log on), any application that is
      dependant upon other applications that are executed under these keys
      having completed must be prepared to wait until these applications
      are complete.  Other than this exception, the above description
      applies to Windows NT 4.0 and Windows 2000.                                                         

      One thing to remember about NT/2K.  Even if you have an autoit script
      running, it cannot do the CTRL+ALT+DEL needed to get to the logon
      dialog.

      another point

      If you want to run something in the HKEY_LOCAL_MACHINE...RunOnce to
      run asynchronously you can use the command:

      %COMSPEC% /C START <path\file.exe>

      This works because the RunOnce executes the %COMSPEC% command
      synchronously with the other RunOnce commands, but the START creates
      a new process that is not bound by the RunOnce constraints.

-----------------------------------------------------------------------------

Q #3. Can I use AutoIt to login a user on Windows NT or 2000

      ---------------------------------------------------------------------

A #1: No.  AutoIt cannot send the CTRL+ALT+DEL key sequence required to
      bring up the logon dialog box in NT/2000.  This is not a limitation
      of AutoIt.

      However, in Windows 2000 you can set the machines to not require
      CTRL-ALT-DEL. Go to "Users and Passwords" and disable it. But this
      'auto-logon' feature will not work if a third pary utility is
      installed (for instance Novell's Novell Client), which takes login
      precendence over Microsoft's) and thus the DefaultDomain,
      DefaultLogin, DefaultPassword entries in the Registry won't work.

      From the AutoIt documentation:

      "Windows does not allow the simulation of the "CTRL-ALT-DEL"
      combination!"