Recipe 2.14. Configuring System Startup OptionsProblemYou want to configure the system startup options for a server. SolutionUsing a graphical user interface
Using a command-line interfaceWindows Server 2003 includes a new tool called bootcfg.exe (also available with Windows XP) that lets you examine and modify the system startup options (including boot.ini) from the command line. To get a list of the current startup options, run bootcfg without any parameters: > bootcfg The following command changes the timeout setting for the default OS option to 15 seconds: > bootcfg /timeout 15 The following command adds the /DEBUG and /SOS options to the OS option defined by ID 2 (which you can see by running bootcfg without any options): > bootcfg /Raw "/DEBUG /SOS" /A /ID 2 For the complete list of bootcfg options, run bootcfg /? from the command line. Using VBScript' This code displays the system startup settings. ' ------ SCRIPT CONFIGURATION ------ strComputer = "." ' e.g., rallen-srv01 ' ------ END CONFIGURATION --------- set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") set colCompSys = objWMI.InstancesOf("Win32_ComputerSystem") for Each objCompSys in colCompSys WScript.Echo "Startup Delay: " & objCompSys.SystemStartupDelay for each strOption in objCompSys.SystemStartupOptions WScript.Echo "Operating System: " & strOption next next ' This code sets the startup delay to 10 seconds. ' ------ SCRIPT CONFIGURATION ------ strComputer = "." ' e.g., rallen-srv01 ' ------ END CONFIGURATION --------- set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") set colCompSys = objWMI.InstancesOf("Win32_ComputerSystem") for Each objCompSys in colCompSys WScript.Echo "Startup Delay Before: " & objCompSys.SystemStartupDelay objCompSys.SystemStartupDelay = 10 objCompSys.Put_ WScript.Echo "Startup Delay After: " & objCompSys.SystemStartupDelay next DiscussionFor a list of options that are supported in boot.ini, see MS KB 833721. Using a graphical user interfaceThe Edit button is available only on Windows Server 2003. If you want to modify the boot.ini file on Windows 2000, you'll have to use the procedures described next in the command-line solution. Using a command-line interfaceSince Windows 2000 doesn't come with the bootcfg utility, you have to modify the boot.ini file directly. First, make the file editable: > attrib %SystemDrive%\boot.ini -h -r -s Then edit the file: > edit %SystemDrive%\boot.ini And finally, make the file read-only and hidden again: > attrib %SystemDrive%\boot.ini +h +r +s Using VBScriptNone of the scripting interfaces support modifying the boot.ini file (aside from direct file manipulation). See AlsoMS KB 99743 (Purpose of the BOOT.INI File in Windows 2000 or Windows NT), MS KB 102873 (BOOT.INI and ARC Path Naming Conventions and Usage), MS KB 242443 (Boot Menu Is Not Displayed and Timeout Value Is Not Used), MS KB 291980 (A Discussion About the Bootcfg Command and Its Uses), and MS KB 316739 (How to Use the /USERVA Switch in the Boot.ini File to Tune /3GB Configurations) |