Difference between revisions of "Active Directory/Documentation/WDS/Command Prompt Help"
(→Basic Command Prompt Usage: Add file copy command) |
(Tag as migrated) |
||
Line 119: | Line 119: | ||
===wdscapture=== | ===wdscapture=== | ||
The WDS Image Capture Wizard, which will allow you to capture an image of the current machine in a GUI wizard. Accessible by typing "wdscapture". | The WDS Image Capture Wizard, which will allow you to capture an image of the current machine in a GUI wizard. Accessible by typing "wdscapture". | ||
+ | [[Category:Migrated to AD]] |
Latest revision as of 16:37, 8 July 2011
This page is intended as a reference for using the command prompt from within WDS. To get to a command prompt, press and hold the Shift key while pressing the F10 key, then release the Shift key. You can open as many command prompt windows as you need.
Basic Command Prompt Usage
If you are new to the command prompt, this section will give you a very brief introduction. There is much more complete and verbose information available elsewhere online.
Changing the working drive
If you need to point the command prompt to a different drive, simply type the drive letter followed by a colon:
- c:
- e:
- x:
Changing the working path
To navigate through the directory structure on a drive, use the command "cd".
- Move up in the directory tree by one level: cd ..
- Move into the directory "images": cd images
- Move into the directory "cats and dogs": cd "cats and dogs"
You can combine multiple levels of directories by the backslash ("\") and issue move through more than one directory level at a time:
- Move into the directory "windows7", which is a subdirectory of the "images" directory, which is located two levels above our current directory: cd ..\..\images\windows7
Getting a directory listing
To see the files that are in a directory, use the "dir" command.
- Get a directory list: dir
- Get a directory list and paginate it so that all of the results don't scroll off of the screen: dir /p
- Get a directory list of all files starting with "win": dir win*
- Get a directory list of all text files: dir *.txt
Viewing the contents of a file
To view the contents of a file, use the "type" command.
- Print the contents of the file "notes.txt" to the screen: type notes.txt
Copying a file
Use the "copy" command to copy a file.
- Copy "install.wim" to the images directory that is on the R:\ drive: copy install.wim R:\images"
- Copy "install.wim" to a new file called "new_install.wim": copy install.wim new_install.wim
Erasing a file
Use the "del" command to erase a file.
- Delete the file "notes.txt": del notes.txt
- Delete all text files in this directory: del *.txt
- Delete all files starting with "win": del win*
Erasing a directory
Use the command "rmdir" to delete a directory.
- Delete the directory "test" with no files or subdirectories in it: rmdir test
- Delete the directory "images" and everything in it: rmdir /s test
Useful Commands
This is a list of frequently-used commands that WDS users issue at the command prompt. It is not an exhaustive list of available commands. Most of these commands allow you to append "/?" to the end of the command to get more information about that command.
diskpart
This tool allows you to format and partition a drive. For more information regarding the usage of the diskpart tool, type "diskpart", then "help".
To perform a format
- At the command prompt, type in:
- diskpart
- list volume
- This will output a table with volume numbers, labels, and other information about volumes on the computer. Find the entry for the partition/volume you want to format, and note the volume number. Typically, for the c: drive, this will be volume 0.
- Type in: select volume <#> where <#> is the number you noted in the previous step.
- Type in: format <quick> where <quick> is the word "quick" if you want to perform a quick format. If you do not want a quick format, omit this word.
- The disk will be formatted. To exit the diskpart utility, type in: exit
To perform a repartitioning
- At the command prompt, type in:
- diskpart
- list disk
- This will output a table with disk numbers, sizes, and other information about disks attached to computer. Find the entry for the drive you want to repartition, and note the disk number. Typically, for the c: drive, this will be disk 0.
- Type in: select disk <#> where <#> is the number you noted in the previous step.
- Type in:
- clean
- create partition primary <size=[size]>
- where <size=[size]> is a directive telling diskpart how much disk space to use for the partition, in megabytes. If you want to specify a custom partition scheme, use the phrase "size=[size]" where [size] is the amount of disk space to use in megabytes. If you want the partition to consume the entirety of the drive, omit the <size=[size]> directive.
- Type in:
- select partition 1
- active
- format
- assign
- The above commands will select the partition, make it active, format it, and then give it a drive letter.
- To exit the diskpart utility, type in: exit
imagex
ImageX, one of the utilities for manipulating .wim files. ImageX has two major uses:
Manually Capturing an Image
Here you will use the ImageX utility to capture an image off of a hard drive. For more information regarding the usage of the ImageX tool, type "imagex /?".
- Type in: imagex /compress maximum /check /capture <c:\> <c:\image.wim> <"ImageName"> <"ImageDesc">
- where <c:\> is the volume you want to capture (generally the computer's c: drive)
- and <c:\image.wim> is the path and file into which you want to capture the image
- and <"ImageName"> is the name of the image (enclosed in quotes)
- and <"ImageDesc"> is an optional description of the image's contents (enclosed in quotes)
- The image will be captured. This can take quite some time, depending upon your processor, disk speed, and size of the data to capture.
- Once the image is captured, you can copy the resulting wim file to a network location or external storage directly connected to the machine. This will allow you to upload the wim file in accordance with the procedures documented on the WolfTech wiki regarding the use of customized images.
Manually Applying an Image
Here you will use the ImageX utility to deploy an image onto a hard drive. For more information regarding the usage of the ImageX tool, type "imagex /?".
Prerequisite: The .wim image must be on directly-connected external storage or a network location accessible to the target computer.
Note: Using "imagex /apply" will merge the contents of the image with the current contents of the path at which the image is applied. This means that if you are deploying a computer in this way, you probably want to format and/or repartition the target computer prior to this procedure!
- Type in: imagex /apply /check <d:\image.wim> <#> <c:\>
- where <d:\image.wim> is the path and filename of the wim image file
- and <#> is the image to apply from the wim image file (which is almost always 1)
- and <c:\> is the path to apply the image onto (generally the computer's c: drive)
- The image will be applied. This can take some time, depending upon the size of the image and the speed of the storage or network link that the image is stored on.
- Reboot to start using the new image.
net
Net.exe, on normal computers, contains a huge structure of commands that yield an immense amount of functionality. In WDS, it's primary purpose is for accessing network resources. For more information regarding the usage of the net command, type "net help".
Prerequisite: You must have network connectivity in order for this to work. This means that you must have drivers installed in this image for your network hardware, and have an active network connection on the computer (ie, a working network cable).
- Type in: net use * <\\server\share> * /user:<domain\username>
- where <\\server\share> is the UNC path to a network server and the shared volume it hosts. This can be a DFS path or or standalone server\share combination. Examples:
- \\wolftech.ad.ncsu.edu\deployment
- \\yellowstone.cnr.ncsu.edu\storage
- and <domain\username> is the desired username and domain context to connect as. Examples:
- wolftech\agerber - standard WolfTech login
- wolftech\agerber.admin - WolfTech .admin instance
- unity\agerber - standard Unity Active Directory domain login
- yellowstone\localuser - local account on a computer (yellowstone)
- where <\\server\share> is the UNC path to a network server and the shared volume it hosts. This can be a DFS path or or standalone server\share combination. Examples:
- Enter the password of the user account you specified when prompted.
- Note the drive letter to which the the network resource is connected.
notepad
The basic text editor. Accessible by typing "notepad". You can open a specific file by typing the name of the file after notepad.
mbrfix
A utility to perform several different tasks relating to the Master Boot Record. Accessible by typing "mbrfix". For more information, consult the MBRFix web site.
taskmgr
The Task Manager application that shows up on normal Windows computers when you press Ctrl, Alt, and Esc at the same time. Accessible by typing "taskmgr".
wdscapture
The WDS Image Capture Wizard, which will allow you to capture an image of the current machine in a GUI wizard. Accessible by typing "wdscapture".