Microsoft KB Archive/192784

From BetaArchive Wiki
Knowledge Base


Installing Multiple Applications through Runonce

PSS ID Number: 192784

Article Last Modified on 5/1/2002



The information in this article applies to:

  • Microsoft Windows NT Server 4.0
  • Microsoft Windows NT Workstation 4.0



This article was previously published under Q192784

IMPORTANT: This article contains information about editing the registry. Before you edit the registry, make sure you understand how to restore it if a problem occurs. For information about how to do this, view the "Restoring Registry Key" Help topic in Regedit.exe or the "Restoring a Registry Key" Help topic in Regedt32.exe.

SUMMARY

There are instances where an alternative means is needed to install multiple applications, instead of distributing application installation packages using an integrated systems management package like SMS or sysdiff. The following steps detail how to incorporate multiple Batch.cmd files, AUTOLOGON, ScriptIt and RUNONCE into the unattended installation process to install multiple applications.

For additional information about incorporating RUNONCE with the unattended installation process, please see the following article in the Microsoft Knowledge Base:

158447 How to Run a Program Once After Unattended Setup of WinNT


For additional information about enabling AUTOLOGON for initial logon after you run Windows NT 4.0 Setup, please see the following article in the Microsoft Knowledge Base:

157361 How to Automatically Log On After An Unattended Setup


  1. Create a $OEM$ folder within the I386 network share. Inside of the $OEM$ folder, create a C directory. The contents of the C directory will be copied to the C drive of the target computer. Place the BATCH, UTILS and APPS directories in the C drive. The BATCH directory will contain all batch files, with the exception of batch.cmd as mentioned in step two below. The UTILS directory will include useful utilities (Regini.exe, ScriptIt.exe, Shutdown.exe, Sleep.exe) and the APPS directory contains setup executables or scripts.

    For additional information regarding fusing ScriptIt with RUNONCE during the unattended installation process, please see the following article in the Microsoft Knowledge Base:

    191605 Incorporating ScriptIt with Unattended Installation
  2. Follow 158447 to set up autoadminlogon, and to copy the batch.cmd, cleanup.inf, and other essential files to %systemroot%\system32 of the target computer. Contrary to 158447 , for this process, the batch.cmd file should contain only the following line:

          cmd.exe /c c:\batch\batch1.cmd
  3. In the $OEM$\C\BATCH directory, edit batch1.cmd. This file installs many applications, and will establish the environment for the next reboot. Use cmdlines.txt to only invoke the first instance of AUTOLOGON, to keep rundll32.dll from calling multiple install routines at the same time. In addition, START /WAIT is used to allow the command line in question, to complete processing before it proceeds to the next line in the Batch.cmd file. An example of what batch1.cmd should look like is given in step four, below.
  4. Several Windows NT 4.0 Resource Kit utilities are copied to $OEM$\C\UTILS to be called by the batch files: shutdown.exe, sleep.exe, and regini.exe. The contents of Batch1.cmd are as follows:

       @echo off
       cls
       start /wait c:\apps\newapp.exe
       net use x: \\server\word97
       c:\utils\sleep 6
       start /wait x:\setup.exe
    
       start /wait c:\utils\scriptit c:\utils\newapp.ini
       start /wait %systemroot%\System32\rundll32.exe
          setupapi,InstallHinfSection
          DefaultInstall 132 %Systemroot%\System32\cleanup.inf
       
          NOTE: The line above is one path; it has been wrapped for readability.
    
       start /wait c:\utils\shutdown.exe /l /r /y /t:6
     
                            


    NOTE: The Batch1.cmd file installs Newapp.exe, and maps a drive to a share that stores Word 97. It then sleeps for six seconds while the mapping is completed, and then runs the setup for Word. Next, ScriptIt is called from the C:\UTILS directory, and the Newapp.ini script is invoked. Then Cleanup.inf is run to remove any entries from RUNONCE in the registry, then it reboots the computer, using the shutdown command.

  5. If a reboot needs to occur to continue installing applications through RUNONCE, you can use the following method:

       @echo off
       cls
       start /wait c:\apps\newapp.exe
       net use x: \\server\word97
       c:\utils\sleep 6
       start /wait x:\setup.exe
    
       start /wait c:\utils\scriptit c:\utils\newapp.ini
       start /wait c:\utils\regini c:\batch\runonce.ini
       start /wait c:\utils\regini c:\batch\autolog.ini
       start /wait c:\utils\shutdown.exe /l /r /y /t:6
     
                            
  6. Runonce.ini resets the RUNONCE key in the registry to call c:\batch\batch2.cmd:

    WARNING: Using Registry Editor incorrectly can cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that problems resulting from the incorrect use of Registry Editor can be solved. Use Registry Editor at your own risk.

    For information about how to edit the registry, view the "Changing Keys And Values" Help topic in Registry Editor (Regedit.exe) or the "Add and Delete Information in the Registry" and "Edit Registry Data" Help topics in Regedt32.exe. Note that you should back up the registry before you edit it. If you are running Windows NT, you should also update your Emergency Repair Disk (ERD).
    \Registry\Machine\Software\Microsoft\Windows\CurrentVersion \Run\RUNBATCH = REG_SZ C:\BATCH\BATCH2.CMD

    NOTE: The above registry key is one path; it has been wrapped for readability.
  7. Autolog.ini enables AUTOLOGON after reboot, since AUTOLOGON is disabled by default, after it executes:

       \Registry\Machine
          SOFTWARE
            Microsoft
               Windows NT
                  CurrentVersion
                     Winlogon
                        DefaultUserName = REG_SZ administrator
       \Registry\Machine
          SOFTWARE
             Microsoft
                Windows NT
                   CurrentVersion
                      Winlogon
                         DefaultPassword = REG_SZ
       \Registry\Machine
          SOFTWARE
             Microsoft
                Windows NT
                   CurrentVersion
                      Winlogon
                         AutoAdminLogon = REG_SZ 1
                            
  8. On reboot, AUTOLOGON will execute, and Batch2.cmd will set the environment and call Batch3.cmd. The contents of Batch2.cmd are:

          cmd.exe /c c:\batch\batch3.cmd
  9. Batch3.cmd is essentially Batch1.cmd. You can use this method to install additional applications after a reboot, when RUNONCE runs. Or, you can stop the runonce process by incorporating cleanup.inf. You can continue to string applications with a reboot in between sessions.



Additional query words: sysdiff runonce unattended scriptit deployment

Keywords: kbinfo KB192784
Technology: kbWinNT400search kbWinNTS400 kbWinNTS400search kbWinNTsearch kbWinNTSsearch kbWinNTW400 kbWinNTW400search kbWinNTWsearch