You can manage remote computers that are running Windows XP Professional, Windows XP 64 Bit Edition, or Windows 2000 by using the Disk Management snap-in. After you select the remote computer you want to manage, you can remotely perform the same tasks that you normally perform while sitting at the remote computer.
By using the DiskPart command-line tool, you can create scripts to automate disk-related tasks, such as creating volumes or converting disks to dynamic. Scripting these tasks is useful if you are deploying Windows XP Professional by using Unattended Installation or the System Preparation (Sysprep) tool, which does not support creating volumes other than the boot volume.
Note | Sysprep.exe is part of Deploy.cab, which is located in the \Support\Tools folder on the Windows XP Professional operating system CD. |
You can use Disk Management to manage disks on remote computers that run Windows XP Professional, Windows XP 64-Bit Edition, or Windows 2000. You must be a member of the Administrators group on both the local and remote computers, and the computers must be within the same domain or within trusted domains.
When managing disks and volumes on remote computers, you can:
Use a computer that is running Windows XP Professional or Windows XP 64-Bit Edition to manage disks on a remote computer that is running Windows 2000 and vice versa.
Use an x86-based computer to manage an Itanium-based computer and vice versa.
The types of volumes and disks you can create depend on the operating system that you are running on the remote computer, not the local computer. For example, only the Windows 2000 Server family supports mirrored volumes and RAID-5 volumes. Therefore, you can use a computer running Windows XP Professional to create mirrored or RAID-5 volumes on a remote computer running Windows 2000 Server. See Table 12-3 earlier in this chapter for more information about the types of volumes and disks available on each edition of Windows XP Professional and Windows 2000 Server.
To manage disks on a remote computer
Click Start, and then click Run.
In the Open box, type compmgmt.msc, and then click OK.
In the Computer Management snap-in, right-click Computer Management (Local), and then click Connect to another computer.
In Another Computer, type the name of the computer that you want to connect to remotely.
When you manage disks in a remote computer, the following limitations apply:
If you use a computer that is running Windows 2000 to manage a remote Itanium-based computer that is running Windows XP 64-Bit Edition, you cannot manage dynamic disks in the remote computer if one of the disks in the disk group is a GPT disk.
If you use a computer that is running Windows XP Professional to manage a remote computer that is running Windows 2000, the property page for IEEE 1394 and USB detachable disks does not show all information.
DiskPart.exe is a text-mode command interpreter that is separate from the Windows XP Professional command prompt. DiskPart allows you to manage fixed (non-removable) disks and volumes by using scripts or direct input.
To run DiskPart, at the command prompt, type:
diskpart
To view a list of DiskPart commands, at the DiskPart command prompt, type:
commands
For more information about using the DiskPart commands, see Windows XP Professional Help.
You can create DiskPart scripts in text files by using any extension. To run a DiskPart script from the command line, type:
diskpart /s testscript.txt
To create a log file of the DiskPart session, type:
diskpart /s testscript.txt > logfile.txt
DiskPart does not have a format command. You must run the format command from the command prompt either manually or by using a batch file. The following example shows a batch file called Formatpart.bat and a DiskPart script called Createpart.txt. The batch file executes the DiskPart script and then runs the format command.
In Formatpart.bat
diskpart /s createpart.txt
format g: /fs:ntfs
In Createpart.txt
select disk 1
create volume simple size 4096
assign letter g
A common scenario for using DiskPart scripts is when you deploy Windows XP Professional by using Unattended Installation or Sysprep.
Unattended Installation. A hands-free method of installing Windows XP Professional that is convenient for system administrators, original equipment manufacturers (OEMs), value-added resellers (VARs), and other users who install Windows XP Professional on many computers or who frequently install Windows XP Professional on the same computer.
System Preparation (Sysprep) Tool. A simple utility that you can use together with third-party disk imaging utilities to prepare a system that you want to duplicate. Sysprep uses an answer file to automate Mini-Setup, which shortens the graphical user interface (GUI) setup mode. In GUI setup mode, the end user is prompted only for required and user-specific information, such as accepting the Microsoft End-User License Agreement (EULA), entering the Product Key, and adding user and company names.
You can create additional volumes or perform other disk-related tasks when you use Unattended Installation or Sysprep by using answer files to run DiskPart scripts. An answer file contains answers to questions that Windows XP Professional Setup asks during installation; the answer file automates the responses so that Setup runs without user intervention. It consists of section headers, parameters, and the values for each parameter. The answer file for Unattended Installation is called Unattend.txt, and the answer file for Sysprep is called Sysprep.inf.
For more information about using Unattended Installation and Sysprep, see Automating and Customizing Installations in this book.
Table 12-6 describes a scenario in which you create and format two primary partitions by using a batch file called Formatpart.bat. The batch file executes a DiskPart script called Createpart.txt to create the partitions, and then the batch file formats the partitions by using the format command.
Scenario | Sample Script |
---|---|
Disk 0: 20 GB basic disk C: 4 GB NTFS system volume (already created) D: 16 GB NTFS data volume (uses the remaining unallocated space on the disk) Disk 1: 60 GB basic disk R: 60 GB NTFS data volume (uses all unallocated space on the disk) | In Createpart.txt:* select disk create partition primar assign letter select disk create partition primar assign letter r In Formatpart.bat: diskpart/s createpart.tx echo y | format d: /fs:ntf echo y | format r: /fs:ntfs |
*You do not need to specify the DiskPart size= parameter in this example because the partitions use all the unallocated space on their respective disks. |
You can use Windows Setup Manager to specify Formatpart.bat by following the example shown in Figure 12-5. Programs that you enter in the Command to run box appear in the [GuiRunOnce] section of Unattend.txt or Sysprep.inf.
Figure 12-5: Configuring Run Once in Windows Setup Manager
[GuiRunOnce] contains a list of commands that Windows XP Professional executes the first time a user logs on to the computer after GUI-mode Setup has completed. Each line specifies a command to be executed by the GuiRunOnce registry entry. For example:
[GuiRunOnce]
Command0 = c:\formatpart.bat
Note | For each command line that contains spaces, be sure to place the command in quotation marks when you add the command to the answer file. If you use Windows Setup Manager to specify a command, Windows Setup Manager automatically adds the quotation marks to the answer file. |
Commands run by using the GuiRunOnce key run in the security context of the user who is currently logged on. If the user does not have the permissions necessary to run the command completely, the command fails.
Table 12-7 describes a scenario in which you execute a DiskPart script called Convertdyn.txt in the [GuiRunOnce] section of Sysprep.inf. The Convertdyn.txt script converts Disk 0 to dynamic.
Scenario | Sample Script |
---|---|
Disk 0: 24 GB basic disk to be converted to dynamic C: 4 GB NTFS system volume (already created) D: 20 GB NTFS data volume (already created) | In Convertdyn.txt: select disk 0 convert dynamic |
After the conversion, both basic volumes become dynamic simple volumes. If you need to increase the size of volume D, you can extend the volume to another disk to create a spanned volume.
Most third-party imaging tools are not compatible with dynamic disks. Therefore, you must convert the disk to dynamic after you create the images, and then deploy the images to target computers. Perform the following steps to complete this scenario:
Use Windows Setup Manager to create the Sysprep.inf file or modify an existing file.
Prepare the system for imaging by using Sysprep. Both basic volumes can be present when you create the image, but the disk must be a basic disk.
Clone the image by using a third-party imaging tool.
Download the image to the target systems.
Use Sysprep.inf to execute the DiskPart script that converts Disk 0 to dynamic.
You are prompted to restart the computer twice to complete the conversion because the disk contains the system volume. For more information about converting the system volume to dynamic, see Converting Basic Disks to Dynamic Disks earlier in this chapter.
You can use the Fsutil.exe command-line tool from the command prompt to perform many disk and volume-related tasks on NTFS volumes. Table 12-8 summarizes many of the Fsutil commands related to disks and volumes. For more information about using Fsutil, including the commands not listed here, see Windows XP Professional Help.
Command | Description |
---|---|
fsutil fsinfo drives | Lists the drive letters for all volumes on the computer. |
fsutil fsinfo drivetype | Displays the drive type for the specified drive. For example, this command can return Fixed Drive, CD ROM Drive, and Removable Drive. |
fsutil fsinfo volumeinfo | For a specified NTFS volume, displays information about the file system, such as volume name, serial number, and whether the volume supports NTFS-related features, such as disk quotas, encryption, and compression. |
fsutil fsinfo statistics | Displays statistics about the specified NTFS volume. |
fsutil fsinfo ntfsinfo | Displays information about the specified NTFS volume, such as the total clusters, free clusters, bytes per sector, bytes per cluster, and information about the master file table (MFT). |
fsutil volume dismount | Dismounts the specified volume. |
fsutil volume diskfree | Displays the total number of bytes in the volume, the number of free bytes, and the number of bytes available for data storage. |