Repair, Recovery, and Restore |
The Recovery Console is a text-mode command interpreter that is separate from the Windows 2000 command prompt and allows the system administrator to gain access to the hard disk of a computer running Windows 2000, regardless of the file format used, for basic troubleshooting and system maintenance. Since starting Windows 2000 is not a prerequisite for using the Recovery Console, it can help you recover when your Windows 2000–based computer does not start properly or at all. The Recovery Console allows you to obtain limited access to NTFS, file allocation table (FAT), (FAT16 and FAT32) volumes without starting the graphical interface. The Recovery Console allows administrators and Microsoft Product Support Services technicians to start and stop services, and repair the system in a very granular way. It can also be used to repair the master boot record (MBR) and boot sector and to format volumes. The Recovery Console prevents unauthorized access to volumes by requiring the user to enter the system administrator password.
Note
If you are using software mirroring or if you are running the Recovery Console using a Remote Install Server, see the Microsoft Knowledge Base link on the Web Resources page at http://windows.microsoft.com/windows2000/reskit/webresources.
To start the Recovery Console, start the computer from the Windows 2000 Setup CD or the Windows 2000 Setup floppy disks. If you do not have Setup floppy disks and your computer cannot start from the Windows 2000 Setup CD, use another Windows 2000–based computer to create the Setup floppy disks. For more information about creating the Windows 2000 Setup floppy disks, see "Planning a Reliable Configuration" in this book or Windows 2000 Server Help.
If the Recovery Console was installed on the local hard disk, it can also be accessed from the Windows 2000 startup menu. However, if the MBR or the system volume boot sector has been damaged, you need to start the computer using either the Windows 2000 Setup floppy disks or the Windows 2000 Setup CD to access the Recovery Console.
To add the Recovery Console to existing installations of Windows 2000, on the Start menu, click Run, and then type:
F:\I386\Winnt32.exe /cmdcons
where F is the CD-ROM drive letter.
This installation requires approximately 7 megabytes (MB) of disk space on your system partition.
Important
You cannot preinstall the Recovery Console on a computer that contains a mirrored volume. First break the mirror, then install the Recovery Console. After the Recovery Console is installed, you can re-establish the mirrored volume. For more information, see the Microsoft Knowledge Base link on the Web Resources page at http://windows.microsoft.com/windows2000/reskit/webresources.
Start the computer and enter Windows 2000 Setup. Press ENTER at the "Setup Notification" screen. Press R to repair a Windows 2000 installation, and then press C to use the Recovery Console.
When the Recovery Console is started, the following information is displayed:
Microsoft Windows 2000(TM) Recovery Console.
The Recovery Console provides system repair and recovery functionality.
Type EXIT to quit the Recovery Console and restart the computer.
1: C:\WINNT
Which Windows 2000 installation would you like to log onto
(To cancel, press ENTER)?
Important
If there is more than one installation of Windows 2000 or Microsoft® Windows NT® 4.0 or earlier, they are also shown in the Recovery Console startup menu.
Mirrored volumes appear twice in the Recovery Console startup menu, but each entry has the same drive letter so they are actually the same drive.
Changes made in the Recovery Console to mirrored volumes are mirrored.
To access the disk by using the Recovery Console, press the number key representing the Windows 2000 installation that you want to repair, and then press ENTER. The Recovery Console then prompts you for the administrator password. If you press ENTER without typing a number, the Recovery Console exits and restarts the computer.
Note
To use the Recovery Console, you must know the password for the local Administrator account. If you do not have the correct password, Recovery Console does not allow access to the computer. If an incorrect password is entered three times, the Recovery Console quits and restarts the computer. However, you can use either the Group Policy snap-in or the Security Configuration and Analysis snap-in to specify automatic administrative logon.
Once the password has been validated, you have full access to the Recovery Console, but limited access to the hard disk. You can only access the following folders on your computer:
Note
With the set command enabled, you can copy files to removable media and access all paths on the system. The set command is an optional Recovery Console command that can be enabled by either the Group Policy snap-in or the Security Configuration and Analysis snap-in. For more information about the set command, see "Supported Commands" later in this chapter.
The Recovery Console prevents access to other folders such as Program Files or Documents and Settings, as well as to folders containing other installations of Windows 2000. However, you can use the logon command to access an alternate installation. Alternatively, you can gain access to other installation folders by restarting the Recovery Console, choosing the number representing that installation, and then entering the administrator password for that installation.
You cannot copy a file from the local hard disk to a floppy disk, but you can copy a file from a floppy disk or a CD-ROM to any hard disk, and from a hard disk to another hard disk. However, with the set command enabled, you can copy files to a floppy disk. The Recovery Console displays an "Access is denied" error message when it detects invalid commands.
Important
The set command makes use of Recovery Console environment variables to enable, among other options, disk write access to floppy disks. To enable the user to modify the restricted default Recovery Console environment variables, a policy setting must be made. For more information about enabling the set command in Recovery Console, see the procedure later in this section.
The Recovery Console buffers previously entered commands and makes them available to the user with the up and down arrow keys. To edit a previously entered command, use backspace to move the cursor to the point of the edit and retype the remainder of the command. At any point, you can quit the Recovery Console and restart the computer by typing exit at the command prompt.
Important
The Recovery Console might not map disk volumes with the same drive letters that they have in Windows 2000. If you are having trouble copying files from one location to another, use the map command from the Recovery Console to make sure that the drive mappings for both the source and the target locations are correct.
Several of the Recovery Console commands are not fully functional to users who have converted to dynamic disks. For more information about dynamic disks, see the chapter "Disk Concepts and Troubleshooting" in this book.
Table 13.1 lists the commands that are supported by the Recovery Console. You can use the help command to list the commands supported by the Recovery Console.
Note
The switch /? works with every Recovery Console command to display a help screen offering a description of the command, its syntax, definitions of its parameters, and other useful information.
Table 13.1 Available Recovery Console Commands
Command | Explanation |
---|---|
attrib | Changes attributes on one file or directory.
ATTRIB -R | +R | -S | +S | -H | +H | -C | +C filename + Sets an attribute. - Clears an attribute. R Read-only file attribute. S System file attribute. H Hidden file attribute. C Compressed file attribute. More than one attribute can be set or cleared at a time. To view attributes, use the dir command. |
batch | Executes commands specified in a text file.
BATCH Inputfile [Outputfile] Inputfile Specifies the text file that contains the Outputfile If specified, contains the output of the Batch cannot be one of the commands included in the Inputfile. |
cd/chdir | Displays the name of the current directory, or switches to a new directory.
CHDIR [path] CHDIR [..] CHDIR [drive:] CD [path] CD [..] CD [drive:] CD .. Specifies that you want to change to the Type CD [drive:] to display the current directory in the specified drive. Type CD without parameters to display the current drive and directory. The chdir command treats spaces as delimiters. Use quotation marks around a directory name containing spaces. For Example: cd "\winnt\profiles\username\programs\start menu" Chdir operates only within the system directories of the current Windows installation, removable media, the root directory of any hard disk partition, or the local installation sources. |
chkdsk | Checks a disk and displays a status report,
chkdsk [drive:] [/p] | [/r] [drive:] Specifies the drive to check. /p Check even if the drive is not flagged dirty. /r Locates bad sectors and recovers readable Chkdsk may be used without any parameters, in which case the current drive is checked with no switches. You can specify the listed switches. Chkdsk requires the Autochk.exe file. Chkdsk automatically locates Autochk.exe in the startup (boot) directory. If it cannot be found in the startup directory, chkdsk attempts to locate the Windows 2000 Setup CD. If the installation CD cannot be found, chkdsk prompts for the location of Autochk.exe. |
cls | Clears the screen. |
copy | Copies a single file to another location.
copy source [destination] source Specifies the file to be copied. Destination Specifies the directory and/or file name The source might be removable media, any directory within the system directories of the current Windows installation, the root of any drive, the local installation sources, or the cmdcons directory. The destination might be any directory within the system directories of the current Windows installation, the root of any drive, the local installation sources, or the cdirectory. The destination cannot be removable media. If a destination is not specified, it defaults to the current directory. Copy does not support replaceable parameters (wild cards). Copy prompts if the destination file already exists. A compressed file from the Windows 2000 Setup CD is automatically decompressed as it is copied. |
del/delete | Deletes one file.
del [drive:][path]filename delete [drive:][path]filename [drive:][path]filenameSpecifies the file to delete. Delete only operates within the system directories of the current Windows installation, removable media, the root directory of any hard disk partition, or the local installation sources. Del and delete do not support replaceable parameters (wild cards). |
dir | Displays a list of files and subdirectories in a directory.
dir [drive:][path][filename] [drive:][path][filename] Specifies drive, directory, Dir lists all files, including hidden and system files. Files might have the following attributes: a Files ready for archiving h Hidden c Compressed p Reparse Point d Directory r Read-only e Encrypted s System file |
disable | Disables a Windows system service or driver.
disable servicename servicename The name of the service or driver to be Disable prints the old start_type of the service before resetting it to SERVICE_DISABLED. You should make a note of the old start_type, in case you need to enable the service again. The start_type values that the disable command displays are: SERVICE_DISABLED SERVICE_BOOT_START SERVICE_SYSTEM_START SERVICE_AUTO_START SERVICE_DEMAND_START |
diskpart | Manages the partitions on your hard disk volumes.
diskpart[/add | /delete] [device-name | drive-name | partition-name] [size] /add Create a new partition /delete Delete an existing partition device-name Device name for creating a new partition drive-name Drive-letter based name for deleting an partition-name Partition-based name for deleting an existing partition and can be used in as \Device\HardDisk0\Partition1) size Size of the new partition, in megabytes If no arguments are used, a user interface for managing your partitions appears. Warning This command can damage your partition table if the disk has been upgraded to dynamic disk. Always use Disk Management to modify the structure of dynamic disks. |
enable | Enables a Windows system service or driver.
enable servicename [start_type] servicename Name of the service or driver to be enabled. start_type How the service or driver is scheduled to be started. Valid start-type values are: SERVICE_BOOT_START SERVICE_SYSTEM_START SERVICE_AUTO_START SERVICE_DEMAND_START Enable prints the old start_type of the service before resetting it to the new value. Note the old value, in case it is necessary to restore the start_type of the service. If you do not specify a new start_type, enable prints the old start_type. |
exit | Quits the Recovery Console and restarts your computer. |
expand | Expands a compressed file.
EXPAND source [/F:filespec] [destination] [/Y] EXPAND source [/F:filespec] /D source Specifies the file to be expanded. May not include wildcard (* and ?) characters. Destination Specifies the directory for the new file. /y Do not prompt before overwriting an /f:filespec If the source contains more than one file, /d Do not expand; only display a directory of The destination might be any directory within the system directories of the current Windows installation, the root of any drive, the local installation sources, or the Cmdcons directory. The destination cannot be removable media. The destination file cannot be read-only. Use the attrib command to remove the read-only attribute. Expand prompts if the destination file already exists unless /Y is used. |
fixboot | Writes a new boot sector onto the system partition.
fixboot [drive:] drive:Specifies the drive to which a boot sector will be |
fixmbr | Repairs the master boot code of the boot partition.
fixmbr [device-name] device-name Optional name that specifies the device that If fixmbr detects an invalid or nonstandard partition table signature, it prompts you before rewriting the MBR. Warning This command can damage your partition table if a virus is present or a hardware problem exists and causes partitions to become inaccessible. It is recommended that you run antivirus software before using this command. Windows 2000 includes the antivirus software AvBoot. For more information about AvBoot, see "Troubleshooting Strategies" in this book. |
format | Formats a disk for use with Windows 2000.
format [drive:] [/q] [/fs:file-system] [drive:] Specifies the drive to format. /q Performs a quick format. /fs:file-system Specifies the file system to use (FAT, |
help | Displays information about commands supported by the Recovery Console.
help [command] command Any Recovery Console command. If command is not specified, all of the commands supported by the Recovery Console are listed. The command parameter is used to see the help for a specific command. |
listsvc | Lists all available services and drivers on the computer. |
logon | Lists the detected installations of Windows 2000, and requests the local administrator password for those installations. |
map | Lists the drive letter to physical device mappings that are currently active.
map [arc] arc Tells MAP to use ARC paths instead of Windows 2000 |
md/mkdir | Creates a directory.
md [drive:]path mkdir [drive:]path Mkdir only operates within the system directories of the current Windows installation, removable media, the root directory of any hard disk partition, or the local installation sources. |
more/type | Displays a text file to the screen.
more [filename] type [filename] More or type displays a text file. |
rd/rmdir | Removes (deletes) a directory.
rd [drive:]path rmdir [drive:]path Rmdir only operates within the system directories of the current Windows installation, removable media, the root directory of any hard disk partition, or the local installation sources. |
ren/rename | Renames a single file.
ren [drive:][path]filename1 filename2 rename [drive:][path]filename1 filename2 You cannot specify a new drive or path for your destination file. Rename only operates within the system directories of the current Windows installation, removable media, the root directory of any hard disk partition, or the local installation sources. |
set | Displays and sets Recovery Console environment variables.
set variable = parameter set AllowWildCards = TRUE The following environment variables are supported: AllowWildCards Enable wildcard support for some commands, such as DEL, that do not otherwise support them. AllowAllPaths Allow access to all files and folders on the computer. AllowRemovableMedia Allow files to be copied to removable media, such as floppy disks. NoCopyPrompt Do not prompt when overwriting file. To display the list of current environment variable settings, type set without parameters. The set command is an optional Recovery Console command that can be enabled by using either the Group Policy snap-in or the Security Configuration and Analysis snap-in. |
systemroot | Sets the current directory to |
Often it is useful to enable the set command to make full use of the Recovery Console. To do this, a local policy must be enabled.
To enable full functionality of the set command using Group Policy
Note
If Group Policy has already been added to your MMC, skip to step 8.
mmc
To enable full functionality of the set command using the Security Configuration and Analysis snap-in
Note
If Security Configuration and Analysis snap-in has already been added to your MMC, skip to step 7.
mmc
Note
You can also use the Group Policy snap-in and the Security Configuration and Analysis snap-in to select the policy Recovery Console: Allow automatic administrative logon.
If you are having problems with the registry, you can use the copy command to replace individual registry files by copying them from either the
Important
If you copied the files from
If you copied the files from
You can use the Emergency Repair Process to replace a missing or corrupted Boot.ini file. Alternatively, you can use the map command to determine the location of the disks. With this information, you can create a Boot.ini file on another computer, and then use a floppy disk to transfer the Boot.ini file to the original computer.