Windows Command Reference

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows XP,Windows Vista,Windows Server 2003,Windows Server 2000,Windows Server 2003 R2,Windows 7

You can use the Windows command reference to familiarize yourself with new and enhanced command-line tools, to learn about the command shell, and to automate command-line tasks by using batch files or scripting tools.

To view the latest content for the Windows command reference, see http://go.microsoft.com/fwlink/?LinkID=91473. When you view the command reference content online, you can provide feedback on individual topics. Microsoft reviews the feedback and uses it to help improve the quality of the command reference.

The following sections contain information about the syntax and usage of the command line tools.

  • A-Z List contains an alphabetical list of all of the commands

  • Command-Line Syntax Key explains the formatting used in this reference

  • Commands by Server Role lists commands by their associated server role.


A-Z List

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows Server 2003,Windows 7,Windows Server 2003 R2

Alphabetical listing of commands:

  • Adprep

  • Append

  • Arp

  • Assoc

  • At

  • Attrib

  • Auditpol

  • Autochk

  • Autoconv

  • Autofmt

  • Bcdedit

  • Bitsadmin

  • Bootcfg

  • Break

  • Cacls

  • Call

  • Cd

  • Certreq

  • Certutil

  • Change

  • Chcp

  • Chdir

  • Chglogon

  • Chgport

  • Chgusr

  • Chkdsk

  • Chkntfs

  • Choice

  • Cipher

  • Clip

  • Cls

  • Cluster

  • Cmd

  • Cmdkey

  • Color

  • Comp

  • Compact

  • Convert

  • Copy

  • Csvde

  • Date

  • Dcdiag

  • Dcpromo

  • Defrag

  • Del

  • Dfscmd

  • Dir

  • Dirquota

  • Diskcomp

  • Diskcopy

  • Diskedit

  • DiskPart

  • DiskRAID

  • Diskshadow

  • Dnscmd

  • Doskey

  • Driverquery

  • Dsacls

  • Dsadd

  • Dsamain

  • Dsdbutil

  • Dsget

  • Dsmgmt

  • Dsmod

  • Dsmove

  • Dsquery

  • Dsrm

  • Echo

  • Edit

  • Endlocal

  • Erase

  • Eventcreate

  • Exit

  • Extract

  • Fc

  • Filescrn

  • Find

  • Findstr

  • Flattemp

  • For

  • Forfiles

  • Format

  • Freedisk

  • Fsutil

  • Ftp

  • Ftype

  • Goto

  • Gpresult

  • Graftabl

  • Hashgen

  • Help

  • Icacls

  • If

  • Ipconfig

  • Irftp

  • Ktmutil

  • Ktpass

  • Label

  • Ldifde

  • Ldp

  • Logman

  • Logoff

  • Lpq

  • Lpr

  • mapadmin

  • Md

  • Mkdir

  • Mklink

  • Mode

  • More

  • Mount

  • Mountvol

  • Move

  • Msdt

  • Msg

  • Msiexec

  • Msinfo32

  • Mstsc

  • Netdom

  • Netsh

  • Net computer

  • Net group

  • Net localgroup

  • Net print

  • Net user

  • Nfsadmin

  • Nfsshare

  • Nfsstat

  • Nlb

  • Nltest

  • Nslookup

  • Ntbackup

  • Ntdsutil

  • Openfiles

  • Path

  • Pause

  • Perfmon

  • Popd

  • Print

  • Prncnfg.vbs

  • Prndrvr.vbs

  • Prnjobs.vbs

  • Prnmngr.vbs

  • Prnport.vbs

  • Prnqctl.vbs

  • Prompt

  • Pubprn.vbs

  • Pushd

  • Qappsrv

  • Qprocess

  • Query

  • Quser

  • Qwinsta

  • Rasdial

  • Rcp

  • Rd

  • Rdpsign

  • Reagentc

  • Recover

  • Redircmp

  • Redirusr

  • Reg

  • Regsvr32

  • Relog

  • Rem

  • Ren

  • Rename

  • Repadmin

  • Replace

  • Reset session

  • Rmdir

  • Robocopy

  • Rpcinfo

  • Rsh

  • Runas

  • Rundll32

  • Rwinsta

  • Sc

  • Schtasks

  • Servermanagercmd

  • Set

  • Setlocal

  • Setspn

  • Setx

  • Shadow

  • Shift

  • Showmount

  • Shutdown

  • Sort

  • Start

  • Storrept

  • Subst

  • Systeminfo

  • Takeown

  • Taskkill

  • Tasklist

  • Telnet

  • Tftp

  • Time

  • Timeout

  • Title

  • Tlntadmn

  • Tracerpt

  • Tree

  • Tscon

  • Tsdiscon

  • Tskill

  • Tsprof

  • Type

  • Typeperf

  • Umount

  • Ver

  • Verify

  • Vol

  • Vssadmin

  • Waitfor

  • Wbadmin

  • Wdsutil

  • Wecutil

  • Wevtutil

  • Where

  • Whoami

  • Winsat

  • Wmic

  • Xcopy


Adprep

Applies To: Windows Server 2008,Windows Server 2003 with SP1,Windows Server 2003 R2,Windows Server 2003

Extends the Active Directory® schema and updates permissions as necessary to prepare a forest and domain for a domain controller that runs the Windows Server® 2008 operating system.

Adprep.exe is a command-line tool that is available on the Windows Server 2008 installation disc in the \sources\adprep folder, and it is available on the Windows Server 2008 R2 installation disk in the \support\adprep folder. You must run adprep from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

In Windows Server 2008 R2, Adprep is available in a 32-bit version and a 64-bit version. The 64-bit version runs by default. If you need to run Adprep on a 32-bit computer, run the 32-bit version (Adprep32.exe).

For more information about running Adprep.exe and how to resolve errors that can occur when you run it, see Running Adprep.exe (http://go.microsoft.com/fwlink/?LinkID=142597).

For examples of how this command can be used, see Examples.

For more information about running adprep /forestprep, see Prepare a Windows 2000 or Windows Server 2003 Forest Schema for a Domain Controller That Runs Windows Server 2008 or Windows Server 2008 R2 (http://go.microsoft.com/fwlink/?LinkID=93242).

For more information about running adprep /domainprep /gpprep, see Prepare a Windows 2000 or Windows Server 2003 Domain for a Domain Controller That Runs Windows Server 2008 or Windows Server 2008 R2 (http://go.microsoft.com/fwlink/?LinkID=93243).

For more information about running adprep /rodcprep, see Prepare a Forest for a Read-Only Domain Controller (http://go.microsoft.com/fwlink/?LinkID=93244).

Syntax

Copy Code
adprep {/forestprep | /domainprep | /domainprep /gpprep | /rodcprep | /wssg | /silent }

Parameters

Parameter Description

/forestprep

Prepares a forest for the introduction of a domain controller that runs Windows Server 2008. You run this command only once in the forest. You must run this command on the domain controller that holds the schema operations master role (also known as flexible single master operations or FSMO) for the forest. You must be a member of all the following groups to run this command:

  • The Enterprise Admins group

  • The Schema Admins group

  • The Domain Admins group of the domain that hosts the schema master

/domainprep

Prepares a domain for the introduction of a domain controller that runs Windows Server 2008. You run this command after the forestprep command finishes and after the changes replicate to all the domain controllers in the forest.

Run this command in each domain where you plan to add a domain controller that runs Windows Server 2008. You must run this command on the domain controller that holds the infrastructure operations master role for the domain. You must be a member of the Domain Admins group to run this command.

/domainprep /gpprep

Performs similar updates as domainprep. However, this command also provides updates that are necessary to enable Resultant Set of Policy (RSOP) Planning Mode functionality.

In Active Directory environments that run Microsoft Windows® 2000, this command performs updates during off-peak hours. This minimizes replication traffic that is created in those environments by updates to file system permissions and Active Directory permissions on existing Group Policy objects (GPOs). This command is also available on Microsoft Windows Server 2003 with Service Pack 1 (SP1) or later.

Run this command after the forestprep command finishes and after the changes replicate to all domain controllers in the forest. You must run this command on the infrastructure master for the domain. For more information about running this command in Windows 2000 Active Directory environments, see Prepare Your Infrastructure for Upgrade (http://go.microsoft.com/fwlink/?LinkId=94798).

/rodcprep

Updates permissions on application directory partitions to enable replication of the partitions to read-only domain controllers (RODCs). This operation runs remotely; it contacts the infrastructure master in each domain to update the permissions. You need to run this command only once in the forest. However, you can rerun this command any time if it fails to complete successfully because an infrastructure master is not available. You can run this command on any computer in the forest. You must be a member of the Enterprise Admins group to run this command.

/wssg

Returns an expanded set of exit codes, instead of just 0 (Success) and 1 (Failure).

/silent

Specifies that no standard output is returned from an operation. This parameter can be used only if /wssg is also used.

quit

Returns to the prior menu.

Help

Displays Help for this command.

?

Displays Help for this command.

Remarks

  • To prepare an existing Windows 2000 or Windows Server 2003 Active Directory environment for a Windows Server 2008 domain controller, be sure to run the version of Adprep that is included in the Windows Server 2008 installation media.

  • If you run Adprep on a domain controller running Windows 2000 Server, the domain controller must be running Windows 2000 Server Service Pack 4 (SP4) or later.

  • You can also perform verification steps before and after you run the adprep command to help ensure that the operations complete successfully. For more information, see Steps for Extending the Schema (http://go.microsoft.com/fwlink/?LinkId=94799).

Exit Codes

The following table lists exit codes that Adprep can return after an operation completes.

Return Code | Description
0 | Success
1 | Failure
2 | Schema conflict error
3 | FSMO role error
4 | Connection error
5 | Schema upgrade error
6 | Unable to modify error
7 | Server busy error
8 | Permission error
9 | Unable to initialize log file error
10 | Not a domain controller
11 | In nonnative mode
12 | Need to run forest update first
13 | Forest update already done
14 | Domain update already done
15 | GPO update already done
16 | Forest update wait replication

Examples

The following example prepares a forest for a domain controller that runs Windows Server 2008:

Copy Code
adprep /forestprep

The following example prepares a domain for a domain controller that runs Windows Server 2008:

Copy Code
adprep /domainprep

The following example prepares a domain for an RODC:

Copy Code
adprep /rodcprep

Additional references

Command-Line Syntax Key


Append

Applies To: Windows Server 2008

Allows programs to open data files in specified directories as if they were in the current directory. If used without parameters, append displays the appended directory list.

For examples of how to use this command, see Examples.

Syntax

Copy Code
append [[<Drive>:]<Path>[;...]] [/x[:on|:off]] [/path:[:on|:off] [/e]
append ;

Parameters

Parameter | Description
[<Drive>:]<Path> | Specifies a drive and directory to append.
/x:on | Applies appended directories to file searches and launching applications.
/x:off | Applies appended directories only to requests to open files. /x:off is the default setting.
/path:on | Applies appended directories to file requests that already specify a path. /path:on is the default setting.
/path:off | Turns off the effect of /path:on.
/e | Stores a copy of the appended directory list in an environment variable named APPEND. /e may be used only the first time you use append after starting your system.
; | Clears the appended directory list.
/? | Displays help at the command prompt.

Examples

To clear the appended directory list, type:

Copy Code
append ;

To store a copy of the appended directory to an environment variable named APPEND, type:

Copy Code
append /e

Additional references

Command-Line Syntax Key


Arp

Applies To: Windows Server 2008

Displays and modifies entries in the Address Resolution Protocol (ARP) cache, which contains one or more tables that are used to store IP addresses and their resolved Ethernet or Token Ring physical addresses. There is a separate table for each Ethernet or Token Ring network adapter installed on your computer. Used without parameters, arp displays help.

Syntax

arp[-a [InetAddr] [-N IfaceAddr]] [-g [InetAddr] [-N IfaceAddr]] [-d InetAddr [IfaceAddr]] [-s InetAddr EtherAddr [IfaceAddr]]
Parameters
-a[ InetAddr] [ -N IfaceAddr]

Displays current ARP cache tables for all interfaces. To display the ARP cache entry for a specific IP address, use arp -a with the InetAddr parameter, where InetAddr is an IP address. If InetAddr is not specified, the first applicable interface is used. To display the ARP cache table for a specific interface, use the -N IfaceAddr parameter in conjunction with the -a parameter where IfaceAddr is the IP address assigned to the interface. The -N parameter is case-sensitive.

-g[ InetAddr] [ -N IfaceAddr]

Identical to -a.

-d InetAddr[ IfaceAddr]

Deletes an entry with a specific IP address, where InetAddr is the IP address. To delete an entry in a table for a specific interface, use the IfaceAddr parameter where IfaceAddr is the IP address assigned to the interface. To delete all entries, use the asterisk (*) wildcard character in place of InetAddr.

-s InetAddr EtherAddr [ IfaceAddr]

Adds a static entry to the ARP cache that resolves the IP address InetAddr to the physical address EtherAddr. To add a static ARP cache entry to the table for a specific interface, use the IfaceAddr parameter where IfaceAddr is an IP address assigned to the interface.

/?

Displays help at the command prompt.

Remarks

  • The IP addresses for InetAddr and IfaceAddr are expressed in dotted decimal notation.

  • The physical address for EtherAddr consists of six bytes expressed in hexadecimal notation and separated by hyphens (for example, 00-AA-00-4F-2A-9C).

  • Entries added with the -s parameter are static and do not time out of the ARP cache. The entries are removed if the TCP/IP protocol is stopped and started. To create permanent static ARP cache entries, place the appropriate arp commands in a batch file and use Scheduled Tasks to run the batch file at startup.

Examples

To display the ARP cache tables for all interfaces, type:

arp -a

To display the ARP cache table for the interface that is assigned the IP address 10.0.0.99, type:

arp -a -N 10.0.0.99

To add a static ARP cache entry that resolves the IP address 10.0.0.80 to the physical address 00-AA-00-4F-2A-9C, type:

arp -s 10.0.0.80 00-AA-00-4F-2A-9C


Assoc

Applies To: Windows Vista,Windows Server 2008

Displays or modifies file name extension associations. If used without parameters, assoc displays a list of all the current file name extension associations.

For examples of how to use this command, see Examples.

Syntax

Copy Code
assoc [<.ext>[=[<FileType>]]]

Parameters

Parameter | Description
<.ext> | Specifies the file name extension.
<FileType> | Specifies the file type to associate with the specified file name extension.
/? | Displays help at the command prompt.

Remarks

  • To remove the file type association for a file name extension, add a white space after the equal sign by pressing the SPACEBAR.

  • To view current file types that have open command strings defined, use the ftype command.

  • To redirect the output of assoc to a text file, use the > redirection operator.

Examples

To view the current file type association for the file name extension .txt, type:

Copy Code
assoc .txt

To remove the file type association for the file name extension .bak, type:

Copy Code
assoc .bak=
Note
Be sure to add a space after the equal sign.

To view the output of assoc one screen at a time, type:

Copy Code
assoc | more

To send the output of assoc to the file assoc.txt, type:

Copy Code
assoc>assoc.txt

Additional references

Command-Line Syntax Key


At

Applies To: Windows Server 2008

Schedules commands and programs to run on a computer at a specified time and date. You can use at only when the Schedule service is running. Used without parameters, at lists scheduled commands.

Syntax

at [\\ComputerName] [{[ID] [/delete] | /delete [/yes]}]

at [[\\ComputerName] Hours:Minutes [/interactive] [{/every:Date[,...] | /next:Date[,...]}] Command]

Parameters

\\ComputerName

Specifies a remote computer. If you omit this parameter, at schedules the commands and programs on the local computer.

ID

Specifies the identification number assigned to a scheduled command.

/delete

Cancels a scheduled command. If you omit ID, all of the scheduled commands on the computer are canceled.

/yes

Answers yes to all queries from the system when you delete scheduled events.

Hours:Minutes

Specifies the time when you want to run the command. Time is expressed as Hours:Minutes in 24-hour notation (that is, 00:00 [midnight] through 23:59).

/interactive

Allows Command to interact with the desktop of the user who is logged on at the time Command runs.

/every:

Runs Command on every specified day or days of the week or month (for example, every Thursday, or the third day of every month).

Date

Specifies the date when you want to run the command. You can specify one or more days of the week (that is, type M,T,W,Th,F,S,Su) or one or more days of the month (that is, type 1 through 31). Separate multiple date entries with commas. If you omit Date, at uses the current day of the month.

/next:

Runs Command on the next occurrence of the day (for example, next Thursday).

Command

Specifies the Windows command, program (that is, .exe or .com file), or batch program (that is, .bat or .cmd file) that you want to run. When the command requires a path as an argument, use the absolute path (that is, the entire path beginning with the drive letter). If the command is on a remote computer, specify Universal Naming Convention (UNC) notation for the server and share name, rather than a remote drive letter.

/?

Displays help at the command prompt.

Remarks

  • Schtasks is another command-line scheduling tool that you can use to create and manage scheduled tasks. For more information about schtasks, see Related Topics.

  • Using at

    To use at, you must be a member of the local Administrators group.

  • Loading Cmd.exe

    At does not automatically load Cmd.exe, the command interpreter, before running commands. If you are not running an executable (.exe) file, you must explicitly load Cmd.exe at the beginning of the command as follows:

    cmd /c dir > c:\test.out

  • Viewing scheduled commands

    When you use at without command-line options, scheduled tasks appear in a table formatted similar to the following:

    Copy Code
    Status  ID   Day        Time        Command Line
OK      1    Each F     4:30 PM     net send group leads status due
OK      2    Each M     12:00 AM    chkstor > check.file
OK      3    Each F     11:59 PM    backup2.bat
  • Including identification number (ID)

    When you include identification number (ID) with at at a command prompt, information for a single entry appears in a format similar to the following:

    Copy Code
    Task ID:      1

Status:       OK

Schedule:     Each  F

Time of Day:  4:30 PM

Command:      net send group leads status due
    After you schedule a command with at, especially a command that has command-line options, check that the command syntax is correct by typing at without command-line options. If the information in the Command Line column is incorrect, delete the command and retype it. If it is still incorrect, retype the command with fewer command-line options.

  • Viewing results

    Commands scheduled with at run as background processes. Output is not displayed on the computer screen. To redirect output to a file, use the redirection symbol (>). If you redirect output to a file, you need to use the escape symbol (^) before the redirection symbol, whether you are using at at the command line or in a batch file. For example, to redirect output to Output.text, type:

    at 14:45 c:\test.bat ^>c:\output.txt

    The current directory for the executing command is the systemroot folder.

  • Changing system time

    If you change the system time at a computer after you schedule a command to run with at, synchronize the at scheduler with the revised system time by typing at without command-line options.

  • Storing commands

    Scheduled commands are stored in the registry. As a result, you do not lose scheduled tasks if you restart the Schedule service.

  • Connecting to network drives

    Do not use a redirected drive for scheduled jobs that access the network. The Schedule service might not be able to access the redirected drive, or the redirected drive might not be present if a different user is logged on at the time the scheduled task runs. Instead, use UNC paths for scheduled jobs. For example:

    at 1:00pm my_backup \\server\share

    Do not use the following syntax, where x: is a connection made by the user:

    at 1:00pm my_backup x:

    If you schedule an at command that uses a drive letter to connect to a shared directory, include an at command to disconnect the drive when you are finished using the drive. If the drive is not disconnected, the assigned drive letter is not available at the command prompt.

  • Tasks stopping after 72 hours

    By default, tasks scheduled using the at command stop after 72 hours. You can modify the registry to change this default value.

    1. Start Registry Editor (regedit.exe).

    2. Locate and click the following key in the registry: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Schedule

    3. On the Edit menu, click Add Value, and then add the following registry value: Value Name: AtTaskMaxHours Data type: REG_DWORD Radix: Decimal Value Data: 0. A value of 0 in the value data field indicates no limit, does not stop. Values from 1 through 99 indicates the number of hours.

Caution

  • Incorrectly editing the registry may severely damage your system. Before making changes to the registry, you should back up any valued data on the computer.

  • Task Scheduler and the at command

    You can use the Scheduled Tasks folder to view or modify the settings of a task that was created by using the at command. When you schedule a task using the at command, the task is listed in the Scheduled Tasks folder, with a name such as the following:At3478. However, if you modify an at task through the Scheduled Tasks folder, it is upgraded to a normal scheduled task. The task is no longer visible to the at command, and the at account setting no longer applies to it. You must explicitly enter a user account and password for the task.

Examples

To display a list of commands scheduled on the Marketing server, type:

at \\marketing

To learn more about a command with the identification number 3 on the Corp server, type:

at \\corp 3

To schedule a net share command to run on the Corp server at 8:00 A.M. and redirect the listing to the Maintenance server, in the Reports shared directory, and the Corp.txt file, type:

at \\corp 08:00 cmd /c "net share reports=d:\marketing\reports >> \\maintenance\reports\corp.txt"

To back up the hard drive of the Marketing server to a tape drive at midnight every five days, create a batch program called Archive.cmd, which contains the backup commands, and then schedule the batch program to run, type:

at \\marketing 00:00 /every:5,10,15,20,25,30 archive

To cancel all commands scheduled on the current server, clear the at schedule information as follows:

at /delete

To run a command that is not an executable (that is, .exe) file, precede the command with cmd /c to load Cmd.exe as follows:

cmd /c dir > c:\test.out


Atmadm

Applies To: Windows Server 2003 with SP1,Windows Server 2003,Windows Server 2003 with SP2,Windows Server 2003 R2

Atmadm is deprecated, and is not guaranteed to be supported in future releases of Windows.

This tool is included in Windows Server 2003. For more information see Atmadm.


Attrib

Applies To: Windows Vista,Windows Server 2008

Displays, sets, or removes attributes assigned to files or directories. If used without parameters, attrib displays attributes of all files in the current directory.

For examples of how to use this command, see Examples.

Syntax

Copy Code
attrib [{+|-}r] [{+|-}a] [{+|-}s] [{+|-}h] [{+|-}i] [<Drive>:][<Path>][<FileName>] [/s [/d] [/l]]

Parameters

Parameter | Description
{+|-}r | Sets (+) or clears (-) the Read-only file attribute.
{+|-}a | Sets (+) or clears (-) the Archive file attribute.
{+|-}s | Sets (+) or clears (-) the System file attribute.
{+|-}h | Sets (+) or clears (-) the Hidden file attribute.
{+|-}i | Sets (+) or clears (-) the Not Content Indexed file attribute.
[<Drive>:][<Path>][<FileName>] | Specifies the location and name of the directory, file, or group of files for which you want to display or change attributes. You can use the ? and * wildcard characters in the FileName parameter to display or change the attributes for a group of files.
/s | Applies attrib and any command-line options to matching files in the current directory and all of its subdirectories.
/d | Applies attrib and any command-line options to directories.
/l | Applies attrib and any command-line options to the Symbolic Link, rather than the target of the Symbolic Link.
/? | Displays help at the command prompt.

Remarks

  • You can use wildcard characters (? and *) with the FileName parameter to display or change the attributes for a group of files.

  • If a file has the System (s) or Hidden (h) attribute set, you must clear the attribute before you can change any other attributes for that file.

  • The Archive attribute (a) marks files that have changed since the last time they were backed up. Note that the xcopy command uses archive attributes.

Examples

To display the attributes of a file named News86 that is located in the current directory, type:

Copy Code
attrib news86

To assign the Read-only attribute to the file named Report.txt, type:

Copy Code
attrib +r report.txt

To remove the Read-only attribute from files in the Public directory and its subdirectories on a disk in drive B, type:

Copy Code
attrib -r b:\public\*.* /s

To set the Archive attribute for all files on drive A, and then clear the Archive attribute for files with the .bak extension, type:

Copy Code
attrib +a a:*.* & attrib -a a:*.bak


Auditpol

Applies To: Windows 7,Windows Vista,Windows Server 2008,Windows Server 2008 R2

Displays information about and performs functions to manipulate audit policies.

For examples of how this command can be used, see the Examples section in each topic.

Syntax

Copy Code
Auditpol command [<sub-command><options>]

Parameters

Sub-command Description

/get

Displays the current audit policy.

See Auditpol get for syntax and options.

/set

Sets the audit policy.

See Auditpol set for syntax and options.

/list

Displays selectable policy elements.

See Auditpol list for syntax and options.

/backup

Saves the audit policy to a file.

See Auditpol backup for syntax and options.

/restore

Restores the audit policy from a file that was previously created by using auditpol /backup.

See Auditpol restore for syntax and options.

/clear

Clears the audit policy.

See Auditpol clear for syntax and options.

/remove

Removes all per-user audit policy settings and disables all system audit policy settings.

See Auditpol remove for syntax and options.

/resourceSACL

Configures global resource system access control lists (SACLs).

Note
Applies only to Windows 7 and Windows Server 2008 R2.

See Auditpol resourceSACL.

/?

Displays help at the command prompt.

Remarks

The audit policy command-line tool can be used to:

  • Set and query a system audit policy.

  • Set and query a per-user audit policy.

  • Set and query auditing options.

  • Set and query the security descriptor used to delegate access to an audit policy.

  • Report or back up an audit policy to a comma-separated value (CSV) text file.

  • Load an audit policy from a CSV text file.

  • Configure global resource SACLs.

Additional references

Command-Line Syntax Key


Auditpol get

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Retrieves the system policy, per-user policy, auditing options, and audit security descriptor object.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
Auditpol /get
[/user[:<username>|<{sid}>]]
[/category:*|<name>|<{guid}>[,:<name|<{guid}>…]]
[/subcategory:*|<name>|<{guid}>[,:<name|<{guid}>…]]
[/option:<option name>]
[/sd]
[/r]

Parameters

Parameter | Description
/user | Displays the security principal for whom the per-user audit policy is queried. Either the /category or /subcategory parameter must be specified. The user may be specified as a security identifier (SID) or name. If no user account is specified, then the system audit policy is queried.
/category | One or more audit categories specified by globally unique identifier (GUID) or name. An asterisk (*) may be used to indicate that all audit categories should be queried.
/subcategory | One or more audit subcategories specified by GUID or name.
/sd | Retrieves the security descriptor used to delegate access to the audit policy.
/option | Retrieves the existing policy for the CrashOnAuditFail, FullPrivilegeAuditing, AuditBaseObjects, or AuditBaseDirectories options.
/r | Displays the output in report format, comma-separated value (CSV).
/? | Displays help at the command prompt.

Remarks

All categories and subcategories can be specified by the GUID or name enclosed by quotation marks. Users can be specified by SID or name.

For all get operations for the per-user policy and system policy, you must have Read permission on that object set in the security descriptor. You can also perform get operations by possessing the Manage auditing and security log (SeSecurityPrivilege) user right. However, this right allows additional access that is not necessary to perform the get operation.

Examples

Examples for the per-user audit policy

To retrieve the per-user audit policy for the Guest account and display the output for the System, Detailed Tracking, and Object Access categories, type:

Copy Code
Auditpol /get /user:{S-1-5-21-1443922412-3030960370-963420232-51} /category:"System","Detailed Tracking","Object Access"
Note
This command is useful in two scenarios. When monitoring a specific user account for suspicious activity, you can use the /get command to retrieve the results in specific categories by using an inclusion policy to enable additional auditing. Or, if audit settings on an account are logging numerous but superfluous events, you can use the /get command to filter out extraneous events for that account with an exclusion policy. For a list of all categories, use the auditpol /list /category command.

To retrieve the per-user audit policy for a category and a particular subcategory, which reports the inclusive and exclusive settings for that subcategory under the System category for the Guest account, type:

Copy Code
Auditpol /get /user:guest /category:"System" /subcategory:{0ccee921a-69ae-11d9-bed3-505054503030}

To display the output in report format and include the machine name, policy target, subcategory, subcategory GUID, inclusion settings, and exclusion settings, type:

Copy Code
Auditpol /get /user:guest /category:Detailed Tracking" /r

Examples for the system audit policy

To retrieve the policy for the System category and subcategories, which reports the category and subcategory policy settings for the system audit policy, type:

Copy Code
Auditpol /get /category:"System" /subcategory:{0ccee921a-69ae-11d9-bed3-505054503030}

To retrieve the policy for the Detailed Tracking category and subcategories in report format and include the machine name, policy target, subcategory, subcategory GUID, inclusion settings, and exclusion settings, type:

Copy Code
Auditpol /get /category:"Detailed Tracking" /r

To retrieve the policy for two categories with the categories specified as GUIDs, which reports all the audit policy settings of all the subcategories under two categories, type:

Copy Code
Auditpol /get /category:{69979849-797a-11d9-bed3-505054503030},{69997984a-797a-11d9-bed3-505054503030} subcategory:{0ccee921a-69ae-11d9-bed3-505054503030}

Examples for auditing options

To retrieve the state, either enabled or disabled, of the AuditBaseObjects option, type:

Copy Code
Auditpol /get /option:AuditBaseObjects
Note
The available options are AuditBaseObjects, AuditBaseOperations, and FullPrivilegeAuditing.

To retrieve the state—enabled, disabled, or 2—of the CrashOnAuditFail option, type:

Copy Code
Auditpol /get /option:CrashOnAuditFail /r

Additional references

Command-Line Syntax Key


Auditpol set

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Sets the per-user audit policy, system audit policy, or auditing options.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
Auditpol /set
[/user[:<username>|<{sid}>][/include][/exclude]]
[/category:<name>|<{guid}>[,:<name|<{guid}>…]]
[/success:<enable>|<disable>][/failure:<enable>|<disable>]
[/subcategory:<name>|<{guid}>[,:<name|<{guid}>…]]
[/success:<enable>|<disable>][/failure:<enable>|<disable>]
[/option:<option name> /value: <enable>|<disable>]

Parameters

Parameter | Description
/user | The security principal for whom the per-user audit policy specified by the category or subcategory is set. Either the category or subcategory option must be specified, as a security identifier (SID) or name.
/include | Specified with /user; indicates that the user's per-user policy will cause an audit to be generated even if it is not specified by the system audit policy. This setting is the default and is automatically applied if neither the /include nor /exclude parameters are explicitly specified.
/exclude | Specified with /user; indicates that the user's per-user policy will cause an audit to be suppressed regardless of the system audit policy. This setting is ignored for users who are members of the local Administrators group.
/category | One or more audit categories specified by globally unique identifier (GUID) or name. If no user is specified, the system policy is set.
/subcategory | One or more audit subcategories specified by GUID or name. If no user is specified, the system policy is set.
/success | Specifies success auditing. This setting is the default and is automatically applied if neither the /success nor /failure parameters are explicitly specified. This setting must be used with a parameter indicating whether to enable or disable the setting.
/failure | Specifies failure auditing. This setting must be used with a parameter indicating whether to enable or disable the setting.
/option | Sets the audit policy for the CrashOnAuditFail, FullPrivilegeAuditing, AuditBaseObjects, or AuditBaseDirectories options.
/sd | Sets the security descriptor used to delegate access to the audit policy. The security descriptor must be specified by using the Security Descriptor Definition Language (SDDL). The security descriptor must have a discretionary access control list (DACL).
/? | Displays help at the command prompt.

Remarks

For all set operations for the per-user policy and system policy, you must have Write or Full Control permission on that object set in the security descriptor. You can also perform set operations by possessing the Manage auditing and security log (SeSecurityPrivilege) user right. However, this right allows additional access that is not necessary to perform the set operation.

Examples

Examples for the per-user audit policy

To set the per-user audit policy for all subcategories under the Detailed Tracking category for the user mikedan so that all the user's successful attempts will be audited, type:

Copy Code
Auditpol /set /user:mikedan /category:"Detailed Tracking" /include /success:enable

To set the per-user audit policy for categories specified by name and GUID, and subcategories specified by GUID to suppress auditing for any successful or failed attempts, type:

Copy Code
Auditpol /set /user:mikedan /exclude /category:"Object Access","System",{6997984b-797a-11d9-bed3-505054503030}
/subcategory:{0ccee9210-69ae-11d9-bed3-505054503030},:{0ccee9211-69ae-11d9-bed3-505054503030}, /success:enable /failure:enable

To set the per-user audit policy for the specified user for all the categories for the suppression of auditing of all but successful attempts, type:

Copy Code
Auditpol /set /user:mikedan /exclude /category:* /success:enable

Examples for the system audit policy

To set the system audit policy for all subcategories under the Detailed Tracking category to include auditing for only successful attempts, type:

Copy Code
Auditpol /set /category:"Detailed Tracking" /success:enable
Note
The failure setting is not altered.

To set the system audit policy for the Object Access and System categories (which is implied because subcategories are listed) and subcategories specified by GUIDs for the suppression of failed attempts and the auditing of successful attempts, type:

Copy Code
Auditpol /set /subcategory:{0ccee9210-69ae-11d9-bed3-505054503030},{0ccee9211-69ae-11d9-bed3-505054503030}, /failure:disable /success:enable

Example for auditing options

To set the auditing options to the enabled state for the CrashOnAuditFail option, type:

Copy Code
Auditpol /set /option:CrashOnAuditFail /value:enable

Additional references

Command-Line Syntax Key


Auditpol list

Applies To: Windows 7,Windows Vista,Windows Server 2008,Windows Server 2008 R2

Lists audit policy categories and/or subcategories, or lists users for whom a per-user audit policy is defined.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
auditpol /list
[/user|/category|subcategory[:<categoryname>|<{guid}>|*]]
[/v] [/r]

Parameters

Parameter | Description
/user | Retrieves all users for whom the per-user audit policy has been defined. If used with the /v parameter, the security identifier (SID) of the user is also displayed.
/category | Displays the names of categories understood by the system. If used with the /v parameter, the category globally unique identifier (GUID) is also displayed.
/subcategory | Displays the names of subcategories and their associated GUID.
/v | Displays the GUID with the category or subcategory, or when used with /user, displays the SID of each user.
/r | Displays the output as a report in comma-separated value (CSV) format.
/? | Displays help at the command prompt.

Remarks

For all list operations for the per-user policy, you must have Read permission on that object set in the security descriptor. You can also perform list operations by possessing the Manage auditing and security log (SeSecurityPrivilege) user right. However, this right allows additional access that is not necessary to perform the list operation.

Examples

To list all users who have a defined audit policy, type:

Copy Code
Auditpol /list /user

To list all users who have a defined audit policy and their associated SID, type:

Copy Code
Auditpol /list /user /v

To list all categories and subcategories in report format, type:

Copy Code
Auditpol /list /subcategory:* /r

To list the subcategories of the Detailed Tracking and DS Access categories, type:

Copy Code
Auditpol /list /subcategory:"Detailed Tracking","DS Access"

Additional references

Command-Line Syntax Key


Auditpol backup

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Backs up system audit policy settings, per-user audit policy settings for all users, and all auditing options to a comma-separated value (CSV) text file.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
Auditpol /backup /file:<filename>

Parameters

Parameter | Description
/file | Specifies the name of the file to which the audit policy will be backed up.
/? | Displays help at the command prompt.

Remarks

For backup operations for the per-user policy and system policy, you must have Write or Full Control permission on that object set in the security descriptor. You can also perform backup operations by possessing the Manage auditing and security log (SeSecurityPrivilege) user right. However, this right allows additional access that is not necessary to perform the list operation.

Examples

To back up per-user audit policy settings for all users, system audit policy settings, and all auditing options into a CSV-formatted text file named auditpolicy.csv, type:

Copy Code
Auditpol /backup /file:C\auditpolicy.csv
Note
If no drive is specified, the current directory is used.

Additional references

Command-Line Syntax Key

Auditpol restore


Auditpol restore

Applies To: Windows 7,Windows Vista,Windows Server 2008,Windows Server 2008 R2

Restores system audit policy settings, per-user audit policy settings for all users, and all auditing options from a file that is syntactically consistent with the comma-separated value (CSV) file format used by the /backup option.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
Auditpol /restore /file:<filename>

Parameters

Parameter | Description
/file | Specifies the file from which the audit policy should be restored. The file must have been created by using the /backup option or must be syntactically consistent with the CSV file format used by the /backup option.
/? | Displays help at the command prompt.

Remarks

For restore operations for the per-user policy and system policy, you must have Write or Full Control permission on that object set in the security descriptor. You can also perform the restore operation by possessing the Manage auditing and security log (SeSecurityPrivilege) user right. SeSecurityPrivilege is useful when restoring the security descriptor in the event of an inadvertent error or malicious attack.

Examples

To restore system audit policy settings, per-user audit policy settings for all users, and all auditing options from a file named Auditpolicy.csv that was created by using the /backup command, type:

Copy Code
Auditpol /restore /file:c:\auditpolicy.csv

Additional references

Command-Line Syntax Key

Auditpol backup


Auditpol clear

Applies To: Windows 7,Windows Vista,Windows Server 2008,Windows Server 2008 R2

Deletes the per-user audit policy for all users, resets (disables) the system audit policy for all subcategories, and sets all the auditing options to disabled.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
Auditpol /clear [/y]

Parameters

Parameter | Description
/y | Suppresses the prompt to confirm if all audit policy settings should be cleared.
/? | Displays help at the command prompt.

Remarks

For clear operations for the per-user policy and system policy, you must have Write or Full Control permission on that object set in the security descriptor. You can also perform the clear operation by possessing the Manage auditing and security log (SeSecurityPrivilege) user right. However, this right allows additional access that is not necessary to perform the clear operation.

Examples

To delete the per-user audit policy for all users, reset (disable) the system audit policy for all subcategories, and set all the audit policy settings to disabled, at a confirmation prompt, type:

Copy Code
Auditpol /clear

To delete the per-user audit policy for all users, reset the system audit policy settings for all subcategories, and set all the audit policy settings to disabled, without a confirmation prompt, type:

Copy Code
Auditpol /clear /y
Note
The preceding example is useful when using a script to perform this operation.

Additional references

Command-Line Syntax Key


Auditpol remove

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Removes the per-user audit policy for a specified account or all accounts.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
Auditpol /remove [/user[:<username>|<{SID}>]]
[/allusers]

Parameters

Parameter | Description
/user | Specifies the security identifier (SID) or user name for the user for whom the per-user audit policy is to be deleted.
/allusers | Removes the per-user audit policy for all users.
/? | Displays help at the command prompt.

Remarks

For remove operations for the per-user policy, you must have Write or Full Control permission on that object set in the security descriptor. You can also perform remove operations by possessing the Manage auditing and security log (SeSecurityPrivilege) user right. However, this right allows additional access that is not necessary to perform the remove operation.

Examples

To remove the per-user audit policy for user mikedan by name, type:

Copy Code
Auditpol /remove /user:mikedan

To remove the per-user audit policy for user mikedan by SID, type:

Copy Code
Auditpol /remove /user:{S-1-5-21-397123471-12346959}

To remove the per-user audit policy for all users, type:

Copy Code
Auditpol /remove /allusers

Additional references

Command-Line Syntax Key


Autochk

Applies To: Windows XP,Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows Server 2003,Windows Server 2000,Windows Server 2003 R2,Windows 7,Windows Server 2008 R2 with SP1

Runs when the computer is started and prior to Windows Server® 2008 R2 starting to verify the logical integrity of a file system.

Autochk.exe is a version of Chkdsk that runs only on NTFS disks and only before Windows Server 2008 R2 starts. Autochk cannot be run directly from the command-line. Instead, Autochk runs in the following situations:

  • If you try to run Chkdsk on the boot volume

  • If Chkdsk cannot gain exclusive use of the volume

  • If the volume is flagged as dirty

Remarks

  • Warning
    The Autochk command-line tool cannot be directly run from the command-line. Instead, use the Chkntfs command-line tool to configure the way you want Autochk to run at startup.

  • You can use Chkntfs with the /x parameter to prevent Autochk from running on a specific volume or multiple volumes.

  • Use the Chkntfs.exe command-line tool with the /t parameter to change the Autochk delay from 0 seconds to up to 3 days (259,200 seconds). However, a long delay means that the computer does not start until the time elapses or until you press a key to cancel Autochk.

Additional references

Command-Line Syntax Key

Chkdsk

Chkntfs

Troubleshooting Disks and File Systems


Autoconv

Applies To: Windows Server 2008 R2 with SP1,Windows 7,Windows Server 2003 R2,Windows Server 2000,Windows Server 2003,Windows Vista,Windows Server 2008,Windows Server 2008 R2,Windows XP

Converts file allocation table (FAT) and FAT32 volumes to the NTFS file system, leaving existing files and directories intact at startup after Autochk runs. Volumes converted to the NTFS file system cannot be converted back to FAT or FAT32.

Remarks

You cannot run Autoconv on the command-line. This will only be run at startup, if set through Convert.exe.

Additional references

Command-Line Syntax Key

Autochk

Convert

Working with File Systems


Autofmt

Applies To: Windows XP,Windows Server 2003 with SP1,Windows Server 2008,Windows Server 2003,Windows Server 2003 with SP2,Windows Server 2003 R2

Formats a drive or partition when called from the Windows Recovery Console.

Remarks

You cannot run Autofmt directly from the command-line.

Additional references

Command-Line Syntax Key

Working with File Systems


Bcdboot

Applies To: Windows 7,Windows Server 2008 R2

Enables you to quickly set up a system partition, or to repair the boot environment located on the system partition. The system partition is set up by copying a simple set of Boot Configuration Data (BCD) files to an existing empty partition.

For more information about BCDboot, including information on where to find BCDboot and examples of how to use this command, see the BCDBoot Command-Line Options topic.

Syntax

Copy Code
bcdboot <source> [/l] [/s]

Parameters

Parameter | Description
source | Specifies the location of the Windows directory to use as the source for copying boot environment files.
/l | Specifies the locale. The default locale is US English.
/s | Specifies the volume letter of the system partition. The default is the system partition identified by the firmware.

Examples

For more examples of how to use this command, see the BCDBoot Command-Line Options topic.

Additional references

Command-Line Syntax Key


Bcdedit

Applies To: Windows Server 2008,Windows Vista

Boot Configuration Data (BCD) files provide a store that is used to describe boot applications and boot application settings. The objects and elements in the store effectively replace Boot.ini.

BCDEdit is a command-line tool for managing BCD stores. It can be used for a variety of purposes, including creating new stores, modifying existing stores, adding boot menu parameters, and so on. BCDEdit serves essentially the same purpose as Bootcfg.exe on earlier versions of Windows, but with two major improvements:

  • Exposes a wider range of boot parameters than Bootcfg.exe.

  • Has improved scripting support.

Note
Administrative privileges are required to use BCDEdit to modify BCD.

BCDEdit is the primary tool for editing the boot configuration of Windows Vista and later versions of Windows. It is included with the Windows Vista distribution in the %WINDIR%\System32 folder.

BCDEdit is limited to the standard data types and is designed primarily to perform single common changes to BCD. For more complex operations or nonstandard data types, consider using the BCD Windows Management Instrumentation (WMI) application programming interface (API) to create more powerful and flexible custom tools.

Syntax

Copy Code
BCDEdit /Command [<Argument1>] [<Argument2>] ...

Parameters

General BCDEdit Command-Line Option

Option | Description
/? | Displays a list of BCDEdit commands. Running this command without an argument displays a summary of the available commands. To display detailed help for a particular command, run bcdedit /? <command>, where <command> is the name of the command you are searching for more information about. For example, bcdedit /? createstore displays detailed help for the Createstore command.

Parameters that Operate on a Store

Option | Description
/createstore | Creates a new empty boot configuration data store. The created store is not a system store.
/export | Exports the contents of the system store into a file. This file can be used later to restore the state of the system store. This command is valid only for the system store.
/import | Restores the state of the system store by using a backup data file previously generated by using the /export option. This command deletes any existing entries in the system store before the import takes place. This command is valid only for the system store.
/store | This option can be used with most BCDedit commands to specify the store to be used. If this option is not specified, then BCDEdit operates on the system store. Running the bcdedit /store command by itself is equivalent to running the bcdedit /enum active command.

Parameters that Operate on Entries in a Store

Parameter | Description
/copy | Makes a copy of a specified boot entry in the same system store.
/create | Creates a new entry in the boot configuration data store. If a well-known identifier is specified, then the /application, /inherit, and /device parameters cannot be specified. If an identifier is not specified or not well known, an /application, /inherit, or /device option must be specified.
/delete | Deletes an element from a specified entry.

Parameters that Operate on Entry Options

Parameter | Description
/deletevalue | Deletes a specified element from a boot entry.
/set | Sets an entry option value.

Parameters that Control Output

Parameter | Description
/enum | Lists entries in a store. The /enum option is the default value for BCEdit, so running the bcdedit command without parameters is equivalent to running the bcdedit /enum active command.
/v | Verbose mode. Usually, any well-known entry identifiers are represented by their friendly shorthand form. Specifying /v as a command-line option displays all identifiers in full. Running the bcdedit /v command by itself is equivalent to running the bcdedit /enum active /v command.

Parameters that Control the Boot Manager

Parameter | Description
/bootsequence | Specifies a one-time display order to be used for the next boot. This command is similar to the /displayorder option, except that it is used only the next time the computer starts. Afterwards, the computer reverts to the original display order.
/default | Specifies the default entry that the boot manager selects when the timeout expires.
/displayorder | Specifies the display order that the boot manager uses when displaying boot parameters to a user.
/timeout | Specifies the time to wait, in seconds, before the boot manager selects the default entry.
/toolsdisplayorder | Specifies the display order for the boot manager to use when displaying the Tools menu.

Parameters that Control Emergency Management Services

Parameter | Description
/bootems | Enables or disables Emergency Management Services (EMS) for the specified entry.
/ems | Enables or disables EMS for the specified operating system boot entry.
/emssettings | Sets the global EMS settings for the computer. /emssettings does not enable or disable EMS for any particular boot entry.

Parameters that Control Debugging

Parameter | Description
/bootdebug | Enables or disables the boot debugger for a specified boot entry. Although this command works for any boot entry, it is effective only for boot applications.
/dbgsettings | Specifies or displays the global debugger settings for the system. This command does not enable or disable the kernel debugger; use the /debug option for that purpose. To set an individual global debugger setting, use the bcdedit /set <dbgsettings> <type> <value> command.
/debug | Enables or disables the kernel debugger for a specified boot entry.

Examples

For examples of BCDEdit, see the Windows Hardware Developer Center Web site.


Bitsadmin

Applies To: Windows Server 2008,Windows Vista

BITSAdmin is a command-line tool that you can use to create download or upload jobs and monitor their progress.

Commands

Bitsadmin /addfile

Bitsadmin /addfileset

Bitsadmin /addfilewithranges

Bitsadmin /cancel

Bitsadmin /complete

Bitsadmin /create

Bitsadmin /getaclflags

Bitsadmin /getbytestotal

Bitsadmin /getbytestransferred

Bitsadmin /getcompletiontime

Bitsadmin /getcreationtime

Bitsadmin /getdescription

Bitsadmin /getdisplayname

Bitsadmin /geterror

Bitsadmin /geterrorcount

Bitsadmin /getfilestotal

Bitsadmin /getfilestransferred

Bitsadmin /getminretrydelay

Bitsadmin /getmodificationtime

Bitsadmin /getnoprogresstimeout

Bitsadmin /getnotifycmdline

Bitsadmin /getnotifyflags

Bitsadmin /getnotifyinterface

Bitsadmin /getowner

Bitsadmin /getpriority

Bitsadmin /getproxybypasslist

Bitsadmin /getproxylist

Bitsadmin /getproxyusage

Bitsadmin /getreplydata

Bitsadmin /getreplyfilename

Bitsadmin /getreplyprogress

Bitsadmin /getstate

Bitsadmin /gettype

Bitsadmin /help

Bitsadmin /info

Bitsadmin /list

Bitsadmin /listfiles

Bitsadmin /monitor

Bitsadmin /nowrap

Bitsadmin /rawreturn

Bitsadmin /removecredentials

Bitsadmin /replaceremoteprefix

Bitsadmin /reset

Bitsadmin /resume

Bitsadmin /setaclflag

Bitsadmin /setcredentials

Bitsadmin /setdescription

Bitsadmin /setdisplayname

Bitsadmin /setminretrydelay

Bitsadmin /setnoprogresstimeout

Bitsadmin /setnotifycmdline

Bitsadmin /setnotifyflags

Bitsadmin /setpriority

Bitsadmin /setproxysettings

Bitsadmin /setreplyfilename

Bitsadmin /suspend

Bitsadmin /takeownership

Bitsadmin /transfer

Bitsadmin /util

Bitsadmin /wrap


Bitsadmin /addfile

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista

Adds a file to the specified job.

Syntax

Copy Code
bitsadmin /AddFile <Job> <RemoteURL> <LocalName>

Parameters

Parameter | Description
Job | The job's display name or GUID
RemoteURL | The URL of the file on the server.
LocalName | The name of the file on the local computer. LocalName must contain an absolute path to the file.

Examples

Add a file to the job. Repeat this call for each file you want to add. If multiple jobs use myDownloadJob as their name, you must replace myDownloadJob with the job's GUID to uniquely identify the job.

Copy Code
C:\>bitsadmin /addfile myDownloadJob http://downloadsrv/10mb.zip c:\10mb.zip

Additional references

Command-Line Syntax Key


Bitsadmin /addfileset

Applies To: Windows Vista,Windows Server 2008,Windows Server 2008 R2

Adds one or more files to the specified job.

Syntax

Copy Code
bitsadmin /addfileset <Job> <TextFile>

Parameters

Parameter Description

Job

The job's display name or GUID

TextFile

A text file containing remote and local file names.

Note
The names are space-delimited. Lines that begin with a # character are treated as a comment.

Examples

Copy Code
C:\>bitsadmin /addfileset files.txt

Additional references

Command-Line Syntax Key


Bitsadmin /addfilewithranges

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista

Adds a file to the specified job. BITS downloads the specified ranges from the remote file.

Syntax

Copy Code
bitsadmin /AddFileWithRanges <Job> <RemoteURL> <LocalName> <RangeList>

Parameters

Parameter | Description
Job | The job's display name or GUID
RemoteURL | RemoteURL is the URL of the file on the server.
LocalName | LocalName is the name of the file on the local computer. LocalName must contain an absolute path to the file.
RangeList | RangeList is a comma-delimited list of offset and length pairs. Use a colon to separate the offset value from the length value.

More Information

  • The token eof is a valid length value within the offset and length pairs in the <RangeList>. It instructs the service to read to the end of the specified file.

  • Note that AddFileWithRanges will fail with error code 0x8020002c when a zero-length range is specified along with another range with same offset, such as: C:\bits>bitsadmin /addfilewithranges j2 http://bitsdc/dload/1k.zip c:\1k.zip 100:0,100:5

    Error message: Unable to add file to job - 0x8020002c. The list of byte ranges contains some overlapping ranges, which are not supported.

    Workaround: do not specify the zero-length range first. For example: bitsadmin /addfilewithranges j2 http://bitsdc/dload/1k.zip c:\1k.zip 100:5,100:0.

Examples

The following example tells BITS to transfer 100 bytes from offset 0, 100 bytes from offset 2000, and the remaining bytes from offset 5000 to the end of the file.

Copy Code
C:\>bitsadmin /addfilewithranges http://downloadsrv/10mb.zip c:\10mb.zip "0:100,2000:100,5000:eof"

Additional references

Command-Line Syntax Key


Bitsadmin /cache

Applies To: Windows Server 2008,Windows Server 2008 R2

Syntax

Copy Code
Bitsadmin /Cache /Help
Bitsadmin /Cache /Clear
Bitsadmin /Cache /Delete
Bitsadmin /Cache /DeleteURL
Bitsadmin /Cache /List
Bitsadmin /Cache /Info
Bitsadmin /Cache /GetLimit
Bitsadmin /Cache /SetLimit
Bitsadmin /Cache /GetExpirationTime
Bitsadmin /Cache /SetExpirationTime

Parameters

Parameter | Description
Bitsadmin /cache /help | Displays the command-line usage for the /Cache commands.
Bitsadmin /cache /clear | Purges the local cache.
Bitsadmin /cache /delete | Deletes a cache entry.
Bitsadmin /cache /deleteurl | Deletes all cache entries for the given URL.
Bitsadmin /cache /list | Lists all cache entries.
Bitsadmin /cache /info | Dumps a specific cache entry.
Bitsadmin /cache /getlimit | Retrieves the cache limit.
Bitsadmin /cache /setlimit | Sets the cache limit.
Bitsadmin /cache /getexpirationtime | Retrieves the cache expiration time.
Bitsadmin /cache /setexpirationtime | Sets the cache expiration time.

Additional references

Command-Line Syntax Key


Bitsadmin /cache /clear

Applies To: Windows Server 2008 R2,Windows Server 2008

Purges the local cache.

Syntax

Copy Code
bitsadmin /Cache /Clear

Examples

The following example purges the local cache.

Copy Code
C:\>bitsadmin /Cache /Clear

Additional references

Command-Line Syntax Key


Bitsadmin /cache /delete

Applies To: Windows Server 2008,Windows Server 2008 R2

Deletes a specific cache entry.

Syntax

Copy Code
bitsadmin /Cache /Delete RecordID

Parameters

Parameter | Description
RecordID | The GUID associated with the cache entry.

Examples

The following example deletes the cache entry with the RecordID of {6511FB02-E195-40A2-B595-E8E2F8F47702}.

Copy Code
C:\>bitsadmin /Cache /Delete {6511FB02-E195-40A2-B595-E8E2F8F47702}

Additional references

Command-Line Syntax Key


Bitsadmin /cache /deleteurl

Applies To: Windows Server 2008 R2,Windows Server 2008

Deletes all cache entries for the given URL.

Syntax

Copy Code
bitsadmin /DeleteURL url

Parameters

Parameter | Description
url | The Uniform Resource Locator that identifies a remote file.

Examples

The following example deletes all cache entries for http://www.microsoft.com/en/us/default.aspx

Copy Code
C:\>bitsadmin /DeleteURL http://www.microsoft.com/en/us/default.aspx

Additional references

Command-Line Syntax Key


Bitsadmin /cache /list

Applies To: Windows Server 2008,Windows Server 2008 R2

Lists all cache entries.

Syntax

Copy Code
bitsadmin /Cache /List [/Verbose]

Examples

The following example lists all cache entries in verbose format.

Copy Code
C:\> bitsadmin /Cache /List /Verbose

Additional references

Command-Line Syntax Key


Bitsadmin /cache /info

Applies To: Windows Server 2008 R2,Windows Server 2008

Dumps a specific cache entry.

Syntax

Copy Code
bitsadmin /Cache /Info RecordID [/Verbose]

Parameters

Parameter | Description
RecordID | The GUID associated with the cache entry.

Examples

The following example dumps the cache entry with the RecordID of {6511FB02-E195-40A2-B595-E8E2F8F47702}.

Copy Code
C:\>bitsadmin /Cache /Info {6511FB02-E195-40A2-B595-E8E2F8F47702}

Additional references

Command-Line Syntax Key


Bitsadmin /cache /getlimit

Applies To: Windows Server 2008 R2,Windows Server 2008

Retrieves the cache limit.

Syntax

Copy Code
bitsadmin /Cache /GetLimit

Examples

The following example retrieves the cache limit..

Copy Code
C:\>bitsadmin /Cache /GetLimit

Additional references

Command-Line Syntax Key


Bitsadmin /cache /setlimit

Applies To: Windows Server 2008,Windows Server 2008 R2

Sets the cache size limit.

Syntax

Copy Code
bitsadmin /Cache /SetLimit Percent

Parameters

Parameter | Description
Percent | The cache limit defined as a percentage of the total hard disk space..

Examples

The following example limits the cache size to 50%.

Copy Code
C:\>bitsadmin /Cache /SetLimit 50

Additional references

Command-Line Syntax Key


Bitsadmin /cache /getexpirationtime

Applies To: Windows Server 2008,Windows Server 2008 R2

Retrieves the cache expiration time.

Syntax

Copy Code
bitsadmin /Cache /GetExpirationTime

Examples

The following retrieves the cache expiration time.

Copy Code
C:\>bitsadmin /Cache /GetExpirationTime

Additional references

Command-Line Syntax Key


Bitsadmin /cache /setexpirationtime

Applies To: Windows Server 2008 R2,Windows Server 2008

Sets the cache expiration time.

Syntax

Copy Code
bitsadmin /Cache /SetExpirationTime secs

Parameters

Parameter | Description
secs | The number of seconds until the cache expires.

Examples

The following example expires the cache in 60 seconds.

Copy Code
C:\>bitsadmin /Cache / SetExpirationTime 60

Additional references

Command-Line Syntax Key


Bitsadmin /cache /help

Applies To: Windows Server 2008,Windows Server 2008 R2

Displays the command-line usage for the Cache commands.

Syntax

Copy Code
Bitsadmin /Cache /Help

Examples

The following command displays the command-line help for the Cache commands.

Copy Code
Bitsadmin /Cache /Help

Additional references

Command-Line Syntax Key


Bitsadmin /cancel

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista

Removes the job from the transfer queue and deletes all temporary files associated with the job.

Syntax

Copy Code
bitsadmin /cancel <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Examples

The following example removes the myDownloadJob job from the transfer queue.

Copy Code
C:\>bitsadmin /cancel myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /complete

Applies To: Windows Vista,Windows Server 2008,Windows Server 2008 R2

Completes the job. The downloaded files are not available to you until you use this switch. Use this switch after the job moves to the transferred state. Otherwise, only those files that have been successfully transferred are available.

Syntax

Copy Code
bitsadmin /complete <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Examples

When the state of the job is TRANSFERRED, BITS has successfully transferred all files in the job. However, the files are not available until you use the /complete switch. If multiple jobs use myDownloadJob as their name, you must replace myDownloadJob with the job's GUID to uniquely identify the job.

Copy Code
C:\>bitsadmin /complete myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /create

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista

Creates a transfer job with the given display name.

Syntax

Copy Code
bitsadmin /create [Type] DisplayName

Parameters

Parameter Description

Type
  • /Download—transfers data from a server to a local file.

  • /Upload—transfers data from a local file to a server.

  • /Upload-Reply—transfers data from a local file to a server and receives a reply file from the server.

  • This parameter defaults to /Download when not specified on the command line.

DisplayName

The display name assigned to the newly created job.

Use the Bitsadmin /resume switch to activate the job in the transfer queue.

Examples

Creates a download job named myDownloadJob.

Copy Code
C:\>bitsadmin /create myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /getaclflags

Applies To: Windows Vista,Windows Server 2008,Windows Server 2008 R2

Retrieves the access control list propagations flags.

Syntax

Copy Code
bitsadmin /GetAclFlags <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Remarks

Displays one or more of the following flag values:

  • O: Copy owner information with file.

  • G: Copy group information with file.

  • D: Copy DACL information with file.

  • S: Copy SACL information with file.

Examples

The following example retrieves the access control list propagation flags for the job named myDownloadJob.

Copy Code
C:\>bitsadmin /getaclflags myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /getbytestotal

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista

Retrieves the size of the specified job

Syntax

Copy Code
bitsadmin /GetBytesTotal <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Examples

The following example retrieves the size of the job named myDownloadJob.

Copy Code
C:\>bitsadmin /GetBytesTotal myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /getbytestransferred

Applies To: Windows Vista,Windows Server 2008,Windows Server 2008 R2

Retrieves the number of bytes transferred for the specified job.

Syntax

Copy Code
bitsadmin /GetBytesTransferred <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Examples

The following example retrieves the number of bytes transferred for the job named myDownloadJob.

Copy Code
C:\>bitsadmin /GetBytesTransferred myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /getclientcertificate

Applies To: Windows Server 2008 R2,Windows Server 2008

Retrieves the client certificate from the job.

Syntax

Copy Code
bitsadmin /GetClientCertificate <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Examples

The following example retrieves the client certificate for the job named myDownloadJob.

Copy Code
C:\>bitsadmin / GetClientCertificate myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /getcompletiontime

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Vista

Retrieves the time that the job finished transferring data.

Syntax

Copy Code
bitsadmin /GetCompletionTime <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Examples

The following example retrieves the time that the job named myDownloadJob finished transferring data.

Copy Code
C:\>bitsadmin /GetCompletionTime myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /getcustomheaders

Applies To: Windows Server 2008,Windows Server 2008 R2

Retrieves the custom HTTP headers from the job.

Syntax

Copy Code
bitsadmin /GetCustomHeaders <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Examples

The following example gets the custom headers for the job named myDownloadJob.

Copy Code
C:\>bitsadmin /GetCustomHeaders myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /getcreationtime

Applies To: Windows Vista,Windows Server 2008 R2,Windows Server 2008

Retrieves the creation time for the specified job.

Syntax

Copy Code
bitsadmin /GetCreationTime <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Examples

The following example retrieves the creation time for the job named myDownloadJob.

Copy Code
C:\>bitsadmin /GetCreationTime myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /getdescription

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista

Retrieves the description of the specified job.

Syntax

Copy Code
bitsadmin /GetDescription <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Examples

The following example retrieves the description for the job named myDownloadJob.

Copy Code
C:\>bitsadmin /GetDescription myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /getdisplayname

Applies To: Windows Vista,Windows Server 2008,Windows Server 2008 R2

Retrieves the display name of the specified job.

Syntax

Copy Code
bitsadmin /GetDisplayName <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Examples

The following example retrieves the display name for the job named myDownloadJob.

Copy Code
C:\>bitsadmin /GetDisplayName myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /geterror

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista

Retrieves detailed error information for the specified job.

Syntax

Copy Code
bitsadmin /GetError <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Examples

The following example retrieves the error information for the job named myDownloadJob.

Copy Code
C:\>bitsadmin /GetError myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /geterrorcount

Applies To: Windows Vista,Windows Server 2008,Windows Server 2008 R2

Retrieves a count of the number of times the specified job generated a transient error.

Syntax

Copy Code
bitsadmin /GetErrorCount <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Examples

The following example retrieves error count information for the job named myDownloadJob.

Copy Code
C:\>bitsadmin /GetErrorCount myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /getfilestotal
See Also

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista

Retrieves the number of files in the specified job.

Syntax

Copy Code
bitsadmin /GetFilesTotal <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Examples

The following example retrieves the number of files included in the job named myDownloadJob.

Copy Code
C:\>bitsadmin /GetFilesTotal myDownloadJob

See Also

Concepts

Command-Line Syntax Key


Bitsadmin /getfilestransferred

Applies To: Windows Vista,Windows Server 2008,Windows Server 2008 R2

Retrieves the number of files transferred for the specified job.

Syntax

Copy Code
bitsadmin /GetFilesTransferred <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Examples

The following example retrieves the number of files transferred in the job named myDownloadJob.

Copy Code
C:\>bitsadmin /GetFilesTransferred myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /getmaxdownloadtime

Applies To: Windows Server 2008 R2,Windows Server 2008

Retrieves the download timeout in seconds.

Syntax

Copy Code
bitsadmin /GetMaxDownloadTime <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Remarks

  • N/A

Examples

The following example gets maximum download time for the job named myDownloadJob in seconds.

Copy Code
C:\>bitsadmin /GetMaxDownloadTime myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /getminretrydelay

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Vista

Retrieves the length of time, in seconds, that the service waits after encountering a transient error before trying to transfer the file.

Syntax

Copy Code
bitsadmin /GetMinRetryDelay <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Examples

The following example retrieves the minimum retry delay for the job named myDownloadJob.

Copy Code
C:\>bitsadmin /GetMinRetryDelay myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /getmodificationtime

Applies To: Windows Vista,Windows Server 2008 R2,Windows Server 2008

Retrieves the last time the job was modified or data was successfully transferred.

Syntax

Copy Code
bitsadmin /GetModificationTime <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Examples

The following example retrieves the last modified time for the job named myDownloadJob.

Copy Code
C:\>bitsadmin /GetModificationTime myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /getnoprogresstimeout

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Vista

Retrieves the length of time, in seconds, that the service tries to transfer the file after a transient error occurs.

Syntax

Copy Code
bitsadmin /GetNoProgressTimeout <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Examples

The following example retrieves the progress time out value for the job named myDownloadJob.

Copy Code
C:\>bitsadmin /GetNoProgressTimeout myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /getnotifycmdline

Applies To: Windows Vista,Windows Server 2008 R2,Windows Server 2008

Retrieves the command-line command that is ran when the job finishes transferring data.

Syntax

Copy Code
bitsadmin /GetNotifyCmdLine <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Examples

The following example retrieves the command-line command used by the service when the job named myDownloadJob completes.

Copy Code
C:\>bitsadmin /GetNotifyCmdLine myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /getnotifyflags

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Vista

Retrieves the notify flags for the specified job.

Syntax

Copy Code
bitsadmin /GetNotifyFlags <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Remarks

The job can contain one or more of the following notification flags.

0x001 | Generate an event when all files in the job have been transferred.
0x002 | Generate an event when an error occurs.
0x004 | Disable notifications.
0x008 | Generate an event when the job is modified or transfer progress is made.

Examples

The following example retrieves the notify flags for the job named myDownloadJob.

Copy Code
C:\>bitsadmin /GetNotifyFlags myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /getnotifyinterface

Applies To: Windows Vista,Windows Server 2008 R2,Windows Server 2008

Determines if another program has registered a COM callback interface for the specified job.

Syntax

Copy Code
bitsadmin /GetNotifyInterface <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Remarks

Displays REGISTERED or UNREGISTERED.

Note
It is not possible to determine the program that registered the callback interface.

Examples

The following example retrieves the notify interface for the job named myDownloadJob.

Copy Code
C:\>bitsadmin /GetNotifyInterface myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /getowner

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Vista

Retrieves the owner of the specified job.

Syntax

Copy Code
bitsadmin /GetOwner <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Examples

The following example displays the owner for the job named myDownloadJob.

Copy Code
C:\>bitsadmin /GetOwner myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /getpeercachingflags

Applies To: Windows Server 2008 R2,Windows Server 2008

Retrieves flags that determine if the files of the job can be cached and served to peers, and if BITS can download content for the job from peers.

Syntax

Copy Code
bitsadmin /GetPeerCachingFlags <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Examples

The following example retrieves the flags for the job named myJob.

Copy Code
C:\>bitsadmin /GetPeerCachingFlags myJob

Additional references

Command-Line Syntax Key


Bitsadmin /getpriority

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Vista

Retrieves the priority of the specified job.

Syntax

Copy Code
bitsadmin /GetPriority <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Remarks

  • The priority is either FOREGROUND, HIGH, NORMAL, LOW, or UNKNOWN.

Examples

The following example retrieves the priority for the job named myDownloadJob.

Copy Code
C:\>bitsadmin /GetPriority myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /getproxybypasslist

Applies To: Windows Vista,Windows Server 2008 R2,Windows Server 2008

Retrieves the proxy bypass list for the specified job.

Syntax

Copy Code
bitsadmin /GetProxyBypassList <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Remarks

  • The bypass list contains the host names or IP addresses, or both, that are not to be routed through a proxy. The list can contain "<local>" to refer to all servers on the same LAN. The list can be semicolon or space-delimited.

Examples

The following example retrieves the proxy bypass list for the job named myDownloadJob.

Copy Code
C:\>bitsadmin /GetProxyBypassList myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /getproxylist

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Vista

Retrieves the proxy list for the specified job.

Syntax

Copy Code
bitsadmin /GetProxyList <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Remarks

  • The proxy list is the list of proxy servers to use. The list is comma-delimited.

Examples

The following example retrieves the proxy list for the job named myDownloadJob.

Copy Code
C:\>bitsadmin /GetProxyList myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /getproxyusage

Applies To: Windows Vista,Windows Server 2008 R2,Windows Server 2008

Retrieves the proxy usage setting for the specified job.

Syntax

Copy Code
bitsadmin /GetProxyUsage <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Remarks

The possible values are:

  • PRECONFIG—use the owner's Internet Explorer defaults.

  • NO_PROXY—do not use a proxy server.

  • OVERRIDE—Use an explicit proxy list.

  • AUTODETECT—Automatically detect the proxy settings.

Examples

The following example retrieves the proxy usage for the job named myDownloadJob.

Copy Code
C:\>bitsadmin /GetProxyUsage myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /getreplydata

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Vista

Retrieves the server's reply data in hexadecimal format.

Syntax

Copy Code
bitsadmin /GetReplyData <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Remarks

Valid only for upload-reply jobs.

Examples

The following example retrieves the reply data for the job named myDownloadJob.

Copy Code
C:\>bitsadmin /GetReplyData myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /getreplyfilename

Applies To: Windows Vista,Windows Server 2008 R2,Windows Server 2008

Gets the path of the file that contains the server reply.

Syntax

Copy Code
bitsadmin /GetReplyFileName <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Remarks

Valid only for upload-reply jobs.

Examples

The following example retrieves the reply filename for the job named myDownloadJob.

Copy Code
C:\>bitsadmin /GetReplyFileName myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /getreplyprogress

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Vista

Retrieves the size and progress of the server reply.

Syntax

Copy Code
bitsadmin /GetReplyProgress <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Remarks

Valid only for upload-reply jobs.

Examples

The following example retrieves the reply progress for the job named myDownloadJob.

Copy Code
C:\>bitsadmin /GetReplyProgress myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /getsecurityflags

Applies To: Windows Server 2008 R2,Windows Server 2008

Reports the HTTP security flags for URL redirection and checks performed on the server certificate during the transfer.

Syntax

Copy Code
bitsadmin /GetSecurityFlags <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Examples

The following example retrieves the securitly flags from a job named myJob.

Copy Code
C:\>bitsadmin /GetSecurityFlags myJob

Additional references

Command-Line Syntax Key


Bitsadmin /getstate

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Vista

Retrieves the state of the specified job.

Syntax

Copy Code
bitsadmin /GetState <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Remarks

The possible states are:

QUEUED | The job is waiting to run.
CONNECTING | BITS is contacting the server.
TRANSFERRING | BITS is transferring data.
SUSPENDED | The job is paused.
ERROR | A non-recoverable error occurred; the transfer will not be retried.
TRANSIENT_ERROR | A recoverable error occurred; the transfer retries when the minimum retry delay expires.
ACKNOWLEDGED | The job was completed.
CANCELLED | The job was canceled.

Examples

The following example retrieves the state for the job named myDownloadJob.

Copy Code
C:\>bitsadmin /GetState myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /gettemporaryname

Applies To: Windows Server 2008 R2,Windows Server 2008

Reports the temporary filename of the given file within the job.

Syntax

Copy Code
bitsadmin /GetTemporaryName <Job> <file index>

Parameters

Parameter | Description
Job | The job's display name or GUID
File index | Starts from 0

Examples

The following example reports the temporary filename of file 2 for the job named myJob.

Copy Code
C:\>bitsadmin /GetTemporaryName myJob 1

Additional references

Command-Line Syntax Key


Bitsadmin /gettype

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Vista

Retrieves the job type of the specified job.

Syntax

Copy Code
bitsadmin /GetType <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Remarks

The type can be DOWNLOAD, UPLOAD, UPLOAD-REPLY, or UNKNOWN.

Examples

The following example retrieves the job type for the job named myDownloadJob.

Copy Code
C:\>bitsadmin /GetType myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /getvalidationstate

Applies To: Windows Server 2008 R2,Windows Server 2008

Reports the content validation state of the given file within the job.

Syntax

Copy Code
bitsadmin /GetValidationState <Job> <file index>

Parameters

Parameter | Description
Job | The job's display name or GUID
File index | Starts from 0

Examples

The following example gets the content validation state of file 2 within the job named myJob.

Copy Code
C:\>bitsadmin /GetValidationState myJob 1

Additional references

Command-Line Syntax Key


Bitsadmin /help

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Vista

Displays the command-line usage.

Syntax

Copy Code
bitsadmin /help | /?

Examples

The following example retrieves the command-line help.

Copy Code
C:\>bitsadmin /help

Additional references

Command-Line Syntax Key


Bitsadmin /info

Applies To: Windows Vista,Windows Server 2008 R2,Windows Server 2008

Displays summary information about the specified job.

Syntax

Copy Code
bitsadmin /Info <Job> [/verbose]

Parameters

Parameter | Description
Job | The job's display name or GUID

Remarks

Use the /verbose parameter to provide detailed information about the job.

Examples

The following example retrieves information about the job named myDownloadJob.

Copy Code
C:\>bitsadmin /Info myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /list

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Vista

Lists the transfer jobs owned by the current user.

Syntax

Copy Code
bitsadmin /List [/allusers][/verbose]

Parameters

Parameter | Description
/Allusers | Optional—lists jobs for all users
/Verbose | Optional—provides detail information for each job.

Remarks

You must have administrator privileges to use the /allusers parameter

Examples

The following example retrieves information about jobs owned by the current user.

Copy Code
C:\>bitsadmin /List

Additional references

Command-Line Syntax Key


Bitsadmin /listfiles

Applies To: Windows Vista,Windows Server 2008 R2,Windows Server 2008

Lists the files in the specified job.

Syntax

Copy Code
bitsadmin /ListFiles <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Examples

The following example retrieves the list of files for the job named myDownloadJob.

Copy Code
C:\>bitsadmin /GetNotifyFlags myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /monitor

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Vista

Monitors jobs in the transfer queue that the current user owns.

Syntax

Copy Code
bitsadmin /Monitor [/allusers] [/refresh <Seconds>]

Parameters

Parameter | Description
Allusers | Optional—monitors jobs for all users
Refresh | Optional—refreshes the data at an interval specified by Seconds. The default refresh interval is five seconds.

Remarks

  • You must have administrator privileges to use the Allusers parameter.

  • Use CTRL+C to stop the refresh.

Examples

The following example monitors the transfer queue for jobs owned by the current user and refreshes the information every 60 seconds.

Copy Code
C:\>bitsadmin /Monitor /refesh 60

Additional references

Command-Line Syntax Key


Bitsadmin /nowrap

Applies To: Windows Vista,Windows Server 2008 R2,Windows Server 2008

Truncates any line of output text extending beyond the rightmost edge of the command window.

Syntax

Copy Code
bitsadmin /NoWrap

Remarks

By default, all commands, except the Monitor command, wrap the output. Specify the NoWrap command before other commands.

Examples

The following example retrieves the state for the job named myDownloadJob and does not wrap the output

Copy Code
C:\>bitsadmin /NoWrap /GetState myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /peers

Applies To: Windows Server 2008,Windows Server 2008 R2

Copy Code
Bitsadmin /Peers /Help
Bitsadmin /Peers /Discover
Bitsadmin /Peers /Clear
Bitsadmin /Peers /List

Parameters

Parameter | Description
Bitsadmin /peers /help | Displays the command-line usage for the /Peers commands.
Bitsadmin /peers /discover | Discovers peers again.
Bitsadmin /peers /clear | Clears the peers list.
Bitsadmin /peers /list | List all peers.

Additional references

Command-Line Syntax Key


Bitsadmin /peers /list

Applies To: Windows Server 2008,Windows Server 2008 R2

Lists all peers.

Syntax

Copy Code
bitsadmin /Peers /List

Examples

The following example lists all peers.

Copy Code
C:\>bitsadmin /Peers /List

Additional references

Command-Line Syntax Key


Bitsadmin /peers /clear

Applies To: Windows Server 2008 R2,Windows Server 2008

Clears the peer list.

Syntax

Copy Code
bitsadmin /Peers /Clear

Examples

The following example clears the peer list.

Copy Code
C:\>bitsadmin /Peers /Clear

Additional references

Command-Line Syntax Key


Bitsadmin /peers /discover

Applies To: Windows Server 2008,Windows Server 2008 R2

Discovers peers again.

Syntax

Copy Code
bitsadmin /Peers /Discover

Examples

The following example discovers peers.

Copy Code
C:\>bitsadmin /Peers /Discover

Additional references

Command-Line Syntax Key


Bitsadmin /peers /help

Applies To: Windows Server 2008 R2,Windows Server 2008

Displays the command-line usage for the Peers commands.

Syntax

Copy Code
Bitsadmin /Peers /Help

Examples

The following command displays the command-line help for the Peers commands.

Copy Code
Bitsadmin /Peers /Help

Additional references

Command-Line Syntax Key


Bitsadmin /peercaching

Applies To: Windows Server 2008,Windows Server 2008 R2

Syntax

Copy Code
Bitsadmin /PeerCaching /Help
Bitsadmin /PeerCaching /SetConfigurationFlags
Bitsadmin /PeerCaching /GetConfigurationFlags

Parameters

Parameter | Description
Bitsadmin /peercaching /help | Displays the command-line usage for the /PeerCaching commands.
Bitsadmin /peercaching /setconfigurationflags | Sets the configuration flags that determine if the computer can serve content to peers and can download content from peers.
Bitsadmin /peercaching /getconfigurationflags | Gets the configuration flags that determine if the computer serves content to peers and can download content from peers.

Additional references

Command-Line Syntax Key


Bitsadmin /peercaching /getconfigurationflags

Applies To: Windows Server 2008 R2,Windows Server 2008

Gets the configuration flags that determine if the computer serves content to peers and can download content from peers.

Syntax

Copy Code
bitsadmin /PeerCaching /GetConfigurationFlags <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Examples

The following example gets the configuration flags for the job named myJob.

Copy Code
C:\> Bitsadmin /PeerCaching /GetConfigurationFlags myJob

Additional references

Command-Line Syntax Key


Bitsadmin /peercaching /setconfigurationflags

Applies To: Windows Server 2008 R2,Windows Server 2008

Sets the configuration flags that determine if the computer can serve content to peers and can download content from peers.

Syntax

Copy Code
bitsadmin /PeerCaching /SetConfigurationFlags <Job> <Value>

Parameters

Parameter Description

Job

The job's display name or GUID

Value

The value is an unsigned integer with the following interpretation for the bits in the binary representation:

  • Allow the job's data to be downloaded from a peer: Set the least significant bit

  • Allow the job's data to be served to peers: Set the 2nd bit from the right.

Examples

The following example specifies the job's data to be downloaded from peers for the job named myJob.

Copy Code
C:\> Bitsadmin /PeerCaching /SetConfigurationFlags myJob 1

Additional references

Command-Line Syntax Key


Bitsadmin /peercaching /help

Applies To: Windows Server 2008,Windows Server 2008 R2

Displays the command-line usage for the PeerCaching commands.

Syntax

Copy Code
Bitsadmin /PeerCaching /Help

Examples

The following command displays the command-line help for the PeerCaching commands.

Copy Code
Bitsadmin /PeerCaching /Help

Additional references

Command-Line Syntax Key


Bitsadmin /rawreturn

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista

Returns data suitable for parsing.

Syntax

Copy Code
bitsadmin /RawReturn

Remarks

Strips new line characters and formatting from the output.

Typically, you use this command in conjunction with the Create and Get* commands to receive only the value. You must specify this command before other commands.

Examples

The following example retrieves the raw data for the state of the job named myDownloadJob.

Copy Code
C:\>bitsadmin /RawReturn /GetState myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /removeclientcertificate

Applies To: Windows Server 2008,Windows Server 2008 R2

Removes the client certificate from the job.

Syntax

Copy Code
bitsadmin /RemoveClientCertificate <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Examples

The following example removes the client certificate from the job named myJob.

Copy Code
C:\>Bitsadmin /RemoveClientCertificate myJob

Additional references

Command-Line Syntax Key


Bitsadmin /removecredentials

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista

Removes credentials from a job.

Syntax

Copy Code
bitsadmin /RemoveCredentials <Job> <Target> <Scheme>

Parameters

Parameter Description

Job

The job's display name or GUID

Target

SERVER or PROXY

Scheme

One of the following:

  • BASIC—authentication scheme in which the user name and password are sent in clear-text to the server or proxy.

  • DIGEST—a challenge-response authentication scheme that uses a server-specified data string for the challenge.

  • NTLM—a challenge-response authentication scheme that uses the credentials of the user for authentication in a Windows network environment.

  • NEGOTIATE—also known as the Simple and Protected Negotiation protocol (Snego) is a challenge-response authentication scheme that negotiates with the server or proxy to determine which scheme to use for authentication. Examples are the Kerberos protocol and NTLM.

  • PASSPORT—a centralized authentication service provided by Microsoft that offers a single logon for member sites.

Examples

The following example removes credentials from the job named myDownloadJob.

Copy Code
C:\>bitsadmin /RemoveCredentials myDownloadJob SERVER BASIC

Additional references

Command-Line Syntax Key


Bitsadmin /replaceremoteprefix

Applies To: Windows Vista,Windows Server 2008,Windows Server 2008 R2

All files in the job whose remote URL begins with OldPrefix are changed to use NewPrefix.

Syntax

Copy Code
bitsadmin /ReplaceRemotePrefix <Job> <OldPrefix> <NewPrefix

Parameters

Parameter | Description
Job | The job's display name or GUID
OldPrefix | Existing URL prefix
NewPrefix | New URL prefix

Examples

The following example changes all files in job named myDownloadJob whose remote URL begins with http://stageserver to http://prodserver.

Copy Code
C:\>bitsadmin /ReplaceRemotePrefix myDownloadJob http://stageserver http://prodserver

Additional information

Command-Line Syntax Key


Bitsadmin /reset

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista

Cancels all jobs in the transfer queue that the current user owns.

Syntax

Copy Code
bitsadmin /Reset [/AllUsers]

Parameters

Parameter | Description
AllUsers | Optional— cancels all jobs in the queue.

Remarks

You must have administrator privileges to use the AllUsers parameter.

Note
Administrators cannot reset jobs created by Local System. Use the task scheduler to schedule this command as task using the Local System credentials.

Examples

The following example cancels all the jobs in the transfer queue for the current user.

Copy Code
C:\>bitsadmin /Reset

Additional references

Command-Line Syntax Key


Bitsadmin /resume

Applies To: Windows Vista,Windows Server 2008,Windows Server 2008 R2

Activates a new or suspended job in the transfer queue.

Syntax

Copy Code
bitsadmin /Resume <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Examples

The following example resumes the job named myDownloadJob.

Copy Code
C:\>bitsadmin /Resume myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /setaclflag

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista

Sets the access control list propagations flags.

Syntax

Copy Code
bitsadmin /SetAclFlags <Job> <Flags>

Parameters

Parameter Description

Job

The job's display name or GUID

Flags

Specify one or more of the following flag values:

  • O: Copy owner information with file.

  • G: Copy group information with file.

  • D: Copy DACL information with file.

  • S :Copy SACL information with file.

Remarks

The SetAclFlags command is used to maintain Owner and access control list information when a job is downloading data from a Windows (SMB) share.

Examples

The following example sets the access control list propagation flags for the job named myDownloadJob to maintain the owner and group information with the downloaded files.

Copy Code
C:\>bitsadmin /setaclflags myDownloadJob OG

Additional references

Command-Line Syntax Key


Bitsadmin /setclientcertificatebyid

Applies To: Windows Server 2008,Windows Server 2008 R2

Specifies the identifier of the client certificate to use for client authentication in an HTTPS (SSL) request.

Syntax

Copy Code
bitsadmin /SetClientCertificateByID <Job> <store_location> <store_name> hexa-decimal_cert_id>

Parameters

Parameter | Description
Job | The job's display name or GUID
Store_location | Identifies the location of a system store to use for looking up the certificate. Possible values include: 1 (CURRENT_USER) 2 (LOCAL_MACHINE) 3 (CURRENT_SERVICE) 4 (SERVICES) 5 (USERS) 6 (CURRENT_USER_GROUP_POLICY) 7 (LOCAL_MACHINE_GROUP_POLICY) 8 (LOCAL_MACHINE_ENTERPRISE)
Store_name | The name of the certificate store. Possible values include: CA (Certification Authority certificates) MY (Personal certificates) ROOT (Root certificates) SPC (Software Publisher Certificate)
Hexadecimal_cert_id | A hexadecimal number representing the hash of the certificate

Examples

The following example specifies the identifier of the client certificate to use for client authentication in an HTTPS (SSL) request for the job named myJob.

Copy Code
C:\>bitsadmin Bitsadmin /SetClientCertificateByID myJob BG_CERT_STORE_LOCATION_CURRENT_USER MY A106B52356D3FBCD1853A41B619358BD

Additional references

Command-Line Syntax Key


Bitsadmin /setclientcertificatebyname

Applies To: Windows Server 2008 R2,Windows Server 2008

Specifies the subject name of the client certificate to use for client authentication in an HTTPS (SSL) request.

Syntax

Copy Code
bitsadmin /SetClientCertificateByID <Job> <store_location> <store_name> <subject_name>

Parameters

Parameter | Description
Job | The job's display name or GUID
Store_location | Identifies the location of a system store to use for looking up the certificate. Possible values include: 1 (CURRENT_USER) 2 (LOCAL_MACHINE) 3 (CURRENT_SERVICE) 4 (SERVICES) 5 (USERS) 6 (CURRENT_USER_GROUP_POLICY) 7 (LOCAL_MACHINE_GROUP_POLICY) 8 (LOCAL_MACHINE_ENTERPRISE)
Store_name | The name of the certificate store. Possible values include: CA (Certification Authority certificates) MY (Personal certificates) ROOT (Root certificates) SPC (Software Publisher Certificate)
Subject_name | Name of the certificate

Examples

The following example specifies the name of the client certificate myCertificate to use for client authentication in an HTTPS (SSL) request for the job named myJob.

Copy Code
C:\>bitsadmin Bitsadmin /SetClientCertificateByName myJob 1 MY myCertificate

Additional references

Command-Line Syntax Key


Bitsadmin /setcredentials

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Vista

Adds credentials to a job.

Syntax

Copy Code
bitsadmin /SetCredentials <Job> <Target> <Scheme> <Username> <Password>

Parameters

Parameter Description

Job

The job's display name or GUID

Target

SERVER or PROXY

Scheme

One of the following:

  • BASIC—authentication scheme in which the user name and password are sent in clear-text to the server or proxy.

  • DIGEST—a challenge-response authentication scheme that uses a server-specified data string for the challenge.

  • NTLM—a challenge-response authentication scheme that uses the credentials of the user for authentication in a Windows network environment.

  • NEGOTIATE—also known as the Simple and Protected Negotiation protocol (Snego) is a challenge-response authentication scheme that negotiates with the server or proxy to determine which scheme to use for authentication. Examples are the Kerberos protocol and NTLM.

  • PASSPORT—a centralized authentication service provided by Microsoft that offers a single logon for member sites.

Username

The name of the provided credentials

Password

The password associated with the provided Username

Examples

The following example Adds credentials to the job named myDownloadJob.

Copy Code
C:\>bitsadmin /RemoveCredentials myDownloadJob SERVER BASIC Edward Password20

Additional references

Command-Line Syntax Key


Bitsadmin /setcustomheaders

Applies To: Windows Server 2008 R2,Windows Server 2008

Add a custom HTTP header to a GET request.

Syntax

Copy Code
bitsadmin /SetCustomHeaders <Job> <Header1> <Header2> <. . .>

Parameters

Parameter | Description
Job | The job's display name or GUID
Header1 Header2 . . . | The custom headers for the job

Remarks

  • This command is used to add a custom HTTP header to a GET request sent to an HTTP server.

Examples

The following example adds a custom HTTP header for the job named myDownloadJob.

Copy Code
C:\>bitsadmin / SetCustomHeaders myDownloadJob "Accept-encoding:deflate/gzip"

Additional references

Command-Line Syntax Key


Bitsadmin /setdescription

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Vista

Sets the description of the specified job.

Syntax

Copy Code
bitsadmin /SetDescription <Job> <Description>

Parameters

Parameter | Description
Job | The job's display name or GUID
Description | Text used to describe the job.

Examples

The following example retrieves the description for the job named myDownloadJob.

Copy Code
C:\>bitsadmin /SetDescription myDownloadJob "Music Downloads"

Additional references

Command-Line Syntax Key


Bitsadmin /setdisplayname

Applies To: Windows Vista,Windows Server 2008 R2,Windows Server 2008

Sets the display name of the specified job.

Syntax

Copy Code
bitsadmin /SetDisplayName <Job> <DisplayName>

Parameters

Parameter | Description
Job | The job's display name or GUID
DisplayName | Text used for the display name of the specified job.

Examples

The following example sets the display name for the job named myDownloadJob to myDownloadJob2.

Copy Code
C:\>bitsadmin /SetDisplayName myDownloadJob "Download Music Job"

Additional references

Command-Line Syntax Key


Bitsadmin /setmaxdownloadtime

Applies To: Windows Server 2008,Windows Server 2008 R2

Sets the download timeout in seconds.

Syntax

Copy Code
bitsadmin /SetMaxDownloadTime <Job> <Timeout>

Parameters

Parameter | Description
Job | The job's display name or GUID
Timeout | The timeout in seconds

Remarks

  • N/A

Examples

The following example sets the timeout for the job named myDownloadJob to 10 seconds.

Copy Code
C:\>bitsadmin /SetMaxDownloadTime myDownloadJob 10

Additional references

Command-Line Syntax Key


Bitsadmin /setminretrydelay

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista

Sets the length of time, in seconds, that the service waits after encountering a transient error before retrying to transfer the file.

Syntax

Copy Code
bitsadmin /SetMinRetryDelay <Job> <RetryDelay>

Parameters

Parameter | Description
Job | The job's display name or GUID
RetryDelay | A number represented in seconds.

Examples

The following example sets the minimum retry delay for the job named myDownloadJob to 35 seconds.

Copy Code
C:\>bitsadmin /SetMinRetryDelay myDownloadJob 35

Additional references

Command-Line Syntax Key


Bitsadmin /setnoprogresstimeout

Applies To: Windows Vista,Windows Server 2008,Windows Server 2008 R2

Sets the length of time, in seconds, that the service tries to transfer the file after a transient error occurs.

Syntax

Copy Code
bitsadmin /SetNoProgressTimeout <Job> <TimeOutvalue>

Parameters

Parameter | Description
Job | The job's display name or GUID
TimeOutvalue | A number represented in seconds.

Remarks

  • The no progress timeout interval begins when the job encounters a transient error.

  • The timeout interval stops or resets when a byte of data is successfully transferred.

  • If no progress timeout interval exceeds the TimeOutvalue, then the job is placed in a fatal error state.

Examples

The following example sets the no progress time out value for the job named myDownloadJob to 20 seconds

Copy Code
C:\>bitsadmin /SetNoProgressTimeout myDownloadJob 20

Additional references

Command-Line Syntax Key


Bitsadmin /setnotifycmdline

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista

Sets the command-line command that will run when the job finishes transferring data or when a job enters a state..

Syntax

Copy Code
bitsadmin /SetNotifyCmdLine <Job> <ProgramName> [ProgramParameters]

Parameters

Parameter | Description
Job | The job's display name or GUID
ProgramName | Name of the command to run when the job completes.
ProgramParameters | Parameters that you want to pass to ProgramName.

Remarks

You can specify NULL for ProgramName and ProgramParameters. If ProgramName is NULL, ProgramParameters must be NULL.

Important
If ProgramParameters is not NULL, then the first parameter in ProgramParameters must match ProgramName.

Examples

The following example sets the command-line command used by the service to run notepad when the job named myDownloadJob completes.

Copy Code
C:\>bitsadmin /SetNotifyCmdLine myDownloadJob c:\winnt\system32\notepad.exe NULL
Copy Code
C:\>bitsadmin /SetNotifyCmdLine myDownloadJob c:\winnt\system32\notepad.exe "notepad c:\eula.txt"

Additional references

Command-Line Syntax Key


Bitsadmin /setnotifyflags

Applies To: Windows Vista,Windows Server 2008,Windows Server 2008 R2

Sets the event notification flags for the specified job.

Syntax

Copy Code
bitsadmin /SetNotifyFlags <Job> <NotifyFlags>

Parameters

Parameter | Description
Job | The job's display name or GUID
NotifyFlags | See Remarks

Remarks

The NotfiyFlags parameter can contain one or more of the following notification flags.

1 | Generate an event when all files in the job have been transferred.
2 | Generate an event when an error occurs.
4 | Disable notifications.

Examples

The following example sets the notify flags for transferred and error events job for job named myDownloadJob.

Copy Code
C:\>bitsadmin /SetNotifyFlags myDownloadJob 3

Additional references

Command-Line Syntax Key


Bitsadmin /setpeercachingflags

Applies To: Windows Server 2008 R2,Windows Server 2008

Sets flags that determine if the files of the job can be cached and served to peers and if the job can download content from peers.

Syntax

Copy Code
bitsadmin /SetPeerCachingFlags <Job> <value>

Parameters

Parameter | Description
Job | The job's display name or GUID
Value | The value is an unsigned integer with the following interpretation for the bits in the binary representation. 1 - The job can download content from peers. 2 - The files of the job can be cached and served to peers.

Examples

The following example sets flags for the job named myJob which allows it to download content from peers.

Copy Code
C:\>bitsadmin / SetPeerCachingFlags myJob 1

Additional references

Command-Line Syntax Key


Bitsadmin /setpriority

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Vista

Sets the priority of the specified job.

Syntax

Copy Code
bitsadmin /SetPriority <Job> <Priority>

Parameters

Parameter Description

Job

The job's display name or GUID

Priority

One of the following values:

  • FOREGROUND

  • HIGH

  • NORMAL

  • LOW

Examples

The following example sets the priority for the job named myDownloadJob to normal.

Copy Code
C:\>bitsadmin /SetPriority myDownloadJob NORMAL

Additional references

Command-Line Syntax Key


Bitsadmin /setproxysettings

Applies To: Windows Vista,Windows Server 2008 R2,Windows Server 2008

Sets the proxy settings for the specified job.

Syntax

Copy Code
bitsadmin /SetProxySettings <Job> <Usage> [List] [Bypass]

Parameters

Parameter Description

Job

The job's display name or GUID

Usage

One of the following values:

  • PRECONFIG—use the owner's Internet Explorer defaults.

  • NO_PROXY—do not use a proxy server.

  • OVERRIDE—use an explicit proxy list and bypass list. A proxy and proxy bypass list must follow.

  • AUTODETECT—automatically detect proxy settings.

List

Used when the Usage parameter is set to OVERRIDE—contains a semicolon or space delimited list of proxy servers to use.

Bypass

Used when the Usage parameter is set to OVERRIDE—contains a semicolon or space-delimited list of host names or IP addresses, or both, for which transfers are not to be routed through a proxy. This can be <local> to refer to all servers on the same LAN. Values of NULL or "" may be used for an empty proxy bypass list.

Examples

The following example sets the proxy settings for the job named myDownloadJob.

Copy Code
C:\>bitsadmin /SetProxySettings myDownloadJob PRECONFIG

Additional references

Command-Line Syntax Key


Bitsadmin /setreplyfilename

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Vista

Specify the path of the file that contains the server reply.

Syntax

Copy Code
bitsadmin /SetReplyFileName <Job> <Path>

Parameters

Parameter | Description
Job | The job's display name or GUID
Path | Location to place the server reply

Remarks

Valid only for upload-reply jobs.

Examples

The following example sets the reply filename pathfor the job named myDownloadJob.

Copy Code
C:\>bitsadmin /SetReplyFileName myDownloadJob c:\reply

Additional references

Command-Line Syntax Key


Bitsadmin /setsecurityflags

Applies To: Windows Server 2008 R2,Windows Server 2008

Sets flags for HTTP that determine if BITS should check the certificate revocation list, ignore certain certificate errors, and define the policy to use when a server redirects the HTTP request. The value is an unsigned integer.

Syntax

Copy Code
bitsadmin /SetSecurityFlags <Job> <Value>

Parameters

Parameter | Description
Job | The job's display name or GUID
Value | See Remarks

Remarks

The Value parameter can contain one or more of the following notification flags.

Action | Binary representation
Enable CRL Check | Set the least significant bit
Ignore invalid common name in server certificate | Set the 2nd bit from the right
Ignore invalid date in server certificate | Set the 3rd bit from the right
Ignore invalid certification authority in server certificate | Set the 4th bit from the right
Ignore invalid usage of the certificate | Set the 5th bit from the right
Redirection policy | Controlled by the 9th to 11th bits from the right 0,0,0 - Redirects will be automatically allowed. 0,0,1 - Remote name in the IBackgroundCopyFile interface will be updated if a redirect occurs. 0,1,0 - BITS will fail the job if a redirect occurs.
Allow redirection from HTTPS to HTTP | Set the 12th bit from the right

Examples

The following example sets the security flags to enable a CRL check for the job named myJob.

Copy Code
C:\>bitsadmin /SetSecurityFlags myJob 0x0001

Additional references

Command-Line Syntax Key


Bitsadmin /setvalidationstate

Applies To: Windows Server 2008,Windows Server 2008 R2

Sets the content validation state of the given file within the job.

Syntax

Copy Code
bitsadmin /SetValidationState <Job> <file index> <true|false>

Parameters

Parameter | Description
Job | The job's display name or GUID
File index | Starts from 0
True|False | Set to TRUE if the file content is valid, otherwise set to FALSE

Examples

The following example sets the content validation state of file 2 to TRUE for the job named myJob.

Copy Code
C:\>bitsadmin /SetValidationState myJob 2 TRUE

Additional references

Command-Line Syntax Key


Bitsadmin /suspend

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista

Suspends the specified job.

Syntax

Copy Code
bitsadmin /Suspend <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Remarks

To restart the job, use the Bitsadmin /resume command.

Examples

The following example suspends the job named myDownloadJob.

Copy Code
C:\>bitsadmin /Suspend myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /takeownership

Applies To: Windows Vista,Windows Server 2008,Windows Server 2008 R2

Lets a user with administrative privileges take ownership of the specified job.

Syntax

Copy Code
bitsadmin /TakeOwnership <Job>

Parameters

Parameter | Description
Job | The job's display name or GUID

Examples

The following example takes ownership of the job named myDownloadJob.

Copy Code
C:\>bitsadmin /TakeOwnership myDownloadJob

Additional references

Command-Line Syntax Key


Bitsadmin /transfer

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista

Transfers one or more files.

Syntax

Copy Code
bitsadmin /Transfer Name [Type] [/Priority Job_Priority] [/ACLFlags Flags] <RemoteFileName> <LocalFileName>

Parameters

Parameter Description

Name

The name of the job.

Type

Optional—specify the type of job. Use /Download for a download job or /Upload for an upload job.

Priority

Optional— set the job_priority to one of the following values:

  • FOREGROUND

  • HIGH

  • NORMAL

  • LOW

ACLFlags

Specify one or more of the following flags:

  • O: Copy owner information with file.

  • G: Copy group information with file.

  • D: Copy DACL information with file.

  • S: Copy SACL information with file.

RemoteFileName

The name of the file when transferred to the server

LocalFileName

The name of the file that resides locally.

Remarks

By default, the BITSAdmin service creates a download job that runs at NORMAL priority and updates the command window with progress information until the transfer is complete or until a critical error occurs. The service completes the job if it successfully transfers all the files and cancels the job if a critical error occurs. The service does not create the job if it is unable to add files to the job or if you specify an invalid value for Type or Job_Priority. To transfer more than one file, specify multiple RemoteFileName-LocalFileName pairs. The pairs are space-delimited.

Note
The BITSAdmin command continues to run if a transient error occurs. To end the command, press CTRL+C.

Examples

The following example starts a transfer job with named myDownloadJob.

Copy Code
C:\>bitsadmin /Transfer myDownloadJob http://prodserver/audio.wma c:\downloads\audio.wma

Additional references

Command-Line Syntax Key


Bitsadmin /util

Applies To: Windows Vista,Windows Server 2008,Windows Server 2008 R2

Syntax

Copy Code
Bitsadmin /Util /Help
Bitsadmin /Util /GetIEProxy
Bitsadmin /Util /RepairService
Bitsadmin /Util /SetIEProxy
Bitsadmin /Util /Version

Parameters

Parameter | Description
Bitsadmin /util /help | Displays the command-line usage for the /Util commands.
Bitsadmin /util /getieproxy | Retrieves the proxy usage for the given service account.
Bitsadmin /util /repairservice | Repairs known issues with BITS service
Bitsadmin /util /setieproxy | Specifies proxy settings to use when transferring files using a service account.
Bitsadmin /util /version | Displays the version of the BITS service

Additional references

Command-Line Syntax Key


Bitsadmin /util /help

Applies To: Windows Vista,Windows Server 2008 R2,Windows Server 2008

Displays the command-line usage for the Util commands.

Syntax

Copy Code
Bitsadmin /Util /Help

Examples

The following command displays the command-line help for the Util commands.

Copy Code
Bitsadmin /Util /Help

Additional references

Command-Line Syntax Key


Bitsadmin /util /getieproxy

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Vista

Retrieves the proxy usage for the given service account.

Syntax

Copy Code
bitsadmin /Util /GetIEProxy <Account> [/Conn <ConnectionName>]

Parameters

Parameter Description

Account

Specifies the service account whose proxy settings you want to retrieve. Possible values are:

  • LOCALSYSTEM

  • NETWORKSERVICE

  • LOCALSERVICE

ConnectionName

Optional—used with the /Conn command to specify the use of a modem connection. If you do not specify the /Conn command, BITS uses the LAN connection. Specify the modem connection name immediately following the /Conn parameter.

Remarks

This command shows the value for each proxy usage, not just the proxy usage you specified for the service account. For details on setting the proxy usage for service accounts, see the Bitsadmin /util /setieproxy command.

Examples

The following example displays the proxy usage for the NETWORK SERVICE account.

Copy Code
C:\>bitsadmin /Util /GetIEProxy NETWORKSERVICE

Additional references

Command-Line Syntax Key


Bitsadmin /util /repairservice

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Vista

Commmand used to fix known issues with various versions of BITS service.

Syntax

Copy Code
bitsadmin /Util /RepairService [/Force]

Parameters

Parameter | Description
Force | Optional—deletes and recreates the service.

Remarks

This command resolves errors related to incorrect service configuration and dependencies on Windows services and the network directory. This command generates output that indicates if the issues that were resolved.

Note
that if BITS recreates the service, the service description string may be set to English in a localized system.

Important
This command is not supported on Windows Vista.

Examples

The following example repairs the BITS Service configuration.

Copy Code
C:\>bitsadmin /Util /RepairService

Additional references

Command-Line Syntax Key


Bitsadmin /util /setieproxy

Applies To: Windows Vista,Windows Server 2008 R2,Windows Server 2008

Set proxy settings to use when transferring files using a service account.

Syntax

Copy Code
bitsadmin /Util /GetIEProxy <Account> <Usage>[/Conn <ConnectionName>]

Parameters

Parameter Description

Account

Specifies the service account whose proxy settings you want to retrieve. Possible values are:

  • LOCALSYSTEM

  • NETWORKSERVICE

  • LOCALSERVICE

Usage

Specifies the form of proxy detection to use. Possible values are:

  • NO_PROXY—Do not use a proxy server.

  • AUTODETECT—Automatically detect the proxy settings.

  • MANUAL_PROXY—Use an explicit proxy list and bypass list. Specify the proxy list and bypass list immediately following the usage tag. For example, MANUAL_PROXY proxy1,proxy2 NULL.

    • The proxy list is a semicolon or space delimited list of proxy servers to use.

    • The bypass list is a semicolon or space-delimited list of host names or IP addresses, or both, for which transfers are not to be routed through a proxy. This can be <local> to refer to all servers on the same LAN. Values of NULL or "" may be used for an empty proxy bypass list.

  • AUTOSCRIPT— Same as AUTODETECT, except it also executes a script. Specify the script URL immediately following the usage tag. For example, AUTOSCRIPT http://server/proxy.js.

ConnectionName

Optional—used with the /Conn command to specify the use of a modem connection. If you do not specify the /Conn command, BITS uses the LAN connection. Specify the modem connection name immediately following the /Conn parameter.

Remarks

Each successive call using this command replaces the previously specified usage but not the parameters of the previously defined usage. For example, if you specify NO_PROXY, AUTODETECT, and MANUAL_PROXY on separate calls, BITS uses the last supplied usage but keeps the parameters from the previously defined usage.

Important
You must run this command from an elevated command prompt for it to complete successfully.

Examples

The following example sets the proxy usage for the NETWORK SERVICE account.

Copy Code
C:\>bitsadmin /Util /SetIEProxy localsystem AUTODETECT

Additional references

Command-Line Syntax Key


Bitsadmin /util /version

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Vista

Displays the version of BITS service.

Syntax

Copy Code
bitsadmin /Util /Version [/Verbose]

Remarks

The Verbose command performs the following:

  • Displays the file version for each BITS related DLL

  • Verifies the BITS Service can be started

  • Displays BITS Group Policy values (Windows Vista only)

Examples

The following example the version of the BITS Service.

Copy Code
C:\>bitsadmin /Util /Version

Additional references

Command-Line Syntax Key


Bitsadmin /util /enableanalyticchannel

Applies To: Windows Server 2008 R2,Windows Server 2008

Enables or disables the BITS client analytic channel.

Syntax

Copy Code
bitsadmin /Util /EnableAnalyticChannel TRUE|FALSE

Examples

The following example enables the BITS client analytic channel.

Copy Code
C:\>bitsadmin /Util / EnableAnalyticChannel TRUE

Additional references

Command-Line Syntax Key


Bitsadmin /wrap

Applies To: Windows Vista,Windows Server 2008 R2,Windows Server 2008

Wraps any line of output text extending beyond the rightmost edge of the command window to the next line.

Syntax

Copy Code
bitsadmin /Wrap Job

Parameters

Parameter | Description
Job | The job's display name or GUID

Remarks

Specify before other commands. By default, all commands, except the Bitsadmin /monitor command, wrap the output.

Examples

The following example retrieves information for the job named myDownloadJob and wraps the output.

Copy Code
C:\>bitsadmin /Wrap /Info myDownloadJob /verbose

Additional references

Command-Line Syntax Key


Bootcfg

Applies To: Windows Vista,Windows Server 2008

Configures, queries, or changes Boot.ini file settings.

Syntax

Copy Code
Bootcfg <parameter> [arguments...]

Parameters

Parameter | Description
Bootcfg /addsw | Adds operating system load options for a specified operating system entry.
Bootcfg /copy | Makes a copy of an existing boot entry, to which you can add command-line options.
Bootcfg /dbg1394 | Configures 1394 port debugging for a specified operating system entry.
Bootcfg /debug | Adds or changes the debug settings for a specified operating system entry.
Bootcfg /default | Specifies the operating system entry to designate as the default.
Bootcfg /delete | Deletes an operating system entry in the [operating systems] section of the Boot.ini file.
Bootcfg /ems | Enables the user to add or change the settings for redirection of the Emergency Management Services console to a remote computer.
Bootcfg /query | Queries and displays the [boot loader] and [operating systems] section entries from Boot.ini.
Bootcfg /raw | Adds operating system load options specified as a string to an operating system entry in the [operating systems] section of the Boot.ini file.
Bootcfg /rmsw | Removes operating system load options for a specified operating system entry.
Bootcfg /timeout | Changes the operating system time-out value.


Bootcfg /addsw

Applies To: Windows Server 2008,Windows Vista

Adds operating system load options for a specified operating system entry.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
bootcfg /addsw [/s <Computer> [/u <Domain>\<User> /p <Password>]] [/mm <MaximumRAM>] [/bv] [/so] [/ng] /id <OSEntryLineNum>

Parameters

Term | Definition
/s <Computer> | Specifies the name or IP address of a remote computer (do not use backslashes). The default is the local computer.
/u <Domain>\<User> | Runs the command with the account permissions of the user specified by <User> or <Domain>\<User>. The default is the permissions of the current logged on user on the computer issuing the command.
/p <Password> | Specifies the password of the user account that is specified in the /u parameter.
/mm <MaximumRAM> | Specifies the maximum amount of RAM, in megabytes, that the operating system can use. The value must be equal to or greater than 32 Megabytes.
/bv | Adds the /basevideo option to the specified <OSEntryLineNum>, directing the operating system to use standard VGA mode for the installed video driver.
/so | Adds the /sos option to the specified OSEntryLineNum, directing the operating system to display device driver names while they are being loaded.
/ng | Adds the /noguiboot option to the specified <OSEntryLineNum>, disabling the progress bar that appears before the CTRL+ALT+DEL logon prompt.
/id <OSEntryLineNum> | Specifies the operating system entry line number in the [operating systems] section of the Boot.ini file to which the operating system load options are added. The first line after the [operating systems] section header is 1.
/? | Displays help at the command prompt.

Examples

The following examples show how you can use the bootcfg /addsw command:

Copy Code
bootcfg /addsw /mm 64 /id 2
bootcfg /addsw /so /id 3
bootcfg /addsw /so /ng /s srvmain /u hiropln /id 2
bootcfg /addsw /ng /id 2
bootcfg /addsw /mm 96 /ng /s srvmain /u maindom\hiropln /p p@ssW23 /id 2

Additional references

Command-Line Syntax Key


Bootcfg /copy

Applies To: Windows Vista,Windows Server 2008

Makes a copy of an existing boot entry, to which you can add command-line options.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
bootcfg /copy [/s <Computer> [/u <Domain>\<User> /p <Password>]] [/d <Description>] [/id <OSEntryLineNum>]

Parameters

Parameter | Description
/s <Computer> | Specifies the name or IP address of a remote computer (do not use backslashes). The default is the local computer.
/u <Domain>\<User> | Runs the command with the account permissions of the user specified by <User> or <Domain>\<User>. The default is the permissions of the current logged on user on the computer issuing the command.
/p <Password> | Specifies the password of the user account that is specified in the /u parameter.
/d <Description> | Specifies the description for the new operating system entry.
/id <OSEntryLineNum> | Specifies the operating system entry line number in the [operating systems] section of the Boot.ini file to copy. The first line after the [operating systems] section header is 1.
/? | Displays help at the command prompt.

Examples

The following examples show how you can use the bootcfg /copy command to copy boot entry 1 and enter "\ABC Server\" as the description:

Copy Code
bootcfg /copy /d "\ABC Server\" /id 1

Additional references

Command-Line Syntax Key


Bootcfg /dbg1394

Applies To: Windows Server 2008,Windows Vista

Configures 1394 port debugging for a specified operating system entry.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
bootcfg /dbg1394 {ON | OFF}[/s <Computer> [/u <Domain>\<User> /p <Password>]] [/ch <Channel>] /id <OSEntryLineNum>

Parameters

Parameter Description

{ON | OFF}

Specifies the value for 1394 port debugging.

  • ON - Enables remote debugging support by adding the /dbg1394 option to the specified <OSEntryLineNum>.

  • OFF - Disables remote debugging support by removing the /dbg1394 option from the specified <OSEntryLineNum>.

/s <Computer>

Specifies the name or IP address of a remote computer (do not use backslashes). The default is the local computer.

/u <Domain>\<User>

Runs the command with the account permissions of the user specified by <User> or <Domain>\<User>. The default is the permissions of the current logged on user on the computer issuing the command.

/p <Password>

Specifies the password of the user account that is specified in the /u parameter.

/ch Channel

Specifies the channel to use for debugging. Valid values are integers between 1 and 64. Do not use the /ch <Channel> parameter if 1394 port debugging is being disabled.

/id <OSEntryLineNum>

Specifies the operating system entry line number in the [operating systems] section of the Boot.ini file to which the 1394 port debugging options are added. The first line after the [operating systems] section header is 1.

/?

Displays help at the command prompt.

Examples

The following examples show how you can use the bootcfg /dbg1394 command:

Copy Code
bootcfg /dbg1394 /id 2
bootcfg /dbg1394 on /ch 1 /id 3
bootcfg /dbg1394 edit /ch 8 /id 2
bootcfg /s srvmain /u maindom\hiropln /p p@ssW23 /dbg1394 off /id 2

Additional references

Command-Line Syntax Key


Bootcfg /debug

Applies To: Windows Vista,Windows Server 2008

Adds or changes the debug settings for a specified operating system entry.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
bootcfg /debug {ON | OFF | EDIT}[/s <Computer> [/u <Domain>\<User> /p <Password>]] [/port {COM1 | COM2 | COM3 | COM4}] [/baud {9600 | 19200 | 38400 | 57600 | 115200}] [/id <OSEntryLineNum>]

Parameters

Parameter Description

{ON | OFF| EDIT}

Specifies the value for debugging.

ON - Enables remote debugging support by adding the /debug option to the specified <OSEntryLineNum>.

OFF - Disables remote debugging support by removing the /debug option from the specified <OSEntryLineNum>.

EDIT - Allows changes to port and baud rate settings by changing the values associated with the /debug option for the specified <OSEntryLineNum>.

/s <Computer>

Specifies the name or IP address of a remote computer (do not use backslashes). The default is the local computer.

/u <Domain>\<User>

Runs the command with the account permissions of the user specified by <User> or <Domain>\<User>. The default is the permissions of the current logged on user on the computer issuing the command.

/p <Password>

Specifies the password of the user account that is specified in the /u parameter.

/port {COM1 | COM2 | COM3 | COM4}

Specifies the COM port to be used for debugging. Do not use the /port parameter if debugging is being disabled.

/baud {9600| 19200| 38400| 57600| 115200}

Specifies the baud rate to be used for debugging. Do not use the /baud parameter if debugging is being disabled.

/id <OSEntryLineNum>

Specifies the operating system entry line number in the [operating systems] section of the Boot.ini file to which the debugging options are added. The first line after the [operating systems] section header is 1.

/?

Displays help at the command prompt.
Remarks
  • If 1394 port debugging is required, use Bootcfg /dbg1394.

Examples

The following examples show how you can use the bootcfg /debug command:

Copy Code
bootcfg /debug on /port com1 /id 2
bootcfg /debug edit /port com2 /baud 19200 /id 2
bootcfg /s srvmain /u maindom\hiropln /p p@ssW23 /debug off /id 2

Additional references

Command-Line Syntax Key


Bootcfg /default

Applies To: Windows Server 2008,Windows Vista

Specifies the operating system entry to designate as the default.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
bootcfg /default [/s <Computer> [/u <Domain>\<User> /p <Password>]] [/id <OSEntryLineNum>]

Parameters

Parameter | Description
/s <Computer> | Specifies the name or IP address of a remote computer (do not use backslashes). The default is the local computer.
/u <Domain>\<User> | Runs the command with the account permissions of the user specified by <User> or <Domain>\<User>. The default is the permissions of the current logged on user on the computer issuing the command.
/p <Password> | Specifies the password of the user account that is specified in the /u parameter.
/id <OSEntryLineNum> | Specifies the operating system entry line number in the [operating systems] section of the Boot.ini file to designate as default. The first line after the [operating systems] section header is 1.
/? | Displays help at the command prompt.

Examples

The following examples show how you can use the bootcfg /default command:

Copy Code
bootcfg /default /id 2
bootcfg /default /s srvmain /u maindom\hiropln /p p@ssW23 /id 2

Additional references

Command-Line Syntax Key


Bootcfg /delete

Applies To: Windows Vista,Windows Server 2008

Deletes an operating system entry in the [operating systems] section of the Boot.ini file.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
bootcfg /delete [/s <Computer> [/u <Domain>\<User> /p <Password>]] [/id <OSEntryLineNum>]

Parameters

Term | Definition
/s <Computer> | Specifies the name or IP address of a remote computer (do not use backslashes). The default is the local computer.
/u <Domain>\<User> | Runs the command with the account permissions of the user specified by <User> or <Domain>\<User>. The default is the permissions of the current logged on user on the computer issuing the command.
/p <Password> | Specifies the password of the user account that is specified in the /u parameter.
/id <OSEntryLineNum> | Specifies the operating system entry line number in the [operating systems] section of the Boot.ini file to delete. The first line after the [operating systems] section header is 1.
/? | Displays help at the command prompt.

Examples

The following examples show how you can use the bootcfg /delete command:

Copy Code
bootcfg /delete /id 1
bootcfg /delete /s srvmain /u maindom\hiropln /p p@ssW23 /id 3

Additional references

Command-Line Syntax Key


Bootcfg /ems

Applies To: Windows Server 2008,Windows Vista

Enables the user to add or change the settings for redirection of the Emergency Management Services console to a remote computer. By enabling Emergency Management Services, you add a "redirect=Port#" line to the [boot loader] section of the Boot.ini file and a /redirect option to the specified operating system entry line. The Emergency Management Services feature is enabled only on servers.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
bootcfg /ems {ON | OFF | EDIT} [/s <Computer> [/u <Domain>\<User> /p <Password>]] [/port {COM1 | COM2 | COM3 | COM4 | BIOSSET}] [/baud {9600 | 19200 | 38400 | 57600 | 115200}] [/id <OSEntryLineNum>]

Parameters

Parameter Description

{ON | OFF| EDIT}

Specifies the value for Emergency Management Services redirection.

ON - Enables remote output for the specified <OSEntryLineNum>. Adds a /redirect option to the specified <OSEntryLineNum> and a redirect=com<X> setting to the [boot loader] section. The value of com<X> is set by the /port parameter.

OFF - Disables output to a remote computer. Removes the /redirect option from the specified <OSEntryLineNum> and the redirect=com<X> setting from the [boot loader] section.

EDIT - Allows changes to port settings by changing the redirect=com<X> setting in the [boot loader] section. The value of com<X> is reset to the value specified by the /port parameter.

/s <Computer>

Specifies the name or IP address of a remote computer (do not use backslashes). The default is the local computer.

/u <Domain>\<User>

Runs the command with the account permissions of the user specified by <User> or <Domain>\<User>. The default is the permissions of the current logged on user on the computer issuing the command.

/p <Password>

Specifies the password of the user account that is specified in the /u parameter.

/port {COM1 | COM2 | COM3 | COM4 | BIOSSET}

Specifies the COM port to be used for redirection. BIOSSET directs Emergency Management Services to get the BIOS settings to determine which port should be used for redirection. Do not use the /port parameter if remotely administered output is being disabled.

/baud {9600 | 19200 | 38400| 57600 | 115200}

Specifies the baud rate to be used for redirection. Do not use the /baud parameter if remotely administered output is being disabled.

/id <OSEntryLineNum>

Specifies the operating system entry line number to which the Emergency Management Services option is added in the [operating systems] section of the Boot.ini file. The first line after the [operating systems] section header is 1. This parameter is required when the Emergency Management Services value is set to ON or OFF.

/?

Displays help at the command prompt.

Examples

The following examples show how you can use the bootcfg /ems command:

Copy Code
bootcfg /ems on /port com1 /baud 19200 /id 2
bootcfg /ems on /port biosset /id 3
bootcfg /s srvmain /ems off /id 2
bootcfg /ems edit /port com2 /baud 115200
bootcfg /s srvmain /u maindom\hiropln /p p@ssW23 /ems off /id 2

Additional references

Command-Line Syntax Key


Bootcfg /query

Applies To: Windows Vista,Windows Server 2008

Queries and displays the [boot loader] and [operating systems] section entries from Boot.ini.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
bootcfg /query [/s <Computer> [/u <Domain>\<User> /p <Password>]]

Parameters

Term | Definition
/s <Computer> | Specifies the name or IP address of a remote computer (do not use backslashes). The default is the local computer.
/u <Domain>\<User> | Runs the command with the account permissions of the user specified by <User> or <Domain>\<User>. The default is the permissions of the current logged on user on the computer issuing the command.
/p <Password> | Specifies the password of the user account that is specified in the /u parameter.
/? | Displays help at the command prompt.
Remarks
  • The following is a sample of bootcfg /query output:

    Copy Code
    Boot Loader Settings
--------------------
timeout: 30
default: multi(0)disk(0)rdisk(0)partition(1)\WINDOWS

Boot Entries
------------
Boot entry ID:   1
Friendly Name:   ""
Path:            multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
OS Load Options: /fastdetect /debug /debugport=com1:
  • The Boot Loader Settings portion of the bootcfg query output displays each entry in the [boot loader] section of Boot.ini.

  • The Boot Entries portion of the bootcfg query output displays the following detail for each operating system entry in the [operating systems] section of Boot.ini: Boot entry ID, Friendly Name, Path, and OS Load Options.

Examples

The following examples show how you can use the bootcfg /query command:

Copy Code
bootcfg /query
bootcfg /query /s srvmain /u maindom\hiropln /p p@ssW23
bootcfg /query /u hiropln /p p@ssW23

Additional references

Command-Line Syntax Key


Bootcfg /raw

Applies To: Windows Server 2008,Windows Vista

Adds operating system load options specified as a string to an operating system entry in the [operating systems] section of the Boot.ini file.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
bootcfg /raw [/s <Computer> [/u <Domain>\<User> /p <Password>]] <OSLoadOptionsString> [/id <OSEntryLineNum>] [/a]

Parameters

Term | Definition
/s <Computer> | Specifies the name or IP address of a remote computer (do not use backslashes). The default is the local computer.
/u <Domain> \<User> | Runs the command with the account permissions of the user specified by <User> or <Domain>\<User>. The default is the permissions of the current logged on user on the computer issuing the command.
/p <Password> | Specifies the password of the user account that is specified in the /u parameter.
<OSLoadOptionsString> | Specifies the operating system load options to add to the operating system entry. These load options will replace any existing load options associated with the operating system entry. No validation of <OSLoadOptions> is done.
/id <OSEntryLineNum> | Specifies the operating system entry line number in the [operating systems] section of the Boot.ini file to update. The first line after the [operating systems] section header is 1.
/a | Specifies that the operating system options being added should be appended to any existing operating system options.
/? | Displays help at the command prompt.
Remarks
  • Bootcfg raw is used to add text to the end of an operating system entry, overwriting any existing operating system entry options. This text should contain valid OS Load Options such as /debug, /fastdetect, /nodebug, /baudrate, /crashdebug, and /sos. For example, the following command adds "/debug /fastdetect" to the end of the first operating system entry, replacing any previous operating system entry options:

    Copy Code
    bootcfg /raw "/debug /fastdetect" /id 1

Examples

The following examples show how you can use the bootcfg /raw command:

Copy Code
bootcfg /raw "/debug /sos" /id 2
bootcfg /raw /s srvmain /u maindom\hiropln /p p@ssW23 "/crashdebug " /id 2

Additional references

Command-Line Syntax Key


Bootcfg /rmsw

Applies To: Windows Vista,Windows Server 2008

Removes operating system load options for a specified operating system entry.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
bootcfg /rmsw [/s <Computer> [/u <Domain>\<User> [/p <Password>]]] [/mm] [/bv] [/so] [/ng] /id <OSEntryLineNum>

Parameters

Parameter | Description
/s <Computer> | Specifies the name or IP address of a remote computer (do not use backslashes). The default is the local computer.
/u <Domain>\<User> | Runs the command with the account permissions of the user specified by <User> or <Domain>\<User>. The default is the permissions of the current logged on user on the computer issuing the command.
/p <Password> | Specifies the password of the user account that is specified in the /u parameter.
/mm | Removes the /maxmem option and its associated maximum memory value from the specified <OSEntryLineNum>. The /maxmem option specifies the maximum amount of RAM that the operating system can use.
/bv | Removes the /basevideo option from the specified <OSEntryLineNum>. The /basevideo option directs the operating system to use standard VGA mode for the installed video driver.
/so | Removes the /sos option from the specified <OSEntryLineNum>. The /sos option directs the operating system to display device driver names while they are being loaded.
/ng | Removes the /noguiboot option from the specified <OSEntryLineNum>. The /noguiboot option disables the Windows XP Professional progress bar that appears before the CTRL+ALT+DEL logon prompt.
/id <OSEntryLineNum> | Specifies the operating system entry line number in the [operating systems] section of the Boot.ini file from which the OS Load Options are removed. The first line after the [operating systems] section header is 1.
/? | Displays help at the command prompt.

Examples

The following examples show how you can use the bootcfg /rmsw command:

Copy Code
bootcfg /rmsw /mm 64 /id 2
bootcfg /rmsw /so /id 3
bootcfg /rmsw /so /ng /s srvmain /u hiropln /id 2
bootcfg /rmsw /ng /id 2
bootcfg /rmsw /mm 96 /ng /s srvmain /u maindom\hiropln /p p@ssW23 /id 2

Additional references

Command-Line Syntax Key


Bootcfg /timeout

Applies To: Windows Server 2008,Windows Vista

Changes the operating system time-out value.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
bootcfg /timeout <TimeOutValue> [/s <Computer> [/u <Domain\User>/p <Password>]]

Parameters

Parameter | Description
/timeout <TimeOutValue> | Specifies the timeout value in the [boot loader] section. The <TimeOutValue> is the number of seconds the user has to select an operating system from the boot loader screen before NTLDR loads the default. Valid range for <TimeOutValue> is 0-999. If the value is 0, then NTLDR immediately starts the default operating system without displaying the boot loader screen.
/s <Computer> | Specifies the name or IP address of a remote computer (do not use backslashes). The default is the local computer.
/u <Domain\User> | Runs the command with the account permissions of the user specified by <User> or <Domain\User>. The default is the permissions of the current logged on user on the computer issuing the command.
/p <Password> | Specifies the <Password> of the user account that is specified in the /u parameter.
/? | Displays help at the command prompt.

Examples

The following examples show how you can use the bootcfg /timeout command:

Copy Code
bootcfg /timeout 30
bootcfg /s srvmain /u maindom\hiropln /p p@ssW23 /timeout 50

Additional references

Command-Line Syntax Key


Break

Applies To: Windows Server 2008,Windows Vista

Sets or clears extended CTRL+C checking on MS-DOS systems. If used without parameters, break displays the current setting.

Note
This command is no longer in use. It is included only to preserve compatibility with existing MS-DOS files, but it has no effect at the command line because the functionality is automatic.

Syntax

Copy Code
break=[on|off]

Remarks

If command extensions are enabled and running on the Windows platform, inserting the break command into a batch file enters a hard-coded breakpoint if being debugged by a debugger.

Additional references

Command-Line Syntax Key


Cacls

Applies To: Windows Vista,Windows Server 2008

This command has been deprecated. Please use Icacls instead.


Call

Applies To: Windows Server 2008,Windows Vista

Calls one batch program from another without stopping the parent batch program. The call command accepts labels as the target of the call.

Note
Call has no effect at the command prompt when it is used outside of a script or batch file.

For examples of how to use this command, see Examples.

Syntax

Copy Code
call [Drive:][Path]<FileName> [<BatchParameters>] [:<Label> [<Arguments>]]

Parameters

Parameter | Description
[<Drive>:][<Path>]<FileName> | Specifies the location and name of the batch program that you want to call. The FileName parameter is required, and it must have a .bat or .cmd extension.
<BatchParameters> | Specifies any command-line information required by the batch program.
:<Label> | Specifies the label that you want a batch program control to jump to.
<Arguments> | Specifies the command-line information to be passed to the new instance of the batch program, beginning at :Label.
/? | Displays help at the command prompt.

Batch parameters

The batch script argument references (%0, %1, ...) are listed in the following tables.

%* in a batch script refers to all the arguments (for example, %1, %2, %3...)

You can use the following optional syntaxes as substitutions for batch parameters (%n):

Batch Parameter | Description
%~1 | Expands %1 and removes surrounding quotation marks (" ").
%~f1 | Expands %1 to a fully qualified path.
%~d1 | Expands %1 to a drive letter only.
%~p1 | Expands %1 to a path only.
%~n1 | Expands %1 to a file name only.
%~x1 | Expands %1 to a file name extension only.
%~s1 | Expands %1 to a fully qualified path that contains short names only.
%~a1 | Expands %1 to the file attributes.
%~t1 | Expands %1 to the date and time of file.
%~z1 | Expands %1 to the size of the file.
%~$PATH:1 | Searches the directories listed in the PATH environment variable, and expands %1 to the fully qualified name of the first directory found. If the environment variable name is not defined or the file is not found by the search, then this modifier expands to the empty string.

The following table shows how you can combine modifiers with the batch parameters for compound results:

Batch Parameter with Modifier | Description
%~dp1 | Expands %1 to a drive letter and path only.
%~nx1 | Expands %1 to a file name and extension only.
%~dp$PATH:1 | Searches the directories listed in the PATH environment variable for %1, and then expands to the drive letter and path of the first directory found.
%~ftza1 | Expands %1 to display output similar to the dir command.

In the above examples, %1 and PATH can be replaced by other valid values. The %~ syntax is terminated by a valid argument number. The %~ modifiers cannot be used with %*.

Remarks

  • Using batch parameters

    Batch parameters can contain any information that you can pass to a batch program, including command-line options, file names, the batch parameters %0 through %9, and variables (for example, %baud%).

  • Using the Label parameter

    By using call with the Label parameter, you create a new batch file context and pass control to the statement after the specified label. The first time the end of the batch file is encountered (that is, after jumping to the label), control returns to the statement after the call statement. The second time the end of the batch file is encountered, the batch script is exited.

  • Using pipes and redirection symbols

    Do not use pipes (|) and redirection symbols (< or >) with call.

  • Making a recursive call

    You can create a batch program that calls itself. However, you must provide an exit condition. Otherwise, the parent and child batch programs can loop endlessly.

  • Working with command extensions

    If command extensions are enabled, call accepts Label as the target of the call. The correct syntax is as follows:

    call :<Label> <Arguments>

Examples

To run the Checknew.bat program from another batch program, type the following command in the parent batch program:

Copy Code
call checknew

If the parent batch program accepts two batch parameters and you want it to pass those parameters to Checknew.bat, type the following command in the parent batch program:

Copy Code
call checknew %1 %2

Additional references

Command-Line Syntax Key


Cd

Applies To: Windows Vista,Windows Server 2008

Displays the name of or changes the current directory. If used with only a drive letter (for example, cd C:), cd displays the names of the current directory in the specified drive. If used without parameters, cd displays the current drive and directory.

Note
This command is the same as the chdir command.

For examples of how to use this command, see Examples.

Syntax

Copy Code
cd [/d] [<Drive>:][<Path>]
cd [..]
chdir [/d] [<Drive>:][<Path>]
chdir [..]

Parameters

Parameter | Description
/d | Changes the current drive as well as the current directory for a drive.
<Drive>: | Specifies the drive to display or change (if different from the current drive).
<Path> | Specifies the path to the directory that you want to display or change.
[..] | Specifies that you want to change to the parent folder.
/? | Displays help at the command prompt.

Remarks

If command extensions are enabled, the following conditions apply to the cd command:

  • The current directory string is converted to use the same case as the names on the disk. For example, cd C:\TEMP would set the current directory to C:\Temp if that is the case on the disk.

  • Spaces are not treated as delimiters, so Path can contain spaces without enclosing quotation marks. For example:

    Copy Code
    cd username\programs\start menu
    is the same as:

    Copy Code
    cd "username\programs\start menu"
    The quotation marks are required, however, if extensions are disabled.

To disable command extensions, type:

Copy Code
cmd /e:off

Examples

The root directory is the top of the directory hierarchy for a drive. To return to the root directory, type:

Copy Code
cd\

To change the default directory on a drive that is different from the one you are on, type:

Copy Code
cd [<Drive>:\[<Directory>]]

To verify the change to the directory, type:

Copy Code
cd [<Drive>:]

Additional references

Command-Line Syntax Key


Certreq

Applies To: Windows Server 2008,Windows Vista

Certreq can be used to request certificates from a certification authority (CA), to retrieve a response to a previous request from a CA, to create a new request from an .inf file, to accept and install a response to a request, to construct a cross-certification or qualified subordination request from an existing CA certificate or request, and to sign a cross-certification or qualified subordination request.

For examples of how to use this command, see Examples.

Syntax

Copy Code
Certreq [-submit] [-retrieve RequestID] [-new] [-accept] [-policy]
[-sign] [-attrib AttributeString] [-binary]
[-config CAMachineName\CAName] [-crl] [-rpc] [-cert CertID]
[RequestFileIn | CertChainFileIn | FullResponseFileIn | CertFileIn | PolicyFileIn]
[RequestFileOut | CertChainFileOut | FullResponseFileOut | CertFileOut | PKCS10FileOut]

Parameters

Parameters | Description
-submit | Submits a request to a CA.
-retrieve RequestID | Retrieves a response to a previous request from a CA.
-new | Creates a new request from an .inf file.
-accept | Accepts and installs a response to a certificate request.
-policy | Sets the policy for a request.
-sign | Signs a cross-certification or qualified subordination request.
-attrib AttributeString | Specifies the Name and Value string pairs, separated by a colon. Separate Name and Value string pairs with \n (for example, Name1:Value1\nName2:Value2).
-binary | Formats output files as binary instead of base64-encoded.
-config CAMachineName\CAName | Processes the operation by using the CA specified in the configuration string, which is CAMachineName\CAName.
-crl | Includes certificate revocation lists (CRLs) in the output to the base64-encoded PKCS #7 file specified by CertChainFileOut or to the base64-encoded file specified by RequestFileOut.
-rpc | Instructs Active Directory Certificate Services (AD CS) to use a remote procedure call (RPC) server connection instead of Distributed COM.
-cert CertID | Specifies the signing certificate by common name, serial number, Secure Hash Algorithm (SHA-1) key, or certificate hash.
CertChainFileIn | Specifies the base64-encoded or binary certificate chain input file that you want to use.
FullResponseFileIn | Specifies the base64-encoded or binary full response input file that you want to use.
CertFileIn | Specifies the base64-encoded or binary certificate input file that you want to use.
RequestFileIn | Specifies the base64-encoded or binary input file that you want to use. The file can be a PKCS #10 certificate request, a PKCS #7 certificate renewal request, a KEYGEN tag format certificate request, a Certificate Management protocol using Cryptographic Message Syntax (CMS) request (this protocol is also known as CMC), or a certificate file of the CA that you want to cross-certify.
PolicyFileIn | Specifies the .inf input file that contains the extension definitions that you want to use to qualify a request.
RequestFileOut | Specifies the base64-encoded file to which you want to send output.
PKCS10FileOut | Specifies the base64-encoded PKCS #10 file to which you want to send output.
CertFileOut | Specifies the binary or base64-encoded X.509 v3 file to which you want to send output.
CertChainFileOut | Specifies the binary or base64-encoded PKCS #7 file to which you want to send output.
FullResponseFileOut | Specifies the binary or base64-encoded full response file to which you want to send output.
-? | Displays a list of certreq commands.

Remarks

  • You must specify the CAComputerName or CAName in -config CAComputerName\CAName. Otherwise, the Select Certificate Authority dialog box appears and displays a list of all CAs that are available.

  • If you use -config - instead of -config CAComputerName\CAName, the operation is processed using the default CA.

  • You can use certreq -retrieve RequestID to retrieve the certificate after the CA has actually issued it. You can also use this command to retrieve any certificate that has ever been issued by the CA, including revoked or expired certificates, without regard to whether the certificate's request was ever in the pending state.

  • If you submit a request to the CA, the policy module of the CA might leave the request in a pending state and return the RequestID for display. Eventually, the CA's administrator will issue the certificate or deny the request.

Examples

You can use this example to submit a request to a CA.

Copy Code
certreq -submit [-attrib AttributeString] [-binary] [-config CAMachineName\CAName] [-crl] [-rpc]
[RequestFileIn [CertFileOut [CertChainFileOut [FullResponseFileOut]]]]

You can use this example to retrieve a response to a previous request from a CA.

Copy Code
certreq -retrieve [-binary] [-config CAMachineName\CAName] [-crl]
[-rpc] RequestID [CertFileOut [CertChainFileOut [FullResponseFileOut]]]

You can use this example to create a new request from an .inf file.

Copy Code
certreq -new [-attrib AttributeString] [-binary] [-cert CertID] [PolicyFileIn [RequestFileOut]]

You can use this example to accept and install a response to a certificate request.

Copy Code
certreq -accept [{CertChainFileIn | FullResponseFileIn | CertFileIn}]

You can use this example to construct a cross-certification or qualified subordination request from an existing CA certificate or request.

Copy Code
certreq -policy [-attrib AttributeString] [-binary] [-cert CertID] [RequestFileIn [PolicyFileIn [RequestFileOut [PKCS10FileOut]]]]

You can use this example to sign a cross-certification or qualified subordination request.

Copy Code
certreq -sign [-binary] [-certCertID] [-crl]
[RequestFileIn [RequestFileOut]]

Additional references

Command-Line Syntax Key


Certutil

Applies To: Windows Server 2008

Certutil.exe is a command-line program that is installed as part of Certificate Services. You can use Certutil.exe to dump and display certification authority (CA) configuration information, configure Certificate Services, back up and restore CA components, and verify certificates, key pairs, and certificate chains.

For examples of how to use this command, see Examples.

Syntax

Copy Code
Certutil <-parameter> [-parameter]

Parameters

Parameters Description
Copy Code
-dump

Dump configuration information or files

Copy Code
-asn

Parse ASN.1 file

Copy Code
-decodehex

Decode hexadecimal-encoded file

Copy Code
-decode

Decode a Base64-encoded file

Copy Code
-encode

Encode a file to Base64

Copy Code
-deny

Deny a pending certificate request

Copy Code
-resubmit

Resubmit a pending certificate request

Copy Code
-setattributes

Set attributes for a pending certificate request

Copy Code
-setextension

Set an extension for a pending certificate request

Copy Code
-revoke

Revoke a certificate

Copy Code
-isvalid

Display the disposition of the current certificate

Copy Code
-getconfig

Get the default configuration string

Copy Code
-ping

Attempt to contact the Active Directory Certificate Services Request interface

Copy Code
-pingadmin

Attempt to contact the Active Directory Certificate Services Admin interface

Copy Code
-CAInfo

Display information about the certification authority

Copy Code
-ca.cert

Retrieve the certificate for the certification authority

Copy Code
-ca.chain

Retrieve the certificate chain for the certification authority

Copy Code
-GetCRL

Get a certificate revocation list (CRL)

Copy Code
-CRL

Publish new certificate revocation lists (CRLs) [or only delta CRLs]

Copy Code
-shutdown

Shutdown Active Directory Certificate Services

Copy Code
-installCert

Install a certification authority certificate

Copy Code
-renewCert

Renew a certification authority certificate

Copy Code
-schema

Dump the schema for the certificate

Copy Code
-view

Dump the certificate view

Copy Code
-db

Dump the raw database

Copy Code
-deleterow

Delete a row from the server database

Copy Code
-back up

Backup Active Directory Certificate Services

Copy Code
-backupDB

Backup the Active Directory Certificate Services database

Copy Code
-backupKey

Backup the Active Directory Certificate Services certificate and private key

Copy Code
-restore

Restore Active Directory Certificate Services

Copy Code
-restoreDB

Restore the Active Directory Certificate Services database

Copy Code
-restoreKey

Restore the Active Directory Certificate Services certificate and private key

Copy Code
-dynamicfilelist

Display a dynamic file list

Copy Code
-databaselocation

Display database locations

Copy Code
-hashfile

Generate and display a cryptographic hash over a file

Copy Code
-store

Dump the certificate store

Copy Code
-addstore

Add a certificate to the store

Copy Code
-delstore

Delete a certificate from the store

Copy Code
-verifystore

Verify a certificate in the store

Copy Code
-repairstore

Repair a key association or update certificate properties or the key security descriptor

Copy Code
-viewstore

Dump the certificates store

Copy Code
-viewdelstore

Delete a certificate from the store

Copy Code
-dsPublish

Publish a certificate or certificate revocation list (CRL) to Active Directory

Copy Code
-Template

Display certificate templates

Copy Code
-TemplateCAs

Display the certification authorities (CAs) for a certificate template

Copy Code
-CATemplates

Display the certificate templates for a certification authority (CA)

Copy Code
-InstallDefaultTemplates

Install default certificate templates

Copy Code
-URLCache

Display or delete URL cache entries

Copy Code
-pulse

Pulse auto enrollment events

Copy Code
-MachineInfo

Display information about the Active Directory machine object

Copy Code
-DCInfo

Display information about the domain controller

Copy Code
-EntInfo

Display information about an enterprise CA

Copy Code
-TCAInfo

Display information about the CA

Copy Code
-SCInfo

Display information about the smart card

Copy Code
-SCRoots

Manage smart card root certificates

Copy Code
-verifykeys

Verify a public or private key set

Copy Code
-verify

Verify a certificate, certificate revocation list (CRL), or certificate chain

Copy Code
-sign

Re-sign a certificate revocation list (CRL) or certificate

Copy Code
-vroot

Create or delete web virtual roots and file shares

Copy Code
-vocsproot

Create or delete web virtual roots for an OCSP web proxy

Copy Code
-oid

Display the object identifier or set a display name

Copy Code
-error

Display the message text associated with an error code

Copy Code
-getreg

Display a registry value

Copy Code
-setreg

Set a registry value

Copy Code
-delreg

Delete a registry value

Copy Code
-ImportKMS

Import user keys and certificates into the server database for key archival

Copy Code
-ImportCert

Import a certificate file into the database

Copy Code
-GetKey

Retrieve an archived private key recovery blob

Copy Code
-RecoverKey

Recover an archived private key

Copy Code
-MergePFX

Merge PFX files

Copy Code
-ConvertEPF

Convert a PFX file into an EPF file


Change

Applies To: Windows Server 2008,Windows Vista

Changes terminal server settings for logons, COM port mappings, and install mode.

Syntax

Copy Code
change logon
change port
change user

Parameters

Parameter | Description
Change logon | Enables or disables logons from client sessions on a terminal server, or displays current logon status.
Change port | Lists or changes the COM port mappings to be compatible with MS-DOS applications.
Change user | Changes the install mode for the terminal server.

Additional references

Command-Line Syntax Key

Terminal Services Command Reference


Change logon

Applies To: Windows Vista,Windows Server 2008

Enables or disables logons from client sessions, or displays current logon status.

This utility is useful for system maintenance.

For examples of how to use this command, see Examples.

Syntax

Copy Code
change logon {/query | /enable | /disable | /drain | /drainuntilrestart}

Parameters

Parameter | Description
/query | Displays the current logon status, whether enabled or disabled.
/enable | Enables logons from client sessions, but not from the console.
/disable | Disables subsequent logons from client sessions, but not from the console. Does not affect currently logged on users.
/drain | Disables logons from new client sessions, but allows reconnections to existing sessions.
/drainuntilrestart | Disables logons from new client sessions until the computer is restarted, but allows reconnections to existing sessions.
/? | Displays help at the command prompt.

Remarks

  • Only administrators can use the change logon command.

  • Logons are re-enabled when you restart the system. If you are connected to the terminal server from a client session and disable logons, and then log off before re-enabling logons, you will not be able to reconnect to your session. To re-enable logons from client sessions, log on at the console.

Examples

  • To display the current logon status, type:

    Copy Code
    change logon /query
  • To enable logons from client sessions, type:

    Copy Code
    change logon /enable
  • To disable client logons, type:

    Copy Code
    change logon /disable

Additional references

Command-Line Syntax Key

Change

Terminal Services Command Reference


Change port

Applies To: Windows Server 2008,Windows Vista

Lists or changes the COM port mappings to be compatible with MS-DOS applications.

For examples of how to use this command, see Examples.

Syntax

Copy Code
change port [<PortX>=<PortY> | /d <PortX> | /query]

Parameters

Parameter | Description
<PortX>=<PortY> | Maps COM <PortX> to <PortY>.
/d <PortX> | Deletes the mapping for COM <PortX>.
/query | Displays the current port mappings.
/? | Displays help at the command prompt.

Remarks

  • Most MS-DOS applications support only COM1 through COM4 serial ports. The change port command maps a serial port to a different port number, allowing applications that do not support high-numbered COM ports to access the serial port. Remapping works only for the current session and is not retained if you log off from a session and then log on again.

  • Use change port without any parameters to display the available COM ports and their current mappings.

Examples

  • To map COM12 to COM1 for use by an MS-DOS-based application, type:

    Copy Code
    change port com12=com1
  • To display the current port mappings, type:

    Copy Code
    change port /query

Additional references

Command-Line Syntax Key

Change

Terminal Services Command Reference


Change user

Applies To: Windows Vista,Windows Server 2008

Changes the install mode for the terminal server.

For examples of how to use this command, see Examples.

Syntax

Copy Code
change user {/execute | /install | /query}

Parameters

Parameter | Description
/execute | Enables .ini file mapping to the home directory. This is the default setting.
/install | Disables .ini file mapping to the home directory. All .ini files are read and written to the system directory. You must disable .ini file mapping when installing applications on a terminal server.
/query | Displays the current setting for .ini file mapping.
/? | Displays help at the command prompt.

Remarks

  • Use change user /install before installing an application to create .ini files for the application in the system directory. These files are used as the source when user-specific .ini files are created. After installing the application, use change user /execute to revert to standard .ini file mapping.

  • The first time that you run the application, it searches the home directory for its .ini files. If the .ini files are not found in the home directory, but are found in the system directory, Terminal Services copies the .ini files to the home directory, ensuring that each user has a unique copy of the application .ini files. Any new .ini files are created in the home directory.

  • Each user should have a unique copy of the .ini files for an application. This prevents instances where different users might have incompatible application configurations (for example, different default directories or screen resolutions).

  • When the system is in install mode (that is, change user /install), several things occur. All registry entries that are created are shadowed under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\Install, in either the \SOFTWARE subkey or the \MACHINE subkey. Subkeys added to HKEY_CURRENT_USER are copied under the \SOFTWARE subkey, and subkeys added to HKEY_LOCAL_MACHINE are copied under the \MACHINE subkey. If the application queries the Windows directory by using system calls, such as GetWindowsDirectory, the terminal server returns the systemroot directory. If any .ini file entries are added by using system calls, such as WritePrivateProfileString, they are added to the .ini files under the systemroot directory.

  • When the system returns to execution mode (that is, change user /execute), and the application tries to read a registry entry under HKEY_CURRENT_USER that does not exist, Terminal Services checks to see whether a copy of the key exists under the \Terminal Server\Install subkey. If it does, the subkeys are copied to the appropriate location under HKEY_CURRENT_USER. If the application tries to read from an .ini file that does not exist, Terminal Services searches for that .ini file under the system root. If the .ini file is in the system root, it is copied to the \Windows subdirectory of the user's home directory. If the application queries the Windows directory, the terminal server returns the \Windows subdirectory of the user's home directory.

  • When you log on, Terminal Services checks whether its system .ini files are newer than the .ini files on your computer. If the system version is newer, your .ini file is either replaced or merged with the newer version. This depends on whether or not the INISYNC bit, 0x40, is set for this .ini file. Your previous version of the .ini file is renamed as Inifile.ctx. If the system registry values under the \Terminal Server\Install subkey are newer than your version under HKEY_CURRENT_USER, your version of the subkeys is deleted and replaced with the new subkeys from \Terminal Server\Install.

Examples

  • To disable .ini file mapping in the home directory, type:

    Copy Code
    change user /install
  • To enable .ini file mapping in the home directory, type:

    Copy Code
    change user /execute
  • To display the current setting for .ini file mapping, type:

    Copy Code
    change user /query

Additional references

Command-Line Syntax Key

Change

Terminal Services Command Reference


Chcp

Applies To: Windows Server 2008,Windows Vista

Changes the active console code page. If used without parameters, chcp displays the number of the active console code page.

For examples of how to use this command, see Examples.

Syntax

Copy Code
chcp [<NNN>]

Parameters

Parameter | Description
<NNN> | Specifies the code page.
/? | Displays help at the command prompt.

The following table lists each supported code page and its country/region or language:

Code page | Country/region or language
437 | United States
850 | Multilingual (Latin I)
852 | Slavic (Latin II)
855 | Cyrillic (Russian)
857 | Turkish
860 | Portuguese
861 | Icelandic
863 | Canadian-French
865 | Nordic
866 | Russian
869 | Modern Greek

Remarks

  • Only the original equipment manufacturer (OEM) code page that is installed with Windows appears correctly in a Command Prompt window that uses Raster fonts. Other code pages appear correctly in full-screen mode or in Command Prompt windows that use TrueType fonts.

  • You do not need to prepare code pages (as in MS-DOS).

  • Programs that you start after you assign a new code page use the new code page. However, programs (except Cmd.exe) that you start before you assign the new code page use the original code page.

Examples

To view the active code page setting, type:

Copy Code
chcp

A message similar to the following appears:

Active code page: 437

To change the active code page to 850 (Multilingual), type:

Copy Code
chcp 850

If the specified code page is invalid, the following error message appears:

Invalid code page

Additional references

Command-Line Syntax Key


Chdir

Applies To: Windows Vista,Windows Server 2008

This command is the same as the cd command. See Cd for syntax and parameters.


Chkdsk

Applies To: Windows Vista,Windows Server 2008

Checks the file system and file system metadata of a volume for logical and physical errors. If used without parameters, chkdsk displays only the status of the volume and does not fix any errors. If used with the /f, /r, /x, or /b parameters, it fixes errors on the volume.

Important
Membership in the local Administrators group, or equivalent, is the minimum required to run chkdsk.

Important
Interrupting chkdsk is not recommended. However, canceling or interrupting chkdsk should not leave the volume any more corrupt than it was before chkdsk was run. Rerunning chkdsk checks and repairs any remaining corruption on the volume.

For examples of how to use this command, see Examples.

Syntax

Copy Code
chkdsk [<Volume>[[<Path>]<FileName>]] [/f] [/v] [/r] [/x] [/i] [/c] [/l[:<Size>]] [/b]

Parameters

Parameter | Description
<Volume> | Specifies the drive letter (followed by a colon), mount point, or volume name.
[<Path>]<FileName> | Use with file allocation table (FAT) and FAT32 only. Specifies the location and name of a file or set of files that you want chkdsk to check for fragmentation. You can use the ? and * wildcard characters to specify multiple files.
/f | Fixes errors on the disk. The disk must be locked. If chkdsk cannot lock the drive, a message appears that asks you if you want to check the drive the next time you restart the computer.
/v | Displays the name of each file in every directory as the disk is checked.
/r | Locates bad sectors and recovers readable information. The disk must be locked. /r includes the functionality of /f, with the additional analysis of physical disk errors.
/x | Forces the volume to dismount first, if necessary. All open handles to the drive are invalidated. /x also includes the functionality of /f.
/i | Use with NTFS only. Performs a less vigorous check of index entries, which reduces the amount of time required to run chkdsk.
/c | Use with NTFS only. Does not check cycles within the folder structure, which reduces the amount of time required to run chkdsk.
/l[:<Size>] | Use with NTFS only. Changes the log file size to the size you type. If you omit the size parameter, /l displays the current size.
/b | NTFS only: Clears the list of bad clusters on the volume and rescans all allocated and free clusters for errors. /b includes the functionality of /r. Use this parameter after imaging a volume to a new hard disk drive.
/? | Displays help at the command prompt.

Remarks

  • Skipping volume checks

    The /i or /c switch reduces the amount of time required to run chkdsk by skipping certain volume checks.

  • Checking a locked drive at restart

    If you want chkdsk to correct disk errors, you cannot have open files on the drive. If files are open, the following error message appears:

    Copy Code
    Chkdsk cannot run because the volume is in use by another process. Would you like to schedule this volume to be checked the next time the system restarts? (Y/N)
    If you choose to check the drive the next time you restart the computer, chkdsk checks the drive and corrects errors automatically when you restart the computer. If the drive partition is a boot partition, chkdsk automatically restarts the computer after it checks the drive.

    You can also use the chkntfs /c command to schedule the volume to be checked the next time the computer is restarted. Use the fsutil dirty set command to set the volume's dirty bit (indicating corruption), so that Windows runs chkdsk when the computer is restarted.

  • Reporting disk errors

    You should use chkdsk occasionally on FAT and NTFS file systems to check for disk errors. Chkdsk examines disk space and disk use and provides a status report specific to each file system. The status report shows errors found in the file system. If you run chkdsk without the /f parameter on an active partition, it might report spurious errors because it cannot lock the drive.

  • Fixing logical disk errors

    Chkdsk corrects logical disk errors only if you specify the /f parameter. Chkdsk must be able to lock the drive to correct errors.

    Because repairs on FAT file systems usually change a disk's file allocation table and sometimes cause a loss of data, chkdsk might display a confirmation message similar to the following:

    Copy Code
    10 lost allocation units found in 3 chains.
Convert lost chains to files?
    If you press Y, Windows saves each lost chain in the root directory as a file with a name in the format File<nnnn>.chk. When chkdsk finishes, you can check these files to see if they contain any data you need. If you press N, Windows fixes the disk, but it does not save the contents of the lost allocation units.

    If you do not use the /f parameter, chkdsk displays a message that the file needs to be fixed, but it does not fix any errors.

    If you use chkdsk /f on a very large disk or a disk with a very large number of files (for example, millions of files), chkdsk /f might take a long time to complete.

  • Finding physical disk errors

    Use the /r parameter to find physical disk errors in the file system and attempt to recover data from any affected disk sectors.

  • Using chkdsk with open files

    If you specify the /f parameter, chkdsk displays an error message if there are open files on the disk. If you do not specify the /f parameter and open files exist, chkdsk might report lost allocation units on the disk. This could happen if open files have not yet been recorded in the file allocation table. If chkdsk reports the loss of a large number of allocation units, consider repairing the disk.

  • Using chkdsk with Shadow Copies for Shared Folders

    Because the Shadow Copies for Shared Folders source volume cannot be locked while Shadow Copies for Shared Folders is enabled, running chkdsk against the source volume might report false errors or cause chkdsk to unexpectedly quit. You can, however, check shadow copies for errors by running chkdsk in Read-only mode (without parameters) to check the Shadow Copies for Shared Folders storage volume.

  • Understanding exit codes

    The following table lists the exit codes that chkdsk reports after it has finished.

    Exit code Description

    0

    No errors were found.

    1

    Errors were found and fixed.

    2

    Performed disk cleanup (such as garbage collection) or did not perform cleanup because /f was not specified.

    3

    Could not check the disk, errors could not be fixed, or errors were not fixed because /f was not specified.

  • The chkdsk command, with different parameters, is available from the Recovery Console.

  • On servers that are infrequently restarted, you may want to use the chkntfs or the fsutil dirty query commands to determine whether the volume's dirty bit is already set before running chkdsk.

Examples

If you want to check the disk in drive D and have Windows fix errors, type:

Copy Code
chkdsk d: /f

If it encounters errors, chkdsk pauses and displays messages. Chkdsk finishes by displaying a report that lists the status of the disk. You cannot open any files on the specified drive until chkdsk finishes.

To check all files on a FAT disk in the current directory for noncontiguous blocks, type:

Copy Code
chkdsk *.*

Chkdsk displays a status report, and then lists the files that match the file specifications that have noncontiguous blocks.

Additional references

Command-Line Syntax Key


Chglogon

Applies To: Windows Server 2008,Windows Vista

Enables or disables logons from client sessions on a terminal server, or displays current logon status.

Remarks

This command is the same as the change logon command.

Additional references

Change logon

Command-Line Syntax Key

Terminal Services Command Reference


Chgport

Applies To: Windows Vista,Windows Server 2008

Lists or changes the COM port mappings to be compatible with MS-DOS applications.

Remarks

This command is the same as the change port command.

Additional references

Change port

Command-Line Syntax Key

Terminal Services Command Reference


Chgusr

Applies To: Windows Vista,Windows Server 2003

Changes the install mode for the terminal server.

Remarks

This command is the same as the change user command.

Additional references

Change user

Command-Line Syntax Key

Terminal Services Command Reference


Chkntfs

Applies To: Windows Server 2008,Windows Vista

Displays or modifies automatic disk checking when the computer is started. If used without options, chkntfs displays the file system of the specified volume. If automatic file checking is scheduled to run, chkntfs displays whether the specified volume is dirty or is scheduled to be checked the next time the computer is started.

Note
To run chkntfs, you must be a member of the Administrators group.

For examples of how to use this command, see Examples.

Syntax

Copy Code
chkntfs <Volume> [...]
chkntfs [/d]
chkntfs [/t[:<Time>]]
chkntfs [/x <Volume> [...]]
chkntfs [/c <Volume> [...]]

Parameters

Parameter | Description
<Volume> [...] | Specifies one or more volumes to check when the computer starts. Valid volumes include drive letters (followed by a colon), mount points, or volume names.
/d | Restores all chkntfs default settings, except the countdown time for automatic file checking. By default, all volumes are checked when the computer is started, and chkdsk runs on those that are dirty.
/t [:<Time>] | Changes the Autochk.exe initiation countdown time to the amount of time specified in seconds. If you do not enter a time, /t displays the current countdown time.
/x <Volume> [...] | Specifies one or more volumes to exclude from checking when the computer is started, even if the volume is marked as requiring chkdsk.
/c <Volume> [...] | Schedules one or more volumes to be checked when the computer is started, and runs chkdsk on those that are dirty.
/? | Displays help at the command prompt.

Examples

To display the type of file system for drive C, type:

Copy Code
chkntfs c:

The following output indicates an NTFS file system:

Copy Code
The type of the file system is NTFS.
Note
If automatic file checking is scheduled to run, additional output will display, indicating whether the drive is dirty or has been manually scheduled to be checked the next time the computer is started.

To display the Autochk.exe initiation countdown time, type:

Copy Code
chkntfs /t

For example, if the countdown time is set to 10 seconds, the following output displays:

Copy Code
The AUTOCHK initiation countdown time is set to 10 second(s).

To change the Autochk.exe initiation countdown time to 30 seconds, type:

Copy Code
chkntfs /t:30
Note
Although you can set the Autochk.exe initiation countdown time to zero, doing so will prevent you from canceling a potentially time-consuming automatic file check.

The /x command-line option is not accumulative. If you type it more than once, the most recent entry overrides the previous entry. To exclude multiple volumes from being checked, you must list each of them in a single command. For example, to exclude both the D and E volumes, type:

Copy Code
chkntfs /x d: e:

The /c command-line option is accumulative. If you type /c more than once, each entry remains. To ensure that only a particular volume is checked, reset the defaults to clear all previous commands, exclude all volumes from being checked, and then schedule automatic file checking on the desired volume.

For example, to schedule automatic file checking on the D volume but not the C or E volumes, type the following commands in order:

Copy Code
chkntfs /d
chkntfs /x c: d: e:
chkntfs /c d:

Additional references

Command-Line Syntax Key


Choice

Applies To: Windows Vista,Windows Server 2008

Prompts the user to select one item from a list of single-character choices in a batch program, and then returns the index of the selected choice. If used without parameters, choice displays the default choices Y and N.

For examples of how to use this command, see Examples.

Syntax

Copy Code
choice [/c [<Choice1><Choice2><…>]] [/n] [/cs] [/t <Timeout> /d <Choice>] [/m <"Text">]

Parameters

Parameter | Description
/c <Choice1><Choice2><…> | Specifies the list of choices to be created. Valid choices include a-z, A-Z, 0-9, and extended ASCII characters (128-254). The default list is "YN", which is displayed as [Y,N]?.
/n | Hides the list of choices, although the choices are still enabled and the message text (if specified by /m) is still displayed.
/cs | Specifies that the choices are case-sensitive. By default, the choices are not case-sensitive.
/t <Timeout> | Specifies the number of seconds to pause before using the default choice specified by /d. Acceptable values are from 0 to 9999. If /t is set to 0, choice does not pause before returning the default choice.
/d <Choice> | Specifies the default choice to use after waiting the number of seconds specified by /t. The default choice must be in the list of choices specified by /c.
/m <"Text"> | Specifies a message to display before the list of choices. If /m is not specified, only the choice prompt is displayed.
/? | Displays help at the command prompt.

Remarks

  • The ERRORLEVEL environment variable is set to the index of the key that the user selects from the list of choices. The first choice in the list returns a value of 1, the second a value of 2, and so on. If the user presses a key that is not a valid choice, choice sounds a warning beep. If choice detects an error condition, it returns an ERRORLEVEL value of 255. If the user presses CTRL+BREAK or CTRL+C, choice returns an ERRORLEVEL value of 0.

Note
When you use ERRORLEVEL values in a batch program, list them in decreasing order.

Examples

To present the choices Y, N, and C, type the following line in a batch file:

Copy Code
choice /c ync

The following prompt appears when the batch file runs the choice command:

Copy Code
[Y,N,C]?

To hide the choices Y, N, and C, but display the text "Yes, No, or Continue", type the following line in a batch file:

Copy Code
choice /c ync /n /m "Yes, No, or Continue?"

The following prompt appears when the batch file runs the choice command:

Copy Code
Yes, No, or Continue?
Note
If you use the /n parameter, but do not use /m, the user is not prompted when choice is waiting for input.

To show both the text and the options used in the previous examples, type the following line in a batch file:

Copy Code
choice /c ync /m "Yes, No, or Continue"

The following prompt appears when the batch file runs the choice command:

Copy Code
Yes, No, or Continue [Y,N,C]?

To set a time limit of five seconds and specify N as the default value, type the following line in a batch file:

Copy Code
choice /c ync /t 5 /d n

The following prompt appears when the batch file runs the choice command:

Copy Code
[Y,N,C]?
Note
In this example, if the user does not press a key within five seconds, choice selects N by default and returns an error value of 2. Otherwise, choice returns the value corresponding to the user's choice.

Additional references

Command-Line Syntax Key


Cipher

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Server 2003 with SP1,Windows Server 2003,Windows Vista,Windows Server 2003 with SP2,Windows Server 2003 R2,Windows 7

Displays or alters the encryption of directories and files on NTFS volumes. If used without parameters, cipher displays the encryption state of the current directory and any files it contains.

For examples of how to use this command, see Examples.

Syntax

Copy Code
cipher [/e | /d | /c] [/s:<Directory>] [/b] [/h] [PathName [...]]
cipher /k
cipher /r:<FileName> [/smartcard]
cipher /u [/n]
cipher /w:<Directory>
cipher /x[:efsfile] [FileName]
cipher /y
cipher /adduser [/certhash:<Hash> | /certfile:<FileName>] [/s:Directory] [/b] [/h] [PathName [...]]
cipher /removeuser /certhash:<Hash> [/s:<Directory>] [/b] [/h] [<PathName> [...]]
cipher /rekey [PathName [...]]

Parameters

Parameters | Description
/b | Aborts if an error is encountered. By default, cipher continues to run even if errors are encountered.
/c | Displays information on the encrypted file.
/d | Decrypts the specified files or directories.
/e | Encrypts the specified files or directories. Directories are marked so that files that are added afterward will be encrypted.
/h | Displays files with hidden or system attributes. By default, these files are not encrypted or decrypted.
/k | Creates a new certificate and key for use with Encrypting File System (EFS) files. If the /k parameter is specified, all other parameters are ignored.
/r:<FileName> [/smartcard] | Generates an EFS recovery agent key and certificate, then writes them to a .pfx file (containing certificate and private key) and a .cer file (containing only the certificate). If /smartcard is specified, it writes the recovery key and certificate to a smart card, and no .pfx file is generated.
/s:<Directory> | Performs the specified operation on all subdirectories in the specified Directory.
/u [/n] | Finds all encrypted files on the local drive(s). If used with the /n parameter, no updates are made. If used without /n, /u compares the user's file encryption key or the recovery agent's key to the current ones, and updates them if they have changed. This parameter works only with /n.
/w:<Directory> | Removes data from available unused disk space on the entire volume. If you use the /w parameter, all other parameters are ignored. The directory specified can be located anywhere in a local volume. If it is a mount point or points to a directory in another volume, the data on that volume is removed.
/x[:efsfile] [<FileName>] | Backs up the EFS certificate and keys to the specified file name. If used with :efsfile, /x backs up the user's certificate(s) that were used to encrypt the file. Otherwise, the user's current EFS certificate and keys are backed up.
/y | Displays your current EFS certificate thumbnail on the local computer.
/adduser [/certhash:<Hash> | /certfile:<FileName>] | Adds a user to the specified encrypted file(s). If used with /certhash, cipher searches for a certificate with the SHA1 hash specified. If used with /certfile, cipher extracts the certificate from the file name specified.
/rekey | Updates the specified encrypted file(s) to use the currently configured EFS key.
/removeuser /certhash:<Hash> | Removes a user from the specified file(s). The Hash provided for /certhash must be the SHA1 hash of the certificate to remove.
/? | Displays help at the command prompt.

Remarks

  • If the parent directory is not encrypted, an encrypted file could become decrypted when it is modified. Therefore, when you encrypt a file, you should also encrypt the parent directory.

  • An administrator can add the contents of a .cer file to the EFS recovery policy to create the recovery agent for users, and then import the .pfx file to recover individual files.

  • You can use multiple directory names and wildcards.

  • You must put spaces between multiple parameters.

Examples

To display the encryption status of each of the files and subdirectories in the current directory, type:

Copy Code
cipher

Encrypted files and directories are marked with an E. Unencrypted files and directories are marked with a U. For example, the following output indicates that the current directory and all its contents are currently unencrypted:

Copy Code
Listing C:\Users\MainUser\Documents\
New files added to this directory will not be encrypted.
U Private
U hello.doc
U hello.txt

To enable encryption on the Private directory used in the previous example, type:

Copy Code
cipher /e private

The following output displays:

Copy Code
Encrypting files in C:\Users\MainUser\Documents\
Private             [OK]
1 file(s) [or directorie(s)] within 1 directorie(s) were encrypted.

The cipher command displays the following output:

Copy Code
Listing C:\Users\MainUser\Documents\
New files added to this directory will not be encrypted.
E Private
U hello.doc
U hello.txt

Note that the Private directory is marked as encrypted.

Additional References

Command-Line Syntax Key


Clip

Applies To: Windows Server 2008,Windows Vista

Redirects command output from the command line to the Windows clipboard. You can then paste this text output into other programs.

For examples of how to use this command, see Examples.

Syntax

Copy Code
<Command> | clip
clip < <FileName>

Parameters

Parameter | Description
<Command> | Specifies a command whose output you want to send to the Windows Clipboard.
<FileName> | Specifies a file whose contents you want to send to the Windows Clipboard.
/? | Displays help at the command prompt.

Remarks

You can use the clip command to copy data directly into any application that can receive text from the Clipboard.

Examples

To copy the current directory listing to the Windows clipboard, type:

Copy Code
dir | clip

To copy the output of a program called Generic.awk to the Windows Clipboard, type:

Copy Code
awk -f generic.awk input.txt | clip

To copy the contents of a file called Readme.txt to the Windows Clipboard, type:

Copy Code
clip < readme.txt

Additional references

Command-Line Syntax Key


Cls

Applies To: Windows Vista,Windows Server 2008

Clears the Command Prompt window.

For examples of how to use this command, see Examples.

Syntax

Copy Code
cls

Parameters

Parameter | Description
/? | Displays help at the command prompt.

Examples

To clear all information that appears in the Command Prompt window and return to a blank window, type:

Copy Code
cls

Additional references

Command-Line Syntax Key


Cluster

Applies To: Windows Server 2008

Creates a new cluster or configures an existing cluster.

For examples of how to use this command, see Examples.

Syntax

Copy Code
cluster [[/cluster:]<ClusterName>] /<Option>

Parameters

Parameter Description
Copy Code
<ClusterName> /create
/ipaddr[ess]:<Static_IP_Address>[,<SubnetMask>,<NetworkConnectionName>]
/pass[word]:<Password>
/user:{<Domain>\<UserName> | <UserName>@<Domain>}
[/node:<NodeName>]
[/verb[ose]]
[/unattend[ed]]
[/min[imum]]

Creates a cluster. Descriptions of the optional parameters are provided in the table below.

Copy Code
<ClusterName>
/add[nodes][:<NodeName1>[,<NodeName2>, ...]]
[/pass[word]:<Password>]
[/verb[ose]] [/unattend[ed]]
[/min[imum]]

Adds one or more nodes to an existing cluster.

Copy Code
/ren[ame]:<ClusterName>

Renames a cluster.

Copy Code
/cluster:<ClusterName1>[,<ClusterName2>, ...]
/changepass[word][:<NewPassword>[,<OldPassword>]]
[/skipdc]
[/force]
[/test]
[/quiet]
[/verb[ose]]
[/unattend[ed]]
[/help]

For one or more clusters, changes the Cluster service account password on the domain controller and all the cluster nodes from OldPassword to NewPassword. If not supplied as part of the command, you will be prompted to provide the NewPassword or the OldPassword. You can specify a blank password by supplying two double quotes (""). If multiple clusters are specified in one operation, they must all use the same Cluster service account. Descriptions of the optional parameters are provided in the table below.

Copy Code
/ver[sion]

Displays the Cluster service version number.

Copy Code
/listnetpri[ority]

Lists the priority of all internal (private and mixed) networks.

/setnetpri[ority]:<NetworkName1>[,<NetworkName2>, ...]

Sets the priority order for all internal networks. If you use this option, you must supply all the internal networks in the cluster.

/quorum[resource][:<ResourceName>]

[/path:<Drive>:\<Path>\]

[/maxlogsize:<MaximumSize_in_Kilobytes>]

Changes the name or location of the quorum resource or the size of the quorum log. If you change the location of the quorum resource, do not omit the drive letter, the colon, or any backslashes. For example, for a quorum resource on drive f: in a folder called Quorumfolder, you must specify the location with /path:f:\Quorumfolder\ not /path:f:Quorumfolder.

If no options are supplied, this command will display the name of the quorum resource, the path, and maximum log size.

/reg[admin]ext:<AdminExtension_DLL>

[,<AdminExtension_DLL> ...]

Registers a Cluster Administrator extension DLL with the cluster.

/unreg[admin]ext:<AdminExtension_DLL>

[,<AdminExtension_DLL> ...]

Unregisters a Cluster Administrator extension DLL from the cluster.

/list:[<DomainName>]

Displays a list of clusters in the computer's domain or a specified domain. Do not use the cluster name with this command-line option.

/prop[erties] [<PropertyList>]

Views or sets cluster common properties.

/priv[properties] [<PropertyList>]

Views or sets cluster private properties.

/registerdns

Registers existing Network Name resources with a DNS server in a way that does not interrupt cluster availability.

/wiz[ard]

Starts the Cluster Configuration Wizard. This command must be used with either the /create or /add[nodes] commands.

Important
You cannot supply the subnet mask or network connection name when you use the /wiz[ard] command to create a cluster. The program will use the information from the network connection with the same subnet mask as the cluster to supply the subnet mask, and network connection name.

/setfail[urereactions][:<NodeName>[,<NodeName> ...]]

Resets the restart actions settings that the Services Microsoft Management Console snap-in uses for the Cluster service to the original values used at setup.

/?

Displays help at the command prompt.

Remarks

  • Using the cluster command

    The cluster name is optional except when using the /changepass[word] command. If you do not specify a cluster, Cluster.exe attempts to connect to the cluster running on the node that is running Cluster.exe.

    If the name of your cluster is also a cluster command or its abbreviation, such as "cluster" or "c", use /cluster: to explicitly specify the cluster name. For a list of all the cluster commands, see Related Topics.

  • Using command-line options with cluster /create

    Unless you are invoking the Cluster Configuration Wizard (by using the /wiz[ard] option), you must supply a name and static IP address for the cluster and the user name for the Cluster service account. If you do not use the /unattend[ed] option, you must also supply the password for the user account used to run the Cluster service on the first node. If possible, the program will use the information from the network connection with the same subnet mask as the node to supply the subnet mask, and network connection name. The cluster will be created in the same domain to which the first server belongs. See the table below for details on the other optional parameters.

  • Using the cluster command for unattended setup.

    You can create and configure a cluster during an unattended setup by including the cluster.exe command in your unattended setup process.

  • Using the /prop[erties] [<PropertyList>] command-line option

  • Using the /priv[properties] [<PropertyList>] command-line option

  • Using the /setfail[urereactions][:<NodeName>[,<NodeName> ...]] command-line option

    This option resets the Cluster service restart settings for one or more nodes to the following values:

    Service Restart Option Setting

    First failure

    Restart the service

    Second failure

    Restart the service

    Subsequent failure

    Restart the service

    Reset fail count after N days

    0 days

    Restart service after N minutes

    1 minute

  • Command options for creating a cluster

    Option Description
    Copy Code
    [/node:<NodeName>]

    The name of the server to be configured as the first cluster node. The command will use the name of the current computer if you do not supply a node name.

    Copy Code
    [/min[imum]]

    This option creates a cluster using the Advanced (minimum) Configuration option. Use this option when creating clusters with complex storage configurations.

    Copy Code
    [/verb[ose]]

    This option writes all event messages to the cluster log. Use this option for troubleshooting cluster configuration issues.

    Copy Code
    /unattend[ed]

    If you use this option, you will not be prompted for passwords not supplied at the command prompt.

  • Command options for changing the Cluster service account password

    Option Description
    Copy Code
    [/skipdc]

    This option will change the Cluster service account password only on the cluster nodes. It will not change the password on the domain controller. Use this option to complete a previous password update that was only partially completed. For example, use this option if you previously issued a cluster /changepass command for multiple clusters and the Cluster service account password was not updated on all the clusters, for whatever reason.

    Note that if you use this option, you do not have to supply OldPassword.

    Copy Code
    [/force]

    This option will force execution of the password change command on the available nodes in a cluster even if some of the cluster nodes are not available (that is, some nodes are in the Down, Joining, or Unknown states).

    Copy Code
    [/test]

    This option will open a connection to the specified cluster(s), verify that an appropriate domain controller is available, check the version of the operating system installed on each node, and verify that all the cluster nodes are online and use the same Cluster service account.

    Copy Code
    [/quiet]

    This option will result in no output, unless an error occurs.

    Copy Code
    [/verb[ose]]

    This option outputs detailed information about the cluster nodes (for example, node names and Cluster service account names) to the screen. Use this option for troubleshooting password change issues.

    Copy Code
    /unattend[ed]

    If you use this option, you will not be prompted for passwords not supplied at the command prompt.

    Copy Code
    [/help]

    This option displays help for the cluster /changepass command only.

  • Cluster common property names

    The following table describes the common cluster property names, their uses, and valid settings:

    Common property names Use
    Copy Code
    AdminExtensions

    Describes one or more class identifiers (CLSIDs) of Cluster Administrator extension for the cluster object.

    Copy Code
    DefaultNetworkRole

    Specifies the default role to assign to networks.

    Copy Code
    Description

    Specifies administrative description of the cluster.

    Copy Code
    Security

    Describes the Windows Server 2003 family-compatible security descriptor.

    Copy Code
    Security Descriptor

    Describes Windows NT-SP4 and the Windows Server 2003 family-compatible security descriptor.

    Copy Code
    Groups\AdminExtensions

    Describes one or more class identifiers (CLSIDs) of Cluster Administrator extensions for the groups.

    Copy Code
    NetworkInterfaces\AdminExtensions

    Describes one or more class identifiers (CLSIDs) of Cluster Administrator extensions for the netinterfaces.

    Copy Code
    Networks\AdminExtensions

    Describes one or more class identifiers (CLSIDs) of Cluster Administrator extensions for the networks.

    Copy Code
    Nodes\AdminExtensions

    Describes one or more class identifiers (CLSIDs) of Cluster Administrator extensions for the nodes.

    Copy Code
    Resources\AdminExtensions

    Describes one or more class identifiers (CLSIDs) of Cluster Administrator extensions for the resources.

    Copy Code
    ResourceTypes\AdminExtensions

    Describes one or more class identifiers (CLSIDs) of Cluster Administrator extensions for the resource types.

    Copy Code
    EnableEventLogReplication

    Specifies if Event Log Replication is enabled or disabled cluster wide. (True (1) means enabled; False (0) means disabled.)

    Copy Code
    QuorumArbitrationTimeMin QuorumArbitrationTimeMax

    Determines the minimum and maximum time, in seconds, a node is allowed to spend arbitrating for the quorum resource before giving up. The range of values allowed is 0 to 3600 seconds for QuorumArbitrationTimeMin and 1 to 3600 seconds for QuorumArbitrationTimeMax.

    For a single quorum device server cluster, the default values are 7 seconds for QuorumArbitrationTimeMin and 60 seconds for QuorumArbitrationTimeMax.

    For a majority node set server cluster, the default values are 7 seconds for QuorumArbitrationTimeMin and 180 seconds for QuorumArbitrationTimeMax.

    Copy Code
    DisableGroupPreferredOwnerRandomization

    If you do not specify a preferred owner list for resource groups, the Cluster service randomizes the list it uses internally to decide which node to fail over the groups to. That is, by default, this property is set to FALSE (0). If you want to disable this randomization and instead follow the internal ordered list of nodes for failover, set the DisableGroupPreferredOwnerRandomization property to be TRUE (or 1).

    Copy Code
    EnableEventDeltaGeneration

    When a set of events in the Event Log is replicated across cluster nodes, this property generates a delta event in the Event Log to indicate the time difference between nodes. True (1), the default, means enabled; False (0) means disabled.

    Copy Code
    ClusSvcHeartbeatTimeout

    Used by the Cluster Network driver, ClusNet.sys, to monitor the health of the Cluster service.

    Copy Code
    HangRecoveryAction

    Describes the recovery action taken if ClusNet.sys detects a failure in the Cluster service.

    Copy Code
    EnableResourceDllDeadlockDetection
ResourceDllDeadlockTimeout
ResourceDllDeadlockThreshold
ResourceDllDeadlockPeriod

    Used by the Cluster service to monitor if the entry points to the Resource DLLs are deadlocked (a condition that occurs when two processes are each waiting for the other to complete before proceeding).

  • Using cluster private property names

    To view the private properties for a cluster, use the /priv[properties] parameter without any options. For example, to see the private properties for the cluster OpsClust, type the following at a command prompt:

    Copy Code
    cluster opsclust /priv
    The following table describes a cluster private property for cryptographic checkpoints. This private property is useful in two scenarios:

    • If there is a third-party resource or application that uses a third-party cryptographic provider that is not supplied by Microsoft.

    • If you have security concerns about the cryptographic checkpoint data that is written to the quorum when you import resource data to a cluster node before bringing the resource online.

    You can use this private property to change the encryption levels for any of the cryptographic providers (supplied by third-party developers or by Microsoft) that are used by the Cluster service.

    Private property names Use
    Copy Code
    "<CSP>"

    Sets the encryption levels (key lengths) for a cryptographic key that is used to export (encrypt) and import (decrypt) resource data (cluster and cluster application cryptographic checkpoints). The imported and exported resource data is saved to the quorum. The cryptographic key is generated by a cryptographic provider that uses the RC2 block encryption method.

    Usage:

    Copy Code
    "<CSP>"=<key_length>,<effective_key_length>:MULTISTR

    "<CSP>" is the name of the cryptographic provider. For example, one of the standard cryptographic providers supplied with the Windows Server 2003 family is "Microsoft Enhanced Cryptographic Provider v1.0." For more information, see CLUSCTL_RESOURCE_ADD_CRYPTO_CHECKPOINT in the Microsoft Platform Software Development Kit (SDK).

    <key_length> is the RC2 key length, in bits.

    <effective_key_length> is the RC2 effective key length, in bits

    For example, to change the RC2 key length for a third-party cryptographic provider named "Database CSP v2.0" in cluster opsclust to 128 bits, type:

    Copy Code
    cluster opsclust /priv "Database CSP v2.0"=128,40:MULTISTR
    Note
    For this property to take effect, the resource DLL must add the cryptographic checkpoint for the property. This is because the cryptographic key is exported and saved to the quorum when the checkpoint is added for the very first time; prior to the resource coming online the key is imported from the file saved in the quorum. Review the documentation for your cryptographic provider to obtain the correct procedure for adding the cryptographic checkpoint.

    Review the documentation for your cryptographic provider to obtain valid values for the following RC2 encryption algorithm parameters: <key_length> and <effective_key_length>.

Examples

To rename a cluster called OpsClust to OpsClust1, type:

Copy Code
cluster opsclust /rename:opsclust1

Additional references

Command-Line Syntax Key


Cmd

Applies To: Windows Server 2008,Windows Vista

Starts a new instance of the command interpreter, Cmd.exe. If used without parameters, cmd displays the version and copyright information of the operating system.

Syntax

Copy Code
cmd [/c|/k] [/s] [/q] [/d] [/a|/u] [/t:{<B><F>|<F>}] [/e:{on|off}] [/f:{on|off}] [/v:{on|off}] [<String>]

Parameters

Parameter | Description
/c | Carries out the command specified by String and then stops.
/k | Carries out the command specified by String and continues.
/s | Modifies the treatment of String after /c or /k.
/q | Turns the echo off.
/d | Disables execution of AutoRun commands.
/a | Formats internal command output to a pipe or a file as American National Standards Institute (ANSI).
/u | Formats internal command output to a pipe or a file as Unicode.
/t:{<B><F>|<F>} | Sets the background (B) and foreground (F) colors.
/e:on | Enables command extensions.
/e:off | Disables commands extensions.
/f:on | Enables file and directory name completion.
/f:off | Disables file and directory name completion.
/v:on | Enables delayed environment variable expansion.
/v:off | Disables delayed environment variable expansion.
<String> | Specifies the command you want to carry out.
/? | Displays help at the command prompt.

The following table lists valid hexadecimal digits that you can use as the values for <B> and <F>:

Value | Color
0 | Black
1 | Blue
2 | Green
3 | Aqua
4 | Red
5 | Purple
6 | Yellow
7 | White
8 | Gray
9 | Light blue
a | Light green
b | Light aqua
c | Light red
d | Light purple
e | Light yellow
f | Bright white

Remarks

  • Using multiple commands

    To use multiple commands for <String>, separate them by the command separator && and enclose them in quotation marks. For example:

    Copy Code
    "<Command>&&<Command>&&<Command>"
  • Processing quotation marks

    If you specify /c or /k, cmd processes the remainder of String, and quotation marks are preserved only if all of the following conditions are met:

    • You do not use /s.

    • You use exactly one set of quotation marks.

    • You do not use any special characters within the quotation marks (for example: & < > ( ) @ ^ | ).

    • You use one or more white-space characters within the quotation marks.

    • The String within quotation marks is the name of an executable file.

    If the previous conditions are not met, String is processed by examining the first character to verify whether it is an opening quotation mark. If the first character is an opening quotation mark, it is stripped along with the closing quotation mark. Any text following the closing quotation marks is preserved.

  • Executing registry subkeys

    If you do not specify /d in String, Cmd.exe looks for the following registry subkeys:

    HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun\REG_SZ

    HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun\REG_EXPAND_SZ

    If one or both registry subkeys are present, they are executed before all other variables.

Caution
Incorrectly editing the registry may severely damage your system. Before making changes to the registry, you should back up any valued data on the computer.

  • Enabling and disabling command extensions

    Command extensions are enabled by default in Windows XP. You can disable them for a particular process by using /e:off. You can enable or disable extensions for all cmd command-line options on a computer or user session by setting the following REG_DWORD values:

    HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\EnableExtensions\REG_DWORD

    HKEY_CURRENT_USER\Software\Microsoft\Command Processor\EnableExtensions\REG_DWORD

    Set the REG_DWORD value to either 0×1 (enabled) or 0×0 (disabled) in the registry by using Regedit.exe. User-specified settings take precedence over computer settings, and command-line options take precedence over registry settings.

    Caution
    Incorrectly editing the registry may severely damage your system. Before making changes to the registry, you should back up any valued data on the computer.

    When you enable command extensions, the following commands are affected:

    • assoc

    • call

    • chdir (cd)

    • color

    • del (erase)

    • endlocal

    • for

    • ftype

    • goto

    • if

    • mkdir (md)

    • popd

    • prompt

    • pushd

    • set

    • setlocal

    • shift

    • start (also includes changes to external command processes)

  • Enabling delayed environment variable expansion

    If you enable delayed environment variable expansion, you can use the exclamation point character to substitute the value of an environment variable at run time.

  • Enabling file and directory name completion

    File and directory name completion is not enabled by default. You can enable or disable file name completion for a particular process of the cmd command with /f:{on|off}. You can enable or disable file and directory name completion for all processes of the cmd command on a computer or for a user logon session by setting the following REG_DWORD values:

    HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\CompletionChar\REG_DWORD

    HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\PathCompletionChar\REG_DWORD

    HKEY_CURRENT_USER\Software\Microsoft\Command Processor\CompletionChar\REG_DWORD

    HKEY_CURRENT_USER\Software\Microsoft\Command Processor\PathCompletionChar\REG_DWORD

    To set the REG_DWORD value, run Regedit.exe and use the hexadecimal value of a control character for a particular function (for example, 0×9 is TAB and 0×08 is BACKSPACE). User-specified settings take precedence over computer settings, and command-line options take precedence over registry settings.

Caution
Incorrectly editing the registry may severely damage your system. Before making changes to the registry, you should back up any valued data on the computer.

If you enable file and directory name completion by using /f:on, use CTRL+D for directory name completion and CTRL+F for file name completion. To disable a particular completion character in the registry, use the value for white space [0×20] because it is not a valid control character.

When you press CTRL+D or CTRL+F, cmd processes file and directory name completion. These key combination functions append a wildcard character to String (if one is not present), build a list of paths that match, and then display the first matching path. If none of the paths match, the file and directory name completion function beeps and does not change the display. To move through the list of matching paths, press CTRL+D or CTRL+F repeatedly. To move through the list backwards, press the SHIFT key and CTRL+D or CTRL+F simultaneously. To discard the saved list of matching paths and generate a new list, edit String and press CTRL+D or CTRL+F. If you switch between CTRL+D and CTRL+F, the saved list of matching paths is discarded and a new list is generated. The only difference between the key combinations CTRL+D and CTRL+F is that CTRL+D only matches directory names and CTRL+F matches both file and directory names. If you use file and directory name completion on any of the built-in directory commands (that is, CD, MD, or RD), directory completion is assumed.

File and directory name completion correctly processes file names that contain white space or special characters if you place quotation marks around the matching path.

The following special characters require quotation marks: & < > [ ] { } ^ = ; ! ' + , ` ~ [white space].

If the information that you supply contains spaces, use quotation marks around the text (for example, "Computer Name").

If you process file and directory name completion from within String, any part of the Path to the right of the cursor is discarded (at the point in String where the completion was processed).

Additional references

Command-Line Syntax Key


Cmdkey

Applies To: Windows Vista,Windows Server 2008

Creates, lists, and deletes stored user names and passwords or credentials.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
cmdkey [{/add:<TargetName>|/generic:<TargetName>}] {/smartcard|/user:<UserName> [/pass:<Password>]} [/delete{:<TargetName>|/ras}] /list:<TargetName>

Parameters

Parameters | Description
/add:<TargetName> | Adds a user name and password to the list. Requires the parameter of <TargetName> which identifies the computer or domain name that this entry will be associated with.
/generic:<TargetName> | Adds generic credentials to the list. Requires the parameter of <TargetName> which identifies the computer or domain name that this entry will be associated with.
/smartcard | Retrieves the credential from a smart card.
/user:<UserName> | Specifies the user or account name to store with this entry. If UserName is not supplied, it will be requested.
/pass:<Password> | Specifies the password to store with this entry. If Password is not supplied, it will be requested.
/delete{:<TargetName> | /ras} | Deletes a user name and password from the list. If TargetName is specified, that entry will be deleted. If /ras is specified, the stored remote access entry will be deleted.
/list:<TargetName> | Displays the list of stored user names and credentials. If TargetName is not specified, all stored user names and credentials will be listed.
/? | Displays help at the command prompt.

Remarks

  • If more than one smart card is found on the system when the /smartcard command-line option is used, cmdkey will display information about all available smart cards and then prompt the user to specify which one to use.

  • Passwords will not be displayed once they are stored.

Examples

To display a list of all user names and credentials that are stored, type:

Copy Code
cmdkey /list

To add a user name and password for user Mikedan to access computer Server01 with the password Kleo, type:

Copy Code
cmdkey /add:server01 /user:mikedan /pass:Kleo

To add a user name and password for user Mikedan to access computer Server01 and prompt for the password whenever Server01 is accessed, type:

Copy Code
cmdkey /add:server01 /user:mikedan

To delete the credential that remote access has stored, type:

Copy Code
cmdkey /delete /ras

To delete the credential that is stored for Server01, type:

Copy Code
cmdkey /delete:Server01

Additional references

Command-Line Syntax Key


Color

Applies To: Windows Server 2008,Windows Vista

Changes the foreground and background colors in the Command Prompt window for the current session. If used without parameters, color restores the default Command Prompt window foreground and background colors.

For examples of how to use this command, see Examples.

Syntax

Copy Code
color [[<B>]<F>]

Parameters

Parameter | Description
<B> | Specifies the background color.
<F> | Specifies the foreground color.
/? | Displays help at the command prompt.

Remarks

  • The following table lists valid hexadecimal digits that you can use as the values for B and F.

    Value Color

    0

    Black

    1

    Blue

    2

    Green

    3

    Aqua

    4

    Red

    5

    Purple

    6

    Yellow

    7

    White

    8

    Gray

    9

    Light blue

    A

    Light green

    B

    Light aqua

    C

    Light red

    D

    Light purple

    E

    Light yellow

    F

    Bright white

  • Do not use space characters between B and F.

  • If you specify only one hexadecimal digit, the corresponding color is used as the foreground color and the background color is set to the default color.

  • To set the default Command Prompt window color, click the upper-left corner of the Command Prompt window, click Defaults, click the Colors tab, and then click the colors that you want to use for the Screen Text and Screen Background.

  • If B and F are the same, the color command sets ERRORLEVEL to 1, and no change is made to either the foreground or the background color.

Examples

To change the Command Prompt window background color to gray and the foreground color to red, type:

Copy Code
color 84

To change the Command Prompt window foreground color to light yellow, type:

Copy Code
color e
Note
In this example, the background is set to the default color because only one hexadecimal digit is specified.

Additional references

Command-Line Syntax Key


Comp

Applies To: Windows Server 2008,Windows Vista

Compares the contents of two files or sets of files byte-by-byte. If used without parameters, comp prompts you to enter the files to compare.

For examples of how to use this command, see Examples.

Syntax

Copy Code
comp [<Data1>] [<Data2>] [/d] [/a] [/l] [/n=<Number>] [/c]

Parameters

Parameter | Description
<Data1> | Specifies the location and name of the first file or set of files that you want to compare. You can use wildcard characters (* and ?) to specify multiple files.
<Data2> | Specifies the location and name of the second file or set of files that you want to compare. You can use wildcard characters (* and ?) to specify multiple files.
/d | Displays differences in decimal format. (The default format is hexadecimal.)
/a | Displays differences as characters.
/l | Displays the number of the line where a difference occurs, instead of displaying the byte offset.
/n=<Number> | Compares only the number of lines that are specified for each file, even if the files are different sizes.
/c | Performs a comparison that is not case-sensitive.
/off[line] | Processes files with the offline attribute set.
/? | Displays Help at the command prompt.

Remarks

  • How the comp command identifies mismatching information

    During the comparison, comp displays messages that identify the locations of unequal information between the files. Each message indicates the offset memory address of the unequal bytes and the contents of the bytes (in hexadecimal notation unless the /a or /d command-line parameter is specified). Messages appear in the following format:

    Compare error at OFFSET xxxxxxxx

    file1 = xx

    file2 = xx

    After ten unequal comparisons, comp stops comparing the files and displays the following message:

    10 Mismatches - ending compare

  • Handling special cases for Data1 and Data2

    • If you omit necessary components of either Data1 or Data2 or if you omit Data2, comp prompts you for the missing information.

    • If Data1 contains only a drive letter or a directory name with no file name, comp compares all of the files in the specified directory to the file specified in Data1.

    • If Data2 contains only a drive letter or a directory name, the default file name for Data2 is the same as that in Data1.

    • If comp cannot find the file(s) you specify, it prompts you with a message to determine whether you want to compare more files.

  • Comparing files in different locations

    Comp can compare files on the same drive or on different drives, and in the same directory or in different directories. When comp compares the files, it displays their locations and file names.

  • Comparing files with the same names

    The files that you compare can have the same file name, provided they are in different directories or on different drives. If you do not specify a file name for Data2, the default file name for Data2 is the same as the file name in Data1. You can use wildcard characters (* and ?) to specify file names.

  • Comparing files of different sizes

    You must specify /n to compare files of different sizes. If the file sizes are different and /n is not specified, comp displays the following message:

    Files are different sizes

    Compare more files (Y/N)?

    To compare these files, press N to stop the comp command. Then, rerun the comp command with the /n option to compare only the first portion of each file.

  • Comparing files sequentially

    If you use wildcard characters (* and ?) to specify multiple files, comp finds the first file that matches Data1 and compares it with the corresponding file in Data2, if it exists. The comp command reports the results of the comparison for each file matching Data1. When finished, comp displays the following message:

    Compare more files (Y/N)?

    To compare more files, press Y. The comp command prompts you for the locations and names of the new files. To stop the comparisons, press N. When you press Y, comp prompts you for command-line options to use. If you do not specify any command-line options, comp uses the ones you specified before.

Examples

To compare the contents of the directory C:\Reports with the backup directory \\Sales\Backup\April, type:

Copy Code
comp c:\reports \\sales\backup\april

To compare the first ten lines of the text files in the \Invoice directory and display the result in decimal format, type:

Copy Code
comp \invoice\*.txt \invoice\backup\*.txt /n=10 /d

Additional references

Command-Line Syntax Key


Compact

Applies To: Windows Vista,Windows Server 2008

Displays or alters the compression of files or directories on NTFS partitions. If used without parameters, compact displays the compression state of the current directory and the files it contains.

For examples of how to use this command, see Examples.

Syntax

Copy Code
compact [/c | /u] [/s[:<Dir>]] [/a] [/i] [/f] [/q] [<FileName>[...]]

Parameters

Parameter | Description
/c | Compresses the specified directory or file.
/u | Uncompresses the specified directory or file.
/s[:<Dir>] | Applies the compact command to all subdirectories of the specified directory (or of the current directory if none is specified).
/a | Displays hidden or system files.
/i | Ignores errors.
/f | Forces compression or uncompression of the specified directory or file. /f is used in the case of a file that was partly compressed when the operation was interrupted by a system crash. To force the file to be compressed in its entirety, use the /c and /f parameters and specify the partially compressed file.
/q | Reports only the most essential information.
<FileName> | Specifies the file or directory. You can use multiple file names, and the * and ? wildcard characters.
/? | Displays help at the command prompt.

Remarks

  • The compact command is the command-line version of the NTFS file system compression feature. The compression state of a directory indicates whether files are automatically compressed when they are added to the directory. Setting the compression state of a directory does not necessarily change the compression state of files that are already in the directory.

  • You cannot use compact to read, write, or mount volumes that have been compressed using DriveSpace or DoubleSpace.

  • You cannot use compact to compress file allocation table (FAT) or FAT32 partitions.

Examples

To set the compression state of the current directory, its subdirectories, and existing files, type:

Copy Code
compact /c /s

To set the compression state of files and subdirectories within the current directory, without altering the compression state of the current directory itself, type:

Copy Code
compact /c /s *.*

To compress a volume, from the root directory of the volume, type:

Copy Code
compact /c /i /s:\
Note
This example sets the compression state of all directories (including the root directory on the volume) and compresses every file on the volume. The /i parameter prevents error messages from interrupting the compression process.

To compress all files with the .bmp file name extension in the \Tmp directory and all subdirectories of \Tmp, without modifying the compressed attribute of the directories, type:

Copy Code
compact /c /s:\tmp *.bmp

To force complete compression of the file Zebra.bmp, which was partially compressed during a system crash, type:

Copy Code
compact /c /f zebra.bmp

To remove the compressed attribute from the directory C:\Tmp, without changing the compression state of any files in that directory, type:

Copy Code
compact /u c:\tmp

Additional references

Command-Line Syntax Key


Convert

Applies To: Windows Server 2008,Windows Vista

Converts file allocation table (FAT) and FAT32 volumes to the NTFS file system, leaving existing files and directories intact. Volumes converted to the NTFS file system cannot be converted back to FAT or FAT32.

For examples of how to use this command, see Examples.

Syntax

Copy Code
convert [<Volume>] /fs:ntfs [/v] [/cvtarea:<FileName>] [/nosecurity] [/x]

Parameters

Parameter Description

<Volume>

Specifies the drive letter (followed by a colon), mount point, or volume name to convert to NTFS.

/fs:ntfs

Required. Converts the volume to NTFS.

/v

Runs convert in verbose mode, which displays all messages during the conversion process.

/cvtarea:<FileName>

Specifies that the Master File Table (MFT) and other NTFS metadata files are written to an existing, contiguous placeholder file. This file must be in the root directory of the file system to be converted. Use of the /cvtarea parameter can result in a less fragmented file system after conversion. For best results, the size of this file should be 1 KB multiplied by the number of files and directories in the file system, although the convert utility accepts files of any size.

Important
You must create the placeholder file by using the fsutil file createnew command prior to running convert. Convert does not create this file for you. Convert overwrites this file with NTFS metadata. After conversion, any unused space in this file is freed.

/nosecurity

Specifies that the security settings on the converted files and directories allow access by all users.

/x

Dismounts the volume, if necessary, before it is converted. Any open handles to the volume will no longer be valid.

/?

Displays help at the command prompt.

Remarks

  • If convert cannot lock the drive (for example, the drive is the system volume or the current drive), you are given the option to convert the drive the next time you restart the computer. If you cannot restart the computer immediately to complete the conversion, plan a time to restart the computer and allow extra time for the conversion process to complete.

  • For volumes converted from FAT or FAT32 to NTFS:

    Due to existing disk usage, the MFT is created in a different location than on a volume originally formatted with NTFS, so volume performance might not be as good as on volumes originally formatted with NTFS. For optimal performance, consider recreating these volumes and formatting them with the NTFS file system.

    Volume conversion from FAT or FAT32 to NTFS leaves the files intact, but the volume might lack some performance benefits compared to volumes initially formatted with NTFS. For example, the MFT might become fragmented on converted volumes. In addition, on converted boot volumes, convert applies the same default security that is applied during Windows Setup.

Examples

To convert the volume on drive E to NTFS and display all messages during the conversion process, type:

Copy Code
convert e: /fs:ntfs /v

Additional references

Command-Line Syntax Key


Copy

Applies To: Windows Vista,Windows Server 2008

Copies one or more files from one location to another.

For examples of how to use this command, see Examples.

Syntax

Copy Code
copy [/d] [/v] [/n] [/y | /-y] [/z] [/a | /b] <Source> [/a | /b] [+<Source> [/a | /b] [+ ...]] [<Destination> [/a | /b]]

Parameters

Parameter | Description
/d | Allows the encrypted files being copied to be saved as decrypted files at the destination.
/v | Verifies that new files are written correctly.
/n | Uses a short file name, if available, when copying a file with a name longer than eight characters, or with a file name extension longer than three characters.
/y | Suppresses prompting to confirm that you want to overwrite an existing destination file.
/-y | Prompts you to confirm that you want to overwrite an existing destination file.
/z | Copies networked files in restartable mode.
/a | Indicates an ASCII text file.
/b | Indicates a binary file.
<Source> | Required. Specifies the location from which you want to copy a file or set of files. Source can consist of a drive letter and colon, a directory name, a file name, or a combination of these.
<Destination> | Required. Specifies the location to which you want to copy a file or set of files. Destination can consist of a drive letter and colon, a directory name, a file name, or a combination of these.
/? | Displays help at the command prompt.

Remarks

  • You can copy an ASCII text file that uses an end-of-file character (CTRL+Z) to indicate the end of the file.

  • Using /a

    When /a precedes or follows a list of files on the command line, it applies to all files listed until copy encounters /b. In this case, /b applies to the file preceding /b.

    The effect of /a depends on its position in the command-line string. When /a follows Source, copy treats the file as an ASCII file and copies data that precedes the first end-of-file character (CTRL+Z).

    When /a follows Destination, copy adds an end-of-file character (CTRL+Z) as the last character of the file.

  • Using /b

    /b directs the command interpreter to read the number of bytes specified by the file size in the directory. /b is the default value for copy, unless copy combines files.

    When /b precedes or follows a list of files on the command line, it applies to all listed files until copy encounters /a. In this case, /a applies to the file preceding /a.

    The effect of /b depends on its position in the command–line string. When /b follows Source, copy copies the entire file, including any end-of-file character (CTRL+Z).

    When /b follows Destination, copy does not add an end-of-file character (CTRL+Z).

  • Using /v

    If a write operation cannot be verified an error message appears. Although recording errors rarely occur with copy, you can use /v to verify that critical data has been correctly recorded. The /v command-line option also slows down the copy command, because each sector recorded on the disk must be checked.

  • Using /y and /-y

    If /y is preset in the COPYCMD environment variable, you can override this setting by using /-y at the command line. By default, you are prompted when you replace this setting, unless the copy command is executed in a batch script.

  • Appending files

    To append files, specify a single file for Destination, but multiple files for Source (use wildcard characters or File1+File2+File3 format).

  • Using /z

    If the connection is lost during the copy phase (for example, if the server going offline breaks the connection), copy /z resumes after the connection is re-established. /z also displays the percentage of the copy operation that is completed for each file.

  • Copying to and from devices

    You can substitute a device name for one or more occurrences of Source or Destination.

  • Using or omitting /b when copying to a device

    When Destination is a device (for example, Com1 or Lpt1), /b copies data to the device in binary mode. In binary mode, copy /b copies all characters (including special characters such as CTRL+C, CTRL+S, CTRL+Z, and ENTER) to the device as data. However, if you omit /b, data is copied to the device in ASCII mode. In ASCII mode, special characters might cause files to combine during the copying process.

  • Using the default destination file

    If you do not specify a destination file, a copy is created with the same name, modified date, and modified time as the original file. The new copy is stored in the current directory on the current drive. If the source file is on the current drive and in the current directory and you do not specify a different drive or directory for the destination file, the copy command stops and displays the following error message:

    File cannot be copied onto itself

    0 File(s) copied

  • Combining files

    If you specify more than one file in Source, copy combines them all into a single file using the file name specified in Destination. Copy assumes the combined files are ASCII files unless you use the /b option.

  • Copying zero-length files

    Copy does not copy files that are 0 bytes long. Use xcopy to copy these files.

  • Changing the time and date of a file

    If you want to assign the current time and date to a file without modifying the file, use the following syntax:

    Copy Code
    copy /b <Source> +,,
    The commas indicate the omission of the Destination parameter.

  • Copying files in subdirectories

    To copy all of a directory's files and subdirectories, use the xcopy command.

  • The copy command, with different parameters, is available from the Recovery Console.

Examples

To copy a file called Memo.doc to Letter.doc in the current drive and ensure that an end-of-file character (CTRL+Z) is at the end of the copied file, type:

Copy Code
copy memo.doc letter.doc /a

To copy a file named Robin.typ from the current drive and directory to an existing directory named Birds that is located on drive C, type:

Copy Code
copy robin.typ c:\birds

If the Birds directory does not exist, the file Robin.typ is copied into a file named Birds that is located in the root directory on the disk in drive C.

To combine Mar89.rpt, Apr89.rpt, and May89.rpt, which are located in the current directory, and place them in a file named Report (also in the current directory), type:

Copy Code
copy mar89.rpt + apr89.rpt + may89.rpt Report

When you combine files, copy marks the destination file with the current date and time. If you omit Destination, the files are combined and stored under the name of the first file in the list. For example, to combine all files in Report when a file named Report already exists, type:

Copy Code
copy report + mar89.rpt + apr89.rpt + may89.rpt

To combine all files in the current directory that have the.txt file name extension into a single file named Combined.doc, type:

Copy Code
copy *.txt Combined.doc

If you want to combine several binary files into one file by using wildcard characters, include /b. This prevents Windows from treating CTRL+Z as an end-of-file character. For example, type:

Copy Code
copy /b *.exe Combined.exe
Caution
If you combine binary files, the resulting file might be unusable due to internal formatting.

In the following example, copy combines each file that has a .txt extension with its corresponding .ref file. The result is a file with the same file name but with a .doc extension. Copy combines File1.txt with File1.ref to form File1.doc, and then copy combines File2.txt with File2.ref to form File2.doc, and so on. For example, type:

Copy Code
copy *.txt + *.ref *.doc

To combine all files with the .txt extension, and then combine all files with the .ref extension into one file named Combined.doc, type:

Copy Code
copy *.txt + *.ref Combined.doc

Additional references

Command-Line Syntax Key


Cmstp

Applies To: Windows Server 2008,Windows Server 2008 R2

Installs or removes a Connection Manager service profile. Used without optional parameters, cmstp installs a service profile with default settings appropriate to the operating system and to the user's permissions.

Syntax

Syntax 1: ServiceProfileFileName .exe /q:a /c:"cmstp.exe ServiceProfileFileName .inf [/nf] [/ni] [/ns] [/s] [/su] [/u]"

Syntax 2: cmstp.exe [/nf] [/ni] [/ns] [/s] [/su] [/u] "[Drive:][Path]ServiceProfileFileName.inf"

Parameters

ServiceProfileFileName .exe

Required for Syntax 1 but not valid for Syntax 2. Specifies, by name, the installation package that contains the profile that you want to install.

/q:a

Required for Syntax 1 but not valid for Syntax 2. Specifies that the profile should be installed without prompting the user. The verification message that the installation has succeeded will still appear.

[ Drive:][ Path] ServiceProfileFileName.inf

Required. Specifies, by name, the configuration file that determines how the profile should be installed. The [Drive:][Path] parameter is not valid for Syntax 1.

/nf

Specifies that the support files should not be installed.

/ni

Specifies that a desktop icon should not be created. This parameter is only valid for computers running Windows 95, Windows 98, Windows NT 4.0, or Windows Millinnium Edition.

/ns

Specifies that a desktop shortcut should not be created. This parameter is only valid for computers running a member of the Windows Server 2003 family, Windows 2000, or Windows XP.

/s

Specifies that the service profile should be installed or uninstalled silently (without prompting for user response or displaying verification message).

/su

Specifies that the service profile should be installed for a single user rather than for all users. This parameter is only valid for computers running a member of the Windows Server 2003 family, Windows 2000, or Windows XP.

/au

Specifies that the service profile should be installed for all users. This parameter is only valid for computers running a member of the Windows Server 2003 family, Windows 2000, or Windows XP.

/u

Specifies that the service profile should be uninstalled.

/?

Displays help at the command prompt.

Remarks

  • /s is the only parameter that you can use in combination with /u.

  • Syntax 1 is the typical syntax used in a custom installation application. To use this syntax, you must run cmstp from the directory that contains the ServiceProfileFileName.exe file.

Examples

The following examples show possible uses of cmstp in relation to a fictional service profile called Fiction and its associated files.

  • To install the Fiction service profile without any support files, type:

    fiction.exe /c:"cmstp.exe fiction.inf /nf"

  • To silently install the Fiction service profile for a single user, type:

    fiction.exe /c:"cmstp.exe fiction.inf /s /su"

  • To silently uninstall the Fiction service profile, type:

    fiction.exe /c:"cmstp.exe fiction.inf /s /u"

Additional references

Command-Line Syntax Key

Including Connection Manager in Custom Applications


Cprofile

Applies To: Windows Server 2003 with SP1,Windows Server 2003,Windows Server 2003 with SP2

Cprofile - Cprofile is deprecated, and is not guaranteed to be supported in future releases of Windows.

Cprofile.exe: Clean profile. This tool is included in all Windows Server 2003 operating systems except Windows Server 2003, Web edition. For more information see Terminal Services Tools and Settings.


Cscript

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows XP,Windows Server 2003 R2,Windows 7,Windows Server 2003,Windows Vista,Windows Server 2000

Starts a script so that it runs in a command-line environment.

Syntax

Copy Code
Cscript <Scriptname.extension> [/B] [/D] [/E:<Engine>] [{/H:CScript|/H:WScript}] [/I] [/Job:<Identifier>] [{/Logo|/NoLogo}] [/S] [/T:<Seconds>] [/X] [/U] [/?] [<ScriptArguments …>]

Parameters

Parameter | Description
Scriptname.extension | Specifies the path and file name of the script file with optional file extension.
/B | Specifies batch mode, which does not display alerts, scripting errors, or input prompts.
/D | Starts the debugger.
E:<Engine> | Specifies the engine that is used to run the script.
H:CScript | Registers Cscript.exe as the default script host for running scripts.
H:WScript | Registers Wscript.exe as the default script host for running scripts. This is the default.
/I | Specifies interactive mode, which displays alerts, scripting errors, and input prompts. This is the default and the opposite of /B.
/Job:<Identifier> | Runs the job identified by Identifier in a .wsf script file.
/Logo | Specifies that the Windows Script Host banner is displayed in the console before the script runs. This is the default and the opposite of /Nologo.
/Nologo | Specifies that the Windows Script Host banner is not displayed before the script runs.
/S | Saves the current command-prompt options for the current user.
/T:<Seconds> | Specifies the maximum time the script can run (in seconds). You can specify up to 32,767 seconds. The default is no time limit.
/U | Specifies Unicode for input and output that is redirected from the console.
/X | Starts the script in the debugger.
/? | Displays available command parameters and provides help for using them. This is the same as typing Cscript.exe with no parameters and no script.
ScriptArguments | Specifies the arguments passed to the script. Each script argument must be preceded by a slash (/).

Remarks

  • Performing this task does not require you to have administrative credentials. Therefore, as a security best practice, consider performing this task as a user without administrative credentials.

  • To open a command prompt, click Start, point to All programs, point to Accessories, and then click Command prompt.

  • Each parameter is optional; however, you cannot specify script arguments without specifying a script. If you do not specify a script or any script arguments, Cscript.exe displays the Cscript.exe syntax and the valid host options.

  • The /T parameter prevents excessive running of scripts by setting a timer. When the run time exceeds the specified value, CScript interrupts the script engine and ends the process.

  • Windows script files usually have one of the following file name extensions: .wsf, .vbs, .js.

  • You can set properties for individual scripts. See Related Topics for more information.

  • Windows Script Host can use .wsf script files. Each .wsf file can use multiple scripting engines and perform multiple jobs.

  • If you double-click a script file with an extension that has no association, the Open With dialog box appears. Select Wscript or Cscript, and then select Always use this program to open this file type. This registers Wscript.exe or Cscript as the default script host for files of this file type.

  • You can set properties for individual scripts. See Additional References for more information.

  • Windows Script Host can use .wsf script files. Each .wsf file can use multiple scripting engines and perform multiple jobs.

Additional References

Windows Script Host overview

Command-Line Syntax Key


Csvde

Applies To: Windows Server 2003,Windows Server 2003 R2,Windows Server 2003 with SP1,Windows Server 2008,Windows Server 2008 R2

Imports and exports data from Active Directory Domain Services (AD DS) using files that store data in the comma-separated value (CSV) format. You can also support batch operations based on the CSV file format standard.

Csvde is a command-line tool that is built into Windows Server 2008 in the %windir%/system32 folder. It is available if you have the AD DS or Active Directory Lightweight Directory Services (AD LDS) server role installed. To use csvde, you must run the csvde command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
Csvde [-i] [-f <FileName>] [-s <ServerName>] [-c <String1> <String2>] [-v] [-j <Path>] [-t <PortNumber>] [-d <BaseDN>] [-r <LDAPFilter>] [-p <Scope] [-l <LDAPAttributeList>] [-o <LDAPAttributeList>] [-g] [-m] [-n] [-k] [-a <UserDistinguishedName> {<Password> | *}] [-b <UserName> <Domain> {<Password> | *}]

Parameters

Parameter Description

-i

Specifies import mode. If not specified, the default mode is export.

-f <FileName>

Identifies the import or export file name.

-s <ServerName>

Specifies the domain controller to perform the import or export operation.

-c <String1> <String2>

Replaces all occurrences of String1 with String2. You use this parameter when you import data from one domain to another and you want to replace the distinguished name of the export domain (String1) with the distinguished name of the import domain (String2).

-v

Sets verbose mode.

-j <Path>

Sets the log file location. The default is the current path.

-t <PortNumber>

Specifies an LDAP port. The default LDAP port is 389. The global catalog port is 3268.

-u

Specifies Unicode format.

-d <BaseDN>

Sets the distinguished name of the search base for data export.

-r <LDAPFilter>

Creates an LDAP search filter for data export.

-p <Scope>

Sets the search scope. Search scope options are Base, OneLevel, or SubTree.

-l <LDAPAttributeList>

Sets the list of attributes to return in the results of an export query. LDAP can return attributes in any order, and csvde does not attempt to impose any order on the columns. If you omit this parameter, AD DS returns all attributes.

-o <LDAPAttributeList>

Specifies the list of attributes to omit from the results of an export query. You use this parameter if you need to export objects from AD DS, and then import them into another LDAP-compliant directory. If the other directory does not support certain attributes, you can use this parameter to omit those attributes from the result set.

-g

Omits paged searches.

-m

Omits attributes that apply only to Active Directory objects, such as the ObjectGUID, objectSID, pwdLastSet, and samAccountType attributes.

-n

Omits the export of binary values.

-k

Ignores errors during an import operation and continues processing. The following is a complete list of ignored errors:

  • Object already exists

  • Constraint violation

  • Attribute or value already exists

-a [<UserDistinguishedName> {<Password> | *}]

Performs a simple LDAP bind with the user name and password. Sets the command to run using the supplied UserDistinguishedName and Password. By default, the command runs using the credentials of the user who is currently logged on to the network.

-b [<UserName> <Domain> {<Password> | *}]

Performs a secure LDAP bind with the NEGOTIATE authentication method. Sets the command to run using the supplied Username, Domain, and Password. By default, the command will run using the credentials of the user who is currently logged on to the network.

/?

Displays Help at the command prompt.

Remarks

  • You cannot import user passwords by using csvde because passwords must be sent over an encrypted channel. Csvde does not support Secure Sockets Layer (SSL) or encrypted LDAP communication. The previous references to passwords relate to the credentials of the user who is running csvde. They are not related to setting passwords for users.

  • Applications such as Microsoft Excel spreadsheet software are capable of reading and saving data in the CSV format. You can also create CSV files using Notepad; separate the values that you add to your file with commas. In addition, the Microsoft Exchange Server administration tools are capable of importing and exporting data using the CSV format, as are many other from software developers other than Microsoft.

    The CSV format consists of one or more lines of data with each value separated by a comma and no spaces between the comma and the next entry. The first line (sometimes referred to as the header) of the CSV file must contain the names of each attribute in the same order as the data in any line following the first line. For example:

    Copy Code
    objectClass,dn,givenName,sn,samAccountName,Description
user,distinguishedName,1stUserFirstName,1stUserSurname,FirstUserLogonName,Manager
user,distinguishedName,2ndUserFirstName,2ndUserSurname,SecondUserLogonName,President
  • To see a list of properties that csvde can update, see the appropriate supported interfaces in ADSI Objects of LDAP (http://go.microsoft.com/fwlink/?LinkId=91123). For example, to see the properties that can be set for Active Directory user objects, see IADsUser Interface (http://go.microsoft.com/fwlink/?LinkId=91124), and then view Properties.

  • You can use csvde -r to create an LDAP search filter for data export. For example, the following filter exports all users with a particular surname:

    Copy Code
    csvde -r (&(objectClass=User)(sn=Surname))

Examples

The following sample file contents are for a domain named Cpandl.com that has organizational units (OUs) named SW Dev, Acct, and AP. The AP OU is subordinate to the Acct OU. The first line of the file defines the Active Directory object properties for user accounts to be created by the entries in the rest of the file. The remaining lines are used to create the user accounts. The first user account is created in the default Users container, and the rest of the user accounts are created in the SW Dev, Acct, and AP OUs, respectively:

Copy Code
objectClass,dn,sAMAccountName,userPrincipalName,userAccountControl
user,"CN=KMyer,CN=Users,DC=cpandl,DC=com",KenM,KenM@cpandl.com,514
user,"CN=WYu,OU=SW Dev,DC=cpandl,DC=com",WeiY,WeiY@cpandl.com,514
user,"CN=JMorris,OU=Acct,DC=cpandl,DC=com",JonM,JonM@cpandl.com,514
user,"CN=YXu,OU=AP,OU=Acct,DC=cpandl,DC=com",YeX,YeX@cpandl.com,514
Note
Setting userAccountControl to 514 disables the user account. This is recommended because csvde cannot set passwords.

The -d switch indicates the root (top) of a particular query. For example, if you want to export all the objects in the Marketing top-level OU of the Contoso.com domain to a file named marketingobjects.csv, you can use the following command:

Copy Code
csvde -d "ou=marketing,dc=contoso,dc=com" -f marketingobjects.csv

The -r switch is a filter for exporting information from the directory. This switch filters the output that an export request produces. For example, if you want to export only the user account object attributes from a domain to a file named usersonly.csv, you can use the following command:

Copy Code
csvde -r objectClass=user -f usersonly.csv

The following example exports Active Directory data to a file named search.txt, sets the search scope to subtree, and lists the sAMAccountName, CN, and distinguished name attributes for each object that is found in the search:

Copy Code
csvde -f search.txt -p subtree -l SamAccountName,CN,Distinguishname

The following example imports the data from the current domain (the domain that you are logged on to) from a file named input.csv:

Copy Code
csvde -i -f input.csv

The following example exports the data from the current domain (the domain that you are logged on to) to a file named output.csv:

Copy Code
csvde -f output.csv

For additional examples using CSVDE, see article 327620 in the Microsoft Knowledge Base (http://go.microsoft.com/fwlink/?LinkId=91125).

Additional references

Command-Line Syntax Key


Date

Applies To: Windows Server 2008,Windows Vista

Displays or sets the system date. If used without parameters, date displays the current system date setting and prompts you to enter a new date.

For examples of how to use this command, see Examples.

Syntax

Copy Code
date [/t | <Month-Day-Year>]

Parameters

Parameter | Description
<Month-Day-Year> | Sets the date specified, where Month is the month (one or two digits), Day is the day (one or two digits), and Year is the year (two or four digits).
/t | Displays the current date without prompting you for a new date.
/? | Displays help at the command prompt.

Remarks

  • To change the current date, you must have administrative credentials.

  • You must separate values for Month, Day, and Year with periods (.), hyphens (-), or slash marks (/).

  • Valid Month values are 1 through 12.

  • Valid Day values are 1 through 31.

  • Valid Year values are either 00 through 99, or 1980 through 2099. If you use two digits, the values 80 through 99 correspond to the years 1980 through 1999.

Examples

If command extensions are enabled, to display the current system date, type:

Copy Code
date /t

To change the current system date to August 3, 2007, you can type any of the following:

Copy Code
date 08.03.2007
date 08-03-07
date 8/3/07

To display the current system date, followed by a prompt to enter a new date, type:

Copy Code
The current date is: Mon 04/02/2007
Enter the new date: (mm-dd-yy)

To keep the current date and return to the command prompt, press ENTER. To change the current date, type the new date and then press ENTER.

Additional references

Command-Line Syntax Key


Dcdiag

Applies To: Windows Server 2003,Windows Server 2003 R2,Windows Server 2008,Windows Server 2003 with SP1

Analyzes the state of domain controllers in a forest or enterprise and reports any problems to help in troubleshooting.

As an end-user reporting program, dcdiag is a command-line tool that encapsulates detailed knowledge of how to identify abnormal behavior in the system. Dcdiag displays command output at the command prompt.

Dcdiag consists of a framework for executing tests and a series of tests to verify different functional areas of the system. This framework selects which domain controllers are tested according to scope directives from the user, such as enterprise, site, or single server.

Dcdiag is built into Windows Server 2008 R2 and Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) or Active Directory Lightweight Directory Services (AD LDS) server role installed. It is also available if you install the Active Directory Domain Services Tools that are part of the Remote Server Administration Tools (RSAT). For more information, see How to Administer Microsoft Windows Client and Server Computers Locally and Remotely (http://go.microsoft.com/fwlink/?LinkID=177813).

If Dcdiag takes a long time to run on a computer that runs Windows Server 2008 R2 or Windows 7, install the hotfix in article 979294 (http://go.microsoft.com/fwlink/?LinkId=196596) in the Microsoft Knowledge Base.

To use dcdiag, you must run the dcdiag command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dcdiag [/s:<DomainController>] [/n:<NamingContext>] [/u:<Domain>\<UserName> /p:{* | <Password> | ""}] [{/a | /e}] [{/q | /v}] [/i] [/f:<LogFile>] [/c [/skip:<Test>]] [/test:<Test>] [/fix] [{/h | /?}] [/ReplSource:<SourceDomainController>]

Parameters

Parameter Description

/s:<DomainController>

Specifies the name of the server to run the command against. If this parameter is not specified, the tests are run against the local domain controller. This parameter is ignored for DcPromo and RegisterInDns tests, which can be run locally only.

/n:<NamingContext>

Uses NamingContext as the naming context to test. You can specify domains in NetBIOS, Domain Name System (DNS), or distinguished name format.

/u:<Domain>\<UserName> /p:{* | <Password> | ""}

Uses Domain\UserName. Dcdiag uses the current credentials of the user (or process) that is logged on. If alternate credentials are needed, use the following options to provide those credentials for binding with Password as the password:

  • Use quotation marks ("") for an empty or null password.

  • Use the wildcard character (*) to prompt for the password.

/a

Tests all the servers on this site.

/e

Tests all the servers in the enterprise. Overrides /a.

/q

Quiet. Prints only error messages.

/v

Verbose. Prints extended information.

/i

Ignores superfluous error messages.

/fix

Affects the MachineAccount test only. This parameter causes the test to fix the Service Principal Names (SPNs) on the Machine Account object of the domain controller.

/f:<LogFile>

Redirects all output to a log file (LogFile).

/c

Comprehensive. Runs all tests except DCPromo and RegisterInDNS, including non-default tests. Optionally, you can use this parameter with the /skip parameter to skip specified tests.

The following tests are not run by default:

  • Topology

  • CutoffServers

  • OutboundSecureChannels

{/h | /?}

Displays help at the command prompt.

/test:<Test>

Runs this test only. The Connectivity test, which you cannot skip, is also run. You should not have this parameter in the same command with the /skip parameter.

/ReplSource:<SourceDomainController>

Tests the connection between the domain controller on which you run the command and the source domain controller. (This parameter is used for the CheckSecurityError test.) SourceDomainController is the DNS name, NetBIOS name, or distinguished name of a real or potential server that will be the source domain controller for replication, as represented by a real or potential connection object.

DNS Test Syntax

The Dcdiag DNS test uses the following syntax:

Copy Code
dcdiag /test:DNS [/DnsBasic | /DnsForwarders | /DnsDelegation | /DnsDynamicUpdate | /DnsRecordRegistration | /DnsResolveExtName [/DnsInternetName:<InternetName>] | /DnsAll] [/f:<LogFile>] [/x:<XMLLog.xml>] [/xsl:<XSLFile.xsl> or <XSLTFile.xslt>] [/s:<DomainController>] [/e] [/v]

DNS Test Parameters

/test:DNS [DNS test]

Performs the specified DNS test. If no test is specified, defaults to /DnsAll.

/DnsBasic

Performs basic DNS tests, including network connectivity, DNS client configuration, service availability, and zone existence.

/DnsForwarders

Performs the /DnsBasic tests, and also checks the configuration of forwarders.

/DnsDelegation

Performs the /DnsBasic tests, and also checks for proper delegations.

/DnsDynamicUpdate

Performs /DnsBasic tests, and also determines if dynamic update is enabled in the Active Directory zone.

/DnsRecordRegistration

Performs the /DnsBasic tests, and also checks if the address (A), canonical name (CNAME) and well-known service (SRV) resource records are registered. In addition, creates an inventory report based on the test results.

/DnsResolveExtName [/DnsInternetName:<InternetName>]

Performs the /DnsBasic tests, and also attempts to resolve InternetName. If /DnsInternetName is not specified, attempts to resolve the name www.microsoft.com. If /DnsInternetName is specified, attempts to resolve the Internet name supplied by the user.

/DnsAll

Performs all tests, except for the /DnsResolveExtName test, and generates a report.

/f:<LogFile>

Redirects all output to LogFile.

/s:<DomainController>

Runs the tests against DomainController. If this parameter is not specified, the tests are run against the local domain controller.

/e

Runs all tests specified by /test:DNS against all domain controllers in the Active Directory forest.

Note
Run times for DNS tests can be significant in large enterprises when the /e parameter is used. Domain controllers and DNS servers that are offline will increase run time as a result of long-time out periods for RPC and other protocols.

/v

Verbose. Presents extended information about successful test results, in addition to information about errors and warnings. When the /v parameter is not used, provides only error and warning information. Use the /v switch when errors or warnings are reported in the summary table.

/x:<XMLLog.xml>

Redirects all output to <XMLLog.xml>. This parameter works only with the /test:dns option.

/xsl:<XSLFile.xsl> or <XSLTFile.xslt>

Adds the processing instructions that reference the specified stylesheet. This parameter works only with /test:dns /x:<XMLLog.xml> option.

Dcdiag tests

The tables in this section show tests that you can run by using dcdiag. The tests are grouped into the following categories:

  • Domain controller tests that you cannot skip

  • Domain controller tests that you can skip

    These tests are grouped into two tables based on whether they run by default.

  • Non-domain controller tests

Domain controller tests that you cannot skip

Connectivity

Checks if domain controllers are registered in DNS, if they can be pinged and if they have LDAP or remote procedure call (RPC) connectivity.

Domain controller tests that you can skip

The following table shows tests that run by default.

Replications

Checks for timely replication and any replication errors between domain controllers.

NCSecDesc

Checks that the security descriptors on the naming context heads have appropriate permissions for replication.

NetLogons

Checks that the appropriate logon privileges exist to allow replication to proceed.

Advertising

Checks whether each domain controller advertises itself in the roles that it should be capable of performing. This test fails if the Netlogon Service has stopped or failed to start.

KnowsOfRoleHolders

Checks whether the domain controller can contact the servers that hold the five operations master roles (also known as flexible single master operations or FSMO roles).

Intersite

Checks for failures that would prevent or temporarily hold up intersite replication and predicts how long it would take for the Knowledge Consistency Checker (KCC) to recover.

Important
Results of this test are often not valid, especially in atypical site or KCC configurations or at the Windows Server 2003 forest functional level.

FSMOCheck

Checks that the domain controller can contact a Kerberos Key Distribution Center (KDC), a time server, a preferred time server, a primary domain controller (PDC), and a global catalog server. This test does not test any of the servers for operations master roles.

RidManager

Checks whether the relative identifier (RID) master is accessible and if it contains the proper information.

MachineAccount

Checks whether the machine account has properly registered and that the services are advertised. Use the /RecreateMachineAccount parameter to attempt a repair if the local machine account is missing. Use the /FixMachineAccount parameter if the machine account flags are incorrect.

Services

Checks whether the appropriate domain controller services are running.

OutboundSecureChannels

Checks that secure channels exist from all of the domain controllers in the domain to the domains that are specified by the /testdomain parameter. The /nositerestriction parameter prevents dcdiag from limiting the test to the domain controllers in the site.

ObjectsReplicated

Checks that the Machine Account and Directory System Agent (DSA) objects have replicated. You can use the /objectdn:dn parameter with the /n:nc parameter to specify an additional object to check.

frssysvol

Checks that the file replication system (FRS) system volume (SYSVOL) is ready.

frsevent

Checks to see if there are errors in the file replication system. (Failing replication of the SYSVOL share can cause policy problems.)

kccevent

Checks that the KCC is completing without errors.

systemlog

Checks that the system is running without errors.

CheckSDRefDom

Checks that all application directory partitions have appropriate security descriptor reference domains.

VerifyReplicas

Checks that all application directory partitions are fully instantiated on all replica servers.

CrossRefValidation

Checks the validity of cross-references.

VerifyReferences

Checks that certain system references are intact for the FRS and replication infrastructure.

VerifyEnterpriseReferences

Checks that specified system references are intact for the FRS and replication infrastructure across all objects in the enterprise on each domain controller.

/skip:<Test>

Skips the specified test. You should not specify this parameter in the same command with the /test parameter. The only test that you cannot skip is Connectivity.

The following table shows tests that do not run by default.

Topology

Checks that the KCC has generated a fully connected topology for all domain controllers.

CheckSecurityError

Reports on the overall health of replication with respect to Active Directory security in domain controllers running Windows Server 2003 SP1. You can perform this test against one or all domain controllers in an enterprise. When the test finishes, dcdiag presents a summary of the results, along with detailed information for each domain controller tested and the diagnosis of security errors that the test reported.

The following argument is optional:

/ReplSource: SourceDomainController

This argument checks the ability to create a replication link between a real or potential source domain controller (SourceDomainController) and the local domain controller.

CutoffServers

Checks for any server that is not receiving replications because its partners are not running.

DNS

Includes six optional DNS-related tests, as well as the Connectivity test, which runs by default. You can run the tests individually or together. The tests include the following parameters:

  • /DnsBasic

    Confirms that essential services are running and available, necessary resource records are registered, and domain and root zones are present.

  • /DnsForwarders

    Determines whether recursion is enabled and that any configured forwarders or root hints are functioning.

  • /DnsDelegation

    Confirms that the delegated name server is functioning and checks for broken delegations.

  • /DnsDymanicUpdate

    Checks that the Active Directory domain zone is configured to do secure dynamic updates and register a test record.

  • /DnsRecordRegistration

    Tests the registration of all essential DC Locator records.

  • /DnsResolveExtName

    Checks the basic resolution of either an intranet or Internet name.

OutboundSecureChannels

Checks that secure channels exist from all of the domain controllers in the domain to the domains that are specified by the /testdomain parameter. The /nositerestriction parameter prevents dcdiag from limiting the test to the domain controllers in the site.

VerifyReplicas

Checks that all application directory partitions are fully instantiated on all replica servers.

VerifyEnterpriseReferences

Checks that specified system references are intact for the FRS and replication infrastructure across all objects in the enterprise on each domain controller.

Note
AD DS displays text, such as naming context names and server names, which contains international or Unicode characters correctly only if you have installed appropriate fonts and language support on the test computer.

Non-domain controller tests

DcPromo

Tests the existing DNS infrastructure for any computer that you want to promote to be a domain controller. If the infrastructure is sufficient, you can promote the computer to a domain controller in the domain specified in the parameter /DnsDomain:Active_Directory_Domain_DNS_Name. This parameter reports whether any modifications to the existing DNS infrastructure are required. The required argument is /DnsDomain:Active_Directory_Domain_DNS_Name.

One of the following arguments is required:

/NewForest

/NewTree

/ChildDomain

/ReplicaDC

If you specify the /NewTree argument, you must also specify the /ForestRoot:Forest_Root_Domain_DNS_Name argument.

RegisterInDNS

Tests whether this domain controller can register the Domain Controller Locator DNS records. These records must be present in DNS for other computers to locate this domain controller for the Active_Directory_Domain_DNS_Name domain. This parameter reports whether any modifications to the existing DNS infrastructure are required. The required argument is /DnsDomain:Active_Directory_Domain_DNS_Name

Note
With the exception of the DcPromo and RegisterInDNS tests, you must promote computers to be domain controllers before you run tests on them.

How to read the output of DNS-enhanced dcdiag

The following steps summarize how to interpret the results provided by DNS-enhanced dcdiag:

  1. Run dcdiag test:DNS /e /f:dns.txt. Microsoft recommends always using the /v switch to obtain verbose information.

  2. Open the report in Notepad or a compatible editor.

  3. Scroll to end of the report and read the summary table.

  4. Identify servers that returned "warn" or "fail" status for any subtest in the summary table.

  5. Review the section of output for that server to see what problem was detected (hint: use the Find command on the Edit menu to search on the string "DC: DC_computername" (without quotes) to locate the detailed section for a given DC.

  6. Resolve problems on DNS clients or DNS server(s) as required.

  7. Run dcdiag /test:DNS /v /e (or /s:DCName) again to verify the fix. Repeat steps 1 through 6 as required until all failures are understood and reconciled.

Warnings and Errors

Dcdiag takes a conservative approach by identifying DNS client or DNS server configurations that may be problematic, do not conform to best practice configurations, or that dcdiag cannot fully validate. Therefore, the summary and detailed sections of dcdiag may report warnings for DNS configurations that are currently functional. Administrators should investigate and validate such configurations when identified by dcdiag.

The tables below contain the configurations that can trigger dcdiag to report warnings or errors for each of the DNS subtests.

Basic

Warning | Additional information
Warning: Adapter <adapter name> has dynamic IP address | Static IP addresses are recommended for all DNS servers.
Warning: Adapter <adapter name> has invalid DNS server: <name> <IP address> | DNS server may not be reachable.
Warning: No DNS RPC connectivity (error or non Microsoft DNS server is running) | Disregard this warning if the DNS server is a BIND or other non-Microsoft DNS server.
Warning: The Active Directory zone on this DC/DNS server was not found | N/A
Warning: Root zone on this DC/DNS server was found | N/A

Error | Additional information
Error: Authentication failed with specified credentials | DCDIAG requires Enterprise Admin credentials to run all the tests.
Error: No LDAP connectivity | N/A
Error: No DS RPC connectivity | N/A
Error: No WMI connectivity | DNS test requires WMI connectivity to run on the remote computer.
Error: Can't read operating system version through WMI | This might be caused by the lack of a WMI connection on the remote computer.
Error: <Operating system name> not supported (this tool is supported on Windows 2000, Windows XP, and Windows Server 2003 only) | N/A
Error: Open Service Control Manager failed | Unable to find whether the service is running or not.
Error: Kdc/netlogon/DNS/dnscache is not running | Some of the key services are not running.
Error: Can't read network adapter information through WMI | N/A
Error: All DNS servers are invalid | DNS servers that the client is pointing to are either not reachable or not a DNS server, or they have invalid IP addresses.
Error: The A record for this DC was not found | Every domain controller should register a host (A) resource record. Make sure that host (A) records are registered on all the DNS servers that the client is pointing to.
Error: Enumeration of zones failed to find root and AD zone | N/A
Error: Could not query DNS zones on this DC | Make sure that the zone in which the domain controller is supposed to register is present.

Forwarder

Error | Additional information
Error: Forwarders list has invalid forwarder: <IP address of the forwarder> | Forwarders configured on the DNS server have an invalid IP address or are not a DNS server, or name resolution is not working (that is, cannot resolve forest root domain SRV record if it is a non-root domain domain controller).
Error: Both root hints and forwarders are not configured. Please configure either forwarders or root hints | Make sure that either forwarders or root hints are configured on the DNS server unless it hosts a root zone.
Error: Root hints list has invalid root hint server: <IP address of Root hint server> | Root hint servers configured on the DNS server have an invalid IP address or are not a DNS server, or name resolution is not working (that is, cannot resolve forest root domain SRV record if it is a non root domain DC).
Error:<Root hint server Name> IP: <Unavailable> Status:<status of the server> | Configured root hint servers don’t have corresponding IP address. Status field will tell you the status of the server
Error:<Root hint server Name> IP: <Unavailable> Status: A record not found | Configured root hint servers don’t have A record.
Error: Enumeration of Root hint servers failed on <DNS server name> | Couldn’t list the root hint servers on the target DNS server.

Delegation

Warning | Additional information
Warning: DNS server: <DnsServer name> IP: <Ipaddress> Failure: Missing glue A record | The configured delegation is missing glue A record.

Error | Additional information
DNS server: <Server name> IP:<IP address> Error: Broken delegation -verbose | Delegation is configured but the name server is not responding.
DNS server: <Server name> IP:<IP address> Error: Broken delegated domain <Delegated domain name> -non-verbose | N/A
Error: Failed to enumerate the records at the zone root on the server | N/A

DynamicUpdate

Warning | Additional information
Warning: Dynamic update is enabled on the zone but not secure <zone name> | Secure dynamic updates are recommended.
Warning: Failed to add test record _dcdiag_test_record with error <error code> in zone <zone name> | Test adds a dummy record dynamically
Warning: Failed to delete test record _dcdiag_test_record with error <error code> in zone zone <zone name> | Deletes the added record as well.

Error | Additional information
Error: Dynamic update is not enabled on the zone <zone name> | Dynamic update is not enabled on the Active Directory zone so client cannot register its records.

Record registration

Warning | Additional Information
Warning: Missing DC SRV record at DNS server <record name> | Ignore the error if DNSAvoidRegisterRecord registry key or its Group Policy has been configured to prevent registration of this record.
Warning: Missing GC SRV record at DNS server <record name> | Ignore the error if DNSAvoidRegisterRecord registry key or its Group Policy has been configured to prevent registration of this record.
Warning: Missing PDC SRV record at DNS server <record name> | Ignore the error if DNSAvoidRegisterRecord registry key or its Group Policy has been configured to prevent registration of this record.
Warning: Record Registrations not found in some network adapters | N/A

Error | Additional information
Error: Missing A record at DNS server <DNS Server IP address> : <A record name> | DC hasn’t registered its A record on the specified DNS server.
Error: Missing CNAME record at DNS server <DNS Server IP address> : <CNAME record name> | DC hasn’t registered its CNAME record on the specified DNS server.
Error: Missing DC SRV record at DNS server <DNS Server IP address> : <SRV record name> | DC hasn’t registered its DC SRV record on the specified DNS server.
Error: Missing GC SRV record at DNS server <DNS Server IP address> : <SRV record name> | DC hasn’t registered its GC SRV record on the specified DNS server.
Error: Missing PDC SRV record at DNS server <DNS Server IP address> : <SRV record name> | DC hasn’t registered specified PDC SRV record on the specified DNS server. All these records can be registered by stopping and starting the netlogon service.
Error: Record registrations cannot be found for all the network adapters | If there are multiple network adapters the test checks whether all the records are present on all the DNS servers configured on each adapter. This error occurs if the record registration is missing on the DNS server.

External name resolution

Error | Additional information
Error: Internet name <name> cannot be resolved | Specified Internet name cannot be resolved. Make sure the proxy client, servers, root hints, and forwarders are configured properly.

Enterprise DNS infrastructure tests

Warning | Additional information
Warning: Neither forwarders nor root hints are configured from subordinate domain to parent domain | Forwarder or root hints need to be configured in the DNS servers of either the parent or subordinate domains that are hosting the authoritative zones for their respective domain to enable name resolution to work.

Error | Additional information
Error: Delegation is not configured on the parent domain | Delegation should be configured from parent to subordinate domain.
Error: Delegation is present but the glue record is missing | Delegation is configured but the name servers are missing their glue record.
Error: Forwarders are misconfigured from parent domain to subordinate domain | Forwarders must be configured from subordinate domain to parent domain.
Error: Root hints are misconfigured from parent domain to subordinate domain | Root hints must be configured from subordinate domain to parent domain.
Error: Forwarders are configured from subordinate to parent domain but some of them failed DNS server tests (See DNS servers section for error details) | Forwarders configured have an invalid IP address or are not a valid DNS server, or name resolution is not working (cannot resolve forest root domain SRV record if it is in the non-root domain).
Error: Root hints are configured from subordinate to parent domain but some of them failed DNS server tests (See DNS servers section for error details) | Root hints configured have an invalid IP address or are not a valid DNS server, or name resolution is not working.

Examples

Example 1: A normal domain controller

In this example, you want to examine the domain controller so you can verify that it is healthy and functioning properly. Type the following command at the elevated command prompt:

C:\Windows\system32>dcdiag /s:reskit-DC1 \administrator password

Output similar to the following appears:

Copy Code
Domain Controller Diagnosis

Performing initial setup:
   Done gathering initial info.

Doing initial required tests

   Testing server: Default-First-Site-Name\RESKIT-DC1
      Starting test: Connectivity
         ......................... RESKIT-DC1 passed test Connectivity

Doing primary tests

   Testing server: Default-First-Site-Name\RESKIT-DC1
      Starting test: Replications
         ......................... RESKIT-DC1 passed test Replications
      Starting test: NCSecDesc
         ......................... RESKIT-DC1 passed test NCSecDesc
      Starting test: NetLogons
         ......................... RESKIT-DC1 passed test NetLogons
      Starting test: Advertising
         ......................... RESKIT-DC1 passed test Advertising
      Starting test: KnowsOfRoleHolders
         ......................... RESKIT-DC1 passed test KnowsOfRoleHolders
      Starting test: RidManager
         ......................... RESKIT-DC1 passed test RidManager
      Starting test: MachineAccount
         ......................... RESKIT-DC1 passed test MachineAccount
      Starting test: Services
         ......................... RESKIT-DC1 passed test Services
      Starting test: ObjectsReplicated
         ......................... RESKIT-DC1 passed test ObjectsReplicated
      Starting test: frssysvol
         ......................... RESKIT-DC1 passed test frssysvol
      Starting test: kccevent
         ......................... RESKIT-DC1 passed test kccevent
      Starting test: systemlog

         ......................... RESKIT-DC1 passed test systemlog

   Running partition tests on : Schema
      Starting test: DeadCRTest
         ......................... Schema passed test DeadCRTest
      Starting test: CheckSDRefDom
         ......................... Schema passed test CheckSDRefDom

   Running partition tests on : Configuration
      Starting test: DeadCRTest
         ......................... Configuration passed test DeadCRTest
      Starting test: CheckSDRefDom
         ......................... Configuration passed test CheckSDRefDom

   Running partition tests on : RESKIT-DOM
      Starting test: DeadCRTest
         ......................... RESKIT-DOM passed test DeadCRTest
      Starting test: CheckSDRefDom
         ......................... RESKIT-DOM passed test CheckSDRefDom

   Running enterprise tests on : RESKIT-DOM.reskit.com
      Starting test: Intersite
         ......................... RESKIT-DOM.reskit.com passed test Intersite
      Starting test: FsmoCheck
         ......................... RESKIT-DOM.reskit.com passed test FsmoCheck

Example 2: Failed DNS registration

In this example, you have noticed that one of the domain controllers is not replicating properly. After you verify that the domain controller is operational and can be pinged by IP address, use dcdiag to do an enterprise check. Type the following command at an elevated command prompt:

C:\Windows\system32>dcdiag /s:reskit-DC1 \administrator password /e

Output similar to the following appears:

Copy Code
Domain Controller Diagnosis

Performing initial setup:
   Done gathering initial info.

Doing initial required tests

   Testing server: Default-First-Site-Name\RESKIT-DC1
      Starting test: Connectivity
         ......................... RESKIT-DC1 passed test Connectivity

   Testing server: Default-First-Site-Name\RESKIT-DC2
      Starting test: Connectivity
         The host 7594898c-8ba4-4496-a01a-b0f2cadd28a6._msdcs.RESKIT-DOM.reskit.com could not be resolved to an
         IP address.  Check the DNS server, DHCP, server name, etc
         Although the Guid DNS name
         (7594898c-8ba4-4496-a01a-b0f2cadd28a6._msdcs.RESKIT-DOM.reskit.com)
          couldn't be resolved, the server name
         (reskit-DC2.reskit-sib.RESKIT-DOM.reskit.com) resolved
         to the IP address (172.26.220.34) and was pingable.  Check that the IP
         address is registered correctly with the DNS server.
         ......................... RESKIT-DC2 failed test Connectivity

Doing primary tests

   Testing server: Default-First-Site-Name\RESKIT-DC1
      Starting test: Replications
         [Replications Check,RESKIT-DC1] A recent replication attempt failed:
            From RESKIT-DC2 to RESKIT-DC1
            Naming Context: CN=Configuration,DC=RESKIT-DOM,DC=reskit,DC=com
            The replication generated an error (1722):
            The RPC server is unavailable.
            The failure occurred at 2007-12-21 02:19:04.
            The last success occurred at 2007-12-21 01:57:43.
            1 failures have occurred since the last success.
            The source remains down. Please check the machine.
         ......................... RESKIT-DC1 passed test Replications
      Starting test: NCSecDesc
         ......................... RESKIT-DC1 passed test NCSecDesc
      Starting test: NetLogons
         ......................... RESKIT-DC1 passed test NetLogons
      Starting test: Advertising
         ......................... RESKIT-DC1 passed test Advertising
      Starting test: KnowsOfRoleHolders
         ......................... RESKIT-DC1 passed test KnowsOfRoleHolders
      Starting test: RidManager
         ......................... RESKIT-DC1 passed test RidManager
      Starting test: MachineAccount
         ......................... RESKIT-DC1 passed test MachineAccount
      Starting test: Services
         ......................... RESKIT-DC1 passed test Services
      Starting test: ObjectsReplicated
         ......................... RESKIT-DC1 passed test ObjectsReplicated
      Starting test: frssysvol
         ......................... RESKIT-DC1 passed test frssysvol
      Starting test: kccevent
         ......................... RESKIT-DC1 passed test kccevent
      Starting test: systemlog
         An Error Event occurred.  EventID: 0xC25A001D
            Time Generated: 12/21/2007   01:28:25
            Event String: The time provider NtpClient is configured to
         An Error Event occurred.  EventID: 0xC25A001D
            Time Generated: 12/21/2007   01:40:30
            Event String: The time provider NtpClient is configured to
         An Error Event occurred.  EventID: 0xC25A001D
            Time Generated: 12/21/2007   01:43:30
            Event String: The time provider NtpClient is configured to
         An Error Event occurred.  EventID: 0xC25A001D
            Time Generated: 12/21/2007   01:58:46
            Event String: The time provider NtpClient is configured to
         An Error Event occurred.  EventID: 0xC25A001D
            Time Generated: 12/21/2007   02:02:11
            Event String: The time provider NtpClient is configured to
         An Error Event occurred.  EventID: 0xC25A001D
            Time Generated: 12/21/2007   02:05:11
            Event String: The time provider NtpClient is configured to
         An Error Event occurred.  EventID: 0xC25A001D
            Time Generated: 12/21/2007   02:10:51
            Event String: The time provider NtpClient is configured to
         An Error Event occurred.  EventID: 0xC25A001D
            Time Generated: 12/21/2007   02:13:51
            Event String: The time provider NtpClient is configured to
         An Error Event occurred.  EventID: 0xC25A001D
            Time Generated: 12/21/2007   02:18:58
            Event String: The time provider NtpClient is configured to
         An Error Event occurred.  EventID: 0xC25A001D
            Time Generated: 12/21/2007   02:21:58
            Event String: The time provider NtpClient is configured to
         ......................... RESKIT-DC1 failed test systemlog

   Testing server: Default-First-Site-Name\RESKIT-DC2
      Skipping all tests, because server RESKIT-DC2 is
      not responding to directory service requests

   Running partition tests on : Schema
      Starting test: DeadCRTest
         ......................... Schema passed test DeadCRTest
      Starting test: CheckSDRefDom
         ......................... Schema passed test CheckSDRefDom

   Running partition tests on : Configuration
      Starting test: DeadCRTest
         ......................... Configuration passed test DeadCRTest
      Starting test: CheckSDRefDom
         ......................... Configuration passed test CheckSDRefDom

   Running partition tests on : RESKIT-DOM
      Starting test: DeadCRTest
         ......................... RESKIT-DOM passed test DeadCRTest
      Starting test: CheckSDRefDom
         ......................... RESKIT-DOM passed test CheckSDRefDom

   Running partition tests on : reskit-sib
      Starting test: DeadCRTest
         ......................... reskit-sib passed test DeadCRTest
      Starting test: CheckSDRefDom
         ......................... reskit-sib passed test CheckSDRefDom

   Running enterprise tests on : RESKIT-DOM.reskit.com
      Starting test: Intersite
         ......................... RESKIT-DOM.reskit.com passed test Intersite
      Starting test: FsmoCheck
         ......................... RESKIT-DOM.reskit.com passed test FsmoCheck

Example 3: Failed Netlogon Service

In this example, the Netlogon Service has failed on one of the domain controllers. To troubleshoot, type the following command at an elevated command prompt:

C:\Windows\system32>dcdiag /s:reskit-DC1 \administrator password

Output similar to the following appears:

Copy Code
Domain Controller Diagnosis

Performing initial setup:
   Done gathering initial info.

Doing initial required tests

   Testing server: Default-First-Site-Name\RESKIT-DC1
      Starting test: Connectivity
         ......................... RESKIT-DC1 passed test Connectivity

Doing primary tests

   Testing server: Default-First-Site-Name\RESKIT-DC1
      Starting test: Replications
         ......................... RESKIT-DC1 passed test Replications
      Starting test: NCSecDesc
         ......................... RESKIT-DC1 passed test NCSecDesc
      Starting test: NetLogons
         ......................... RESKIT-DC1 passed test NetLogons
      Starting test: Advertising
         Fatal Error:DsGetDcName (RESKIT-DC1) call failed, error 1722
         The Locator could not find the server.
         ......................... RESKIT-DC1 failed test Advertising
      Starting test: KnowsOfRoleHolders
         ......................... RESKIT-DC1 passed test KnowsOfRoleHolders
      Starting test: RidManager
         ......................... RESKIT-DC1 passed test RidManager
      Starting test: MachineAccount
         ......................... RESKIT-DC1 passed test MachineAccount
      Starting test: Services
            NETLOGON Service is stopped on [RESKIT-DC1]
         ......................... RESKIT-DC1 failed test Services
      Starting test: ObjectsReplicated
         ......................... RESKIT-DC1 passed test ObjectsReplicated
      Starting test: frssysvol
         ......................... RESKIT-DC1 passed test frssysvol
      Starting test: kccevent
         ......................... RESKIT-DC1 passed test kccevent
      Starting test: systemlog
         An Error Event occurred.  EventID: 0xC25A001D
            Time Generated: 12/21/2007   01:28:25
            Event String: The time provider NtpClient is configured to
         An Error Event occurred.  EventID: 0xC25A001D
            Time Generated: 12/21/2007   01:40:30
            Event String: The time provider NtpClient is configured to
         An Error Event occurred.  EventID: 0xC25A001D
            Time Generated: 12/21/2007   01:43:30
            Event String: The time provider NtpClient is configured to
         An Error Event occurred.  EventID: 0xC25A001D
            Time Generated: 12/21/2007   01:58:46
            Event String: The time provider NtpClient is configured to
         An Error Event occurred.  EventID: 0xC25A001D
            Time Generated: 12/21/2007   02:02:11
            Event String: The time provider NtpClient is configured to
         An Error Event occurred.  EventID: 0xC25A001D
            Time Generated: 12/21/2007   02:05:11
            Event String: The time provider NtpClient is configured to
         An Error Event occurred.  EventID: 0xC25A001D
            Time Generated: 12/21/2007   02:10:51
            Event String: The time provider NtpClient is configured to
         An Error Event occurred.  EventID: 0xC25A001D
            Time Generated: 12/21/2007   02:13:51
            Event String: The time provider NtpClient is configured to
         ......................... RESKIT-DC1 failed test systemlog

   Running partition tests on : Schema
      Starting test: DeadCRTest
         ......................... Schema passed test DeadCRTest
      Starting test: CheckSDRefDom
         ......................... Schema passed test CheckSDRefDom

   Running partition tests on : Configuration
      Starting test: DeadCRTest
         ......................... Configuration passed test DeadCRTest
      Starting test: CheckSDRefDom
         ......................... Configuration passed test CheckSDRefDom

   Running partition tests on : RESKIT-DOM
      Starting test: DeadCRTest
         ......................... RESKIT-DOM passed test DeadCRTest
      Starting test: CheckSDRefDom
         ......................... RESKIT-DOM passed test CheckSDRefDom

   Running enterprise tests on : RESKIT-DOM.reskit.com
      Starting test: Intersite
         ......................... RESKIT-DOM.reskit.com passed test Intersite
      Starting test: FsmoCheck
         Warning: DcGetDcName(GC_SERVER_REQUIRED) call failed, error 1717
         A Global Catalog Server could not be located - All GC's are down.
         Warning: DcGetDcName(PDC_REQUIRED) call failed, error 1717
         A Primary Domain Controller could not be located.
         The server holding the PDC role is down.
         Warning: DcGetDcName(TIME_SERVER) call failed, error 1717
         A Time Server could not be located.
         The server holding the PDC role is down.
         Warning: DcGetDcName(GOOD_TIME_SERVER_PREFERRED) call failed, error 1717
         A Good Time Server could not be located.
         Warning: DcGetDcName(KDC_REQUIRED) call failed, error 1717
         A KDC could not be located - All the KDCs are down.
         ......................... RESKIT-DOM.reskit.com failed test FsmoCheck

Example 4: Unresponsive or inaccessible server

In this example, you have noticed replication problems. To resolve the issue, type the following command at an elevated command prompt:

C:\Windows\system32>dcdiag /s:reskit-DC1 \administrator password /e

Output similar to the following appears:

Copy Code
Domain Controller Diagnosis

Performing initial setup:
   Done gathering initial info.

Doing initial required tests

   Testing server: Default-First-Site-Name\RESKIT-DC1
      Starting test: Connectivity
         ......................... RESKIT-DC1 passed test Connectivity

   Testing server: Default-First-Site-Name\RESKIT-DC2
      Starting test: Connectivity
         Server RESKIT-DC2 resolved to this IP address 172.26.220.34,
         but the address couldn't be reached(pinged), so check the network.
         The error returned was: Error due to lack of resources.
         This error more often means that the targeted server is
         shutdown or disconnected from the network
         ......................... RESKIT-DC2 failed test Connectivity

Doing primary tests

   Testing server: Default-First-Site-Name\RESKIT-DC1
      Starting test: Replications
         [Replications Check,RESKIT-DC1] A recent replication attempt failed:
            From RESKIT-DC2 to RESKIT-DC1
            Naming Context: CN=Configuration,DC=RESKIT-DOM,DC=reskit,DC=com
            The replication generated an error (1722):
            The RPC server is unavailable.
            The failure occurred at 2007-12-21 02:19:04.
            The last success occurred at 2007-12-21 01:57:43.
            1 failures have occurred since the last success.
            The source remains down. Please check the machine.
         ......................... RESKIT-DC1 passed test Replications
      Starting test: NCSecDesc
         ......................... RESKIT-DC1 passed test NCSecDesc
      Starting test: NetLogons
         ......................... RESKIT-DC1 passed test NetLogons
      Starting test: Advertising
         ......................... RESKIT-DC1 passed test Advertising
      Starting test: KnowsOfRoleHolders
         ......................... RESKIT-DC1 passed test KnowsOfRoleHolders
      Starting test: RidManager
         ......................... RESKIT-DC1 passed test RidManager
      Starting test: MachineAccount
         ......................... RESKIT-DC1 passed test MachineAccount
      Starting test: Services
         ......................... RESKIT-DC1 passed test Services
      Starting test: ObjectsReplicated
         ......................... RESKIT-DC1 passed test ObjectsReplicated
      Starting test: frssysvol
         ......................... RESKIT-DC1 passed test frssysvol
      Starting test: kccevent
         ......................... RESKIT-DC1 passed test kccevent
      Starting test: systemlog
         An Error Event occurred.  EventID: 0xC25A001D
            Time Generated: 12/21/2007   01:28:25
            Event String: The time provider NtpClient is configured to
         An Error Event occurred.  EventID: 0xC25A001D
            Time Generated: 12/21/2007   01:40:30
            Event String: The time provider NtpClient is configured to
         An Error Event occurred.  EventID: 0xC25A001D
            Time Generated: 12/21/2007   01:43:30
            Event String: The time provider NtpClient is configured to
         An Error Event occurred.  EventID: 0xC25A001D
            Time Generated: 12/21/2007   01:58:46
            Event String: The time provider NtpClient is configured to
         An Error Event occurred.  EventID: 0xC25A001D
            Time Generated: 12/21/2007   02:02:11
            Event String: The time provider NtpClient is configured to
         An Error Event occurred.  EventID: 0xC25A001D
            Time Generated: 12/21/2007   02:05:11
            Event String: The time provider NtpClient is configured to
         An Error Event occurred.  EventID: 0xC25A001D
            Time Generated: 12/21/2007   02:10:51
            Event String: The time provider NtpClient is configured to
         An Error Event occurred.  EventID: 0xC25A001D
            Time Generated: 12/21/2007   02:13:51
            Event String: The time provider NtpClient is configured to
         An Error Event occurred.  EventID: 0xC25A001D
            Time Generated: 12/21/2007   02:18:58
            Event String: The time provider NtpClient is configured to
         ......................... RESKIT-DC1 failed test systemlog

   Testing server: Default-First-Site-Name\RESKIT-DC2
      Skipping all tests, because server RESKIT-DC2 is
      not responding to directory service requests

   Running partition tests on : Schema
      Starting test: DeadCRTest
         ......................... Schema passed test DeadCRTest
      Starting test: CheckSDRefDom
         ......................... Schema passed test CheckSDRefDom

   Running partition tests on : Configuration
      Starting test: DeadCRTest
         ......................... Configuration passed test DeadCRTest
      Starting test: CheckSDRefDom
         ......................... Configuration passed test CheckSDRefDom

   Running partition tests on : RESKIT-DOM
      Starting test: DeadCRTest
         ......................... RESKIT-DOM passed test DeadCRTest
      Starting test: CheckSDRefDom
         ......................... RESKIT-DOM passed test CheckSDRefDom

   Running partition tests on : reskit-sib
      Starting test: DeadCRTest
         ......................... reskit-sib passed test DeadCRTest
      Starting test: CheckSDRefDom
         ......................... reskit-sib passed test CheckSDRefDom

   Running enterprise tests on : RESKIT-DOM.reskit.com
      Starting test: Intersite
         ......................... RESKIT-DOM.reskit.com passed test Intersite
      Starting test: FsmoCheck
         ......................... RESKIT-DOM.reskit.com passed test FsmoCheck

Additional references

Command-Line Syntax Key


Dcpromo

Applies To: Windows Server 2003 with SP1,Windows Server 2008 R2,Windows Server 2008,Windows Server 2003 R2,Windows Server 2003

Installs and removes Active Directory Domain Services (AD DS).

For examples of how to use dcpromo, see Examples.

Syntax

Copy Code
dcpromo [/answer[:<filename>] | /unattend[:<filename>] | /unattend | /adv] /uninstallBinaries [/CreateDCAccount | /UseExistingAccount:Attach] /? /?[:{Promotion | CreateDCAccount | UseExistingAccount | Demotion}]

Dcpromo.exe parameters

Parameter | Description
/answer[:<filename>] | Specifies an answer file that contains installation parameters and values.
/unattend[:<filename>] | Specifies an answer file that contains installation parameters and values. This command provides the same function as /answer[:<filename>].
/unattend | Specifies an unattended installation in which you provide installation parameters and values at the command line.
/adv | Performs an install from media (IFM) operation.
/UninstallBinaries | Uninstalls AD DS binaries.
/CreateDCAccount | Creates a read-only domain controller (RODC) account. Only a member of the Domain Admins group or the Enterprise Admins group can run this command.
/UseExistingAccount:Attach | Attaches a server to an existing RODC account. A member of the Domain Admins group or a delegated user can run this command.
/? | Displays Help for Dcpromo parameters.
/?[:{Promotion | CreateDCAccount | UseExistingAccount | Demotion}] | Displays parameters that apply to the dcpromo operation. For example, dcpromo /?:Promotion displays all of the parameters that you can use for a promotion operation.

dcpromo Promotion operation parameters

The following table shows the parameters that you can specify at a command prompt as part of an unattended installation of a domain controller that runs Windows Server 2008.

For more information about creating a new forest, see Installing a New Windows Server 2008 Forest (http://go.microsoft.com/fwlink/?LinkId=133255).

For more information about creating a new domain, see Installing a New Windows Server 2008 Child Domain (http://go.microsoft.com/fwlink/?LinkId=133256).

For more information about creating a new domain tree, see Installing a New Windows Server 2008 Domain Tree (http://go.microsoft.com/fwlink/?LinkId=133257).

For more information about creating an additional domain controller for a domain, see Installing an Additional Windows Server 2008 Domain Controller (http://go.microsoft.com/fwlink/?LinkId=133258).

Parameter:value Description and default

AllowDomainControllerReinstall:{Yes | <No> | NoAndNoPromptEither}

Specifies whether to continue installing this domain controller, despite the fact that another domain controller account with the same name is detected.

Use Yes only if you are sure that the account is not currently used by another domain controller.

The default is No.

AllowDomainReinstall:{Yes | <No> | NoAndNoPromptEither}

Specifies whether an existing domain is recreated.

The default is No.

ApplicationPartitionsToReplicate:""

Specifies the application directory partitions that dcpromo will replicate. Use the following format:

"partition1" "partition2" "partitionN"

Use * to replicate all application directory partitions.

AutoConfigDNS:{Yes | No}

This parameter has been renamed to InstallDNS.

Specifies whether the DNS Server service should be installed. The default is automatically computed based on the environment.

ChildName:"child_domain_name"

Specifies the single-label Domain Name System (DNS) name of the child domain.

ConfirmGc:{Yes | No}

Specifies whether you want the domain controller to be a global catalog server.

CreateDNSDelegation: { Yes | No}

Indicates whether to create a DNS delegation that references the new DNS server that you are installing along with the domain controller. Valid for Active Directory–integrated DNS only.

The default is computed automatically based on the environment.

CriticalReplicationOnly:{Yes | <No>}

Specifies whether the AD DS installation operation performs only critical replication before reboot and then continues, skipping the noncritical (and potentially lengthy) portion of replication. The noncritical replication happens after the installation finishes and the computer reboots.

The default is No.

DatabasePath:"path_to_database_files"

Specifies the fully qualified, non–Universal Naming Convention (UNC) path to a directory on a fixed disk of the local computer that contains the domain database, for example, C:\Windows\NTDS.

The default is %SYSTEMROOT%\NTDS.

DelegatedAdmin:"name of user or group"

Specifies the name of the user or group that will install and administer the RODC.

DNSDelegationPassword:"password"

Specifies the password for the user name (account credentials) for creating DNS delegation.

DNSDelegationUserName:"user_name"

Specifies the user name (account credentials) for creating DNS delegation.

DNSOnNetwork:{<Yes> | No}

Specifies whether DNS service is available on the network. This parameter is used only when the IP setting of the network adapter for this computer is not configured with the name of a DNS server for name resolution. No indicates that a DNS server will be installed on this computer for name resolution. Otherwise, the IP settings of the network adapter must be configured with a DNS server name first.

The default is Yes.

DomainLevel:{0 | 2 | 3 | 4}

Specifies the domain functional level during the creation of a new domain. A value of 0 specifies Windows 2000. A value of 2 specifies Windows Server 2003. A value of 3 specifies Windows Server 2008. A value of 4 specifies Windows Server 2008 R2.

The domain functional level cannot be lower than the forest functional level, but it can be higher.

The default is automatically computed and set to the existing forest functional level or the value that is set for /ForestLevel.

DomainNetBiosName:"domain_NetBIOS_name"

Assigns a NetBIOS name to the new domain.

ForestLevel:{<0> | <2> | 3 | 4}

Specifies the forest functional level when you create a new forest. A value of 0 specifies Windows 2000. A value of 2 specifies Windows Server 2003. A value of 3 specifies Windows Server 2008. A value of 4 specifies Windows Server 2008 R2.

The default forest functional level in Windows Server 2008 when you create a new forest is Windows 2000 (0).

The default forest functional level in Windows Server 2008 R2 when you create a new forest is Windows Server 2003 (2).

Do not use this parameter when you install a domain controller in an existing forest.

InstallDNS:{Yes | No}

Specifies whether the DNS Server service should be installed. The default is automatically computed based on the environment. This parameter replaces AutoConfigDNS.

LogPath:"path_to_log_files"

Specifies the fully qualified, non-UNC path to a directory on a fixed disk of the local computer that contains the domain log files, for example, C:\Windows\Logs.

The default is %SYSTEMROOT%\NTDS.

NewDomain:{Tree | Child | <Forest>}

Indicates the type of domain that you want to create: a new domain tree in an existing forest, a child of an existing domain, or a new forest.

The default is new forest.

NewDomainDNSName:"DNS_name_of_domain"

Specifies the fully qualified domain name (FQDN) for the new domain.

ParentDomainDNSName:"DNS_name_of_domain"

Specifies the FQDN of an existing parent domain. You use this parameter when you install a child domain.

Password:"password"

Specifies the password that corresponds to the user name (account credentials) that is used to install the domain controller. Use this parameter in conjunction with the UserName parameter.

Use * to prompt the user to supply a password.

PasswordReplicationAllowed:{"security_principal" | None}

Specifies the names of user accounts, group accounts, and computer accounts whose passwords can be replicated to this RODC. Use None if you want to keep the value empty. By default, only the Allowed RODC Password Replication Group is allowed, and it is originally created empty.

PasswordReplicationDenied:{"security_principal" | None}

Specifies the names of user accounts, group accounts, and computer accounts whose passwords are not to be replicated to this RODC. Use None if you do not want to deny the replication of credentials of any users or computers. By default, Administrators, Server Operators, Backup Operators, Account Operators, and the Denied RODC Password Replication Group are denied. By default, the Denied RODC Password Replication Group includes Cert Publishers, Domain Admins, Enterprise Admins, Enterprise Domain Controllers, Enterprise Read-Only Domain Controllers, Group Policy Creator Owners, the krbtgt account, and Schema Admins.

RebootOnCompletion:{<Yes> | No}

Specifies whether to restart the computer upon completion of the command, regardless of success.

The default is Yes.

RebootOnSuccess:{<Yes> | No | NoAndNoPromptEither}

Specifies whether to restart the computer upon successful completion of the command.

The default is Yes.

ReplicaDomainDNSName:"DNS_name_of_domain"

Specifies the FQDN of the domain in which you want to install an additional domain controller.

ReplicaOrNewDomain:{<Replica> | ReadOnlyReplica | Domain}

Specifies whether to install an additional domain controller (a writable domain controller or an RODC) or to create a new domain.

The default is to install an additional writable domain controller.

ReplicationSourceDC:"DNS_name_of_DC"

Indicates the FQDN of the partner domain controller from which you replicate the domain information.

ReplicationSourcePath:"replication_source_path"

Indicates the location of the installation media that will be used to install a new domain controller.

SafeModeAdminPassword:"password"

Supplies the password for the administrator account when the computer is started in Safe Mode or a variant of Safe Mode, such as Directory Services Restore Mode.

The default is an empty password. You must supply a password.

SiteName:"site_name"

Specifies the name of an existing site where you can place the new domain controller.

The default value depends on the type of installation. For a new forest, the default is Default-First-Site-Name. For all other installations, the default is the site that is associated with the subnet that includes the IP address of this server. If no such site exists, the default is the site of the replication source domain controller.

SkipAutoConfigDns

Skips automatic configuration of DNS client settings, forwarders, and root hints. This parameter is in effect only if the DNS Server service is already installed.

Syskey:{<none> | system key}

Specifies the system key for the media from which you replicate the data.

The default is none.

SysVolPath:"path_to_database_file"

Specifies the fully qualified, non-UNC path to a directory on a fixed disk of the local computer, for example, C:\Windows\SYSVOL.

The default is %SYSTEMROOT%\SYSVOL.

TransferIMRoleIfNecessary:{Yes | <No>}

Specifies whether to transfer the infrastructure master operations master role (also known as flexible single master operations or FSMO) to the domain controller that you are creating—in case it is currently hosted on a global catalog server—and you do not plan to make the domain controller that you are creating a global catalog server. Use Yes to transfer the infrastructure master role to the domain controller that you are creating in case the transfer is needed; in this case, make sure to use /ConfirmGC:No. Use No if you want the infrastructure master role to remain where it currently is.

The default is No.

UserDomain:"domain_name"

Specifies the domain name for the user name (account credentials) for installing a domain controller.

Use this parameter in conjunction with the UserName parameter.

UserName:"user_name"

Specifies the user name (account credentials) for the operation. If no value is specified, the credentials of the current user are used for the operation.

dcpromo /CreateDCAccount operation parameters

The following table shows the parameters that you can use when you create an RODC account.

For more information about creating an RODC account, see Performing a Staged RODC Installation (http://go.microsoft.com/fwlink/?LinkId=133259).

Parameter:value | Description and default
AutoConfigDNS:{Yes | No} This parameter has been renamed to InstallDNS. | Specifies whether the DNS Server service should be installed. The default is computed automatically based on the environment.
ConfirmGc:{Yes | No} | Specifies whether the domain controller will be a global catalog server.
DCAccountName:"name of the domain controller to create" | Specifies the name of the RODC account that you are creating.
DelegatedAdmin:"name of user or group" | Specifies the name of the user or group that will install and administer the RODC.
InstallDNS:{Yes | No} | Specifies whether the DNS Server service should be installed. The default is computed automatically based on the environment. This parameter replaces /AutoConfigDNS.
Password:"password" | Specifies the password that corresponds to the user name (account credentials) that is used to install the domain controller. Use this parameter in conjunction with the UserName parameter. Specify * to prompt the user to supply a password.
PasswordReplicationAllowed:{"security_principal" | None} | Specifies the names of user accounts, group accounts, and computer accounts whose passwords can be replicated to this RODC. Use None if you want to keep this value empty. By default, only the Allowed RODC Password Replication Group is allowed, and it is originally created empty.
PasswordReplicationDenied:{"security_principal" | None} | Specifies the names of user accounts, group accounts, and computer accounts whose passwords are not to be replicated to this RODC. Use None if you do not want to deny the replication of credentials of any users or computers. By default, Administrators, Server Operators, Backup Operators, Account Operators, and the Denied RODC Password Replication Group are denied. By default, the Denied RODC Password Replication Group includes Cert Publishers, Domain Admins, Enterprise Admins, Enterprise Domain Controllers, Enterprise Read-Only Domain Controllers, Group Policy Creator Owners, the krbtgt account, and Schema Admins.
ReplicaDomainDNSName:"DNS_name_of_domain" | Specifies the FQDN of the domain in which you want to install an additional domain controller.
ReplicationSourceDC:"DNS_name_of_DC" | Indicates the FQDN of the partner domain controller from which you replicate the domain information.
SiteName:"site_name" | Specifies the name of an existing site where you can place the new domain controller. The default value depends on the type of installation. For a new forest, the default is Default-First-Site-Name. For all other installations, the default is the site that is associated with the subnet that includes the IP address of this server. If no such site exists, the default is the site of the replication source domain controller.
UserDomain:"domain_name" | Specifies the domain name for the user name (account credentials) for the operation. This parameter also helps to specify the forest where you plan to install the domain controller or create an RODC account. If no value is specified, the domain of the computer is used.
UserName:"user_name" | Specifies the user name (account credentials) for the operation. If no value is specified, the credentials of the current user are used for the operation.

dcpromo /UseExistingAccount operation parameters

You can use parameters in the following list when you attach a server to an RODC account.

For more information about attaching a server to an RODC account, see Performing a Staged RODC Installation (http://go.microsoft.com/fwlink/?LinkId=133259).

Parameter:value | Description and default
ApplicationPartitionsToReplicate:"" | Specifies the application directory partitions that dcpromo will replicate. Use the following format: "partition1" "partition2" "partitionN" Use * to replicate all application directory partitions.
CriticalReplicationOnly:{Yes | <No>} | Specifies whether the installation performs only critical replication before reboot and then continues, skipping the noncritical (and potentially lengthy) portion of replication. The noncritical replication happens after the role installation finishes and the computer reboots. The default is No.
DatabasePath:"path_to_database_files" | Specifies the fully qualified, non-UNC path to a directory on a fixed disk of the local computer that contains the domain database, for example, C:\Windows\NTDS. The default is %SYSTEMROOT%\NTDS.
DNSOnNetwork:{<Yes> | No} | Specifies whether the DNS Server service is available on the network. This parameter is used only when the IP setting of the network adapter for this computer is not configured with the name of a DNS server for name resolution. No indicates that DNS server will be installed on this computer for name resolution. Otherwise, the IP settings of network adapter must be configured with a DNS server name first. The default is Yes.
LogPath:"path_to_log_files" | Specifies the fully qualified, non-UNC path to a directory on a fixed disk of the local computer that contains the domain log files, for example, C:\Windows\Logs. The default is %SYSTEMROOT%\NTDS.
Password:"password" | Specifies the password that corresponds to the user name (account credentials) that is used to install the domain controller. Use this parameter in conjunction with the UserName parameter. Use * to prompt the user to supply a password.
RebootOnCompletion:{<Yes> | No} | Specifies whether to restart the computer upon completion, regardless of success. The default is Yes.
RebootOnSuccess:{<Yes> | No | NoAndNoPromptEither} | Specifies whether to restart the computer upon successful completion. The default is Yes.
ReplicaDomainDNSName:"DNS_name_of_domain" | Specifies the FQDN of the domain in which you want to install an additional domain controller.
ReplicationSourceDC:"DNS_name_of_DC" | Indicates the FQDN of the partner domain controller from which you replicate the domain information.
ReplicationSourcePath:"replication_source_path" | Indicates the location of the installation media that will be used to install a new domain controller.
SafeModeAdminPassword:"password" | Supplies the password for the administrator account when the computer is started in Safe Mode or a variant of Safe Mode, such as Directory Service Restore Mode. The default is an empty password. You must supply a password.
SkipAutoConfigDns | Skips automatic configuration of DNS client settings, forwarders, and root hints. This parameter is in effect only if the DNS Server service is already installed.
Syskey:{<none> | system key} | Specifies the system key for the media from which you replicate the data. The default is none.
SysVolPath:"path_to_database_file" | Specifies the fully qualified, non-UNC path to a directory on a fixed disk of the local computer, for example, C:\Windows\SYSVOL. The default is %SYSTEMROOT%\SYSVOL.
UserDomain:"domain_name" | Specifies the domain name for the user name (account credentials) for the operation. This parameter also helps to specify the forest where you plan to install the domain controller or create an RODC account. If no value is specified, the domain of the computer will be used.
UserName:"user_name" | Specifies the user name (account credentials) for the operation. If no value is specified, the credentials of the current user are used for the operation.

dcpromo Demotion operation parameters

You can use parameters in the following list when you remove AD Ds from a domain controller that runs Windows Server 2008.

For more information about removing a domain controller from a domain, see Removing a Windows Server 2008 Domain Controller from a Domain (http://go.microsoft.com/fwlink/?LinkID=128114).

For more information about removing the last domain controller in a domain, see Removing the Last Windows Server 2008 Domain Controller in a Domain (http://go.microsoft.com/fwlink/?LinkId=133260).

For more information about removing the last domain controller in a forest, see Removing the Last Windows Server 2008 Domain Controller in a Forest (http://go.microsoft.com/fwlink/?LinkId=133261).

For more information about forcing the removal of a domain controller, see Forcing the Removal of a Windows Server 2008 Domain Controller (http://go.microsoft.com/fwlink/?LinkID=132627).

Parameter:value Description and default

AdministratorPassword:"administrator password"

Specifies a local administrator account password when AD DS is removed from a domain controller. The default is an empty password.

DemoteFSMO:{Yes | <No>}

Indicates that (forced) demotion should continue even if an operations master role is discovered on domain controller from which AD DS is being removed.

The default is No.

DNSDelegationPassword {Password | *}

Specifies the password to use for the user name (the account credentials) when you create or remove the DNS delegation. Specify * to prompt the user to enter credentials.

DNSDelegationUserName: "user_name"

Specifies the user name to use when you create or remove the DNS delegation. If you do not specify a value, then the account credentials that you specify for the AD DS installation or removal are used to for the DNS delegation.

IgnoreIsLastDcInDomainMismatch:{Yes | <No>}

Used in conjunction with /IsLastDCInDomain. This parameter specifies whether Dcpromo.exe ignores any inconsistency that it detects with the value that you specify for /IsLastDCInDomain. For example, if you specify /IsLastDCInDomain:Yes but dcpromo detects that there is actually another active domain controller in the domain, you can specify /IgnoreIsLastDcInDomainMismatch:Yes to have dcpromo continue the removal of AD DS from the domain controller despite the inconsistency that it has detected. Similarly, if you specify /IsLastDCInDomain:No but dcpromo cannot detect that another domain controller is in the domain, you can specify /IgnoreIsLastDcInDomainMismatch:Yes to have dcpromo continue to remove AD DS from the domain controller.

The default is No. The default causes the wizard to prompt the user to continue, and it causes the command-line tool to exit with an error.

IgnoreIsLastDNSServerForZone:{Yes | <No>}

Specifies whether to continue the removal of AD DS despite the fact that the domain controller is the last DNS server for one or more of the Active Directory–integrated DNS zones that it hosts.

The default is No.

IsLastDCInDomain:{Yes | <No>}

Specifies whether the computer from which AD DS is being removed is the last domain controller in the domain.

The default is No.

Password:"password"

Specifies the password that corresponds to the user name (account credentials) that is used to install the domain controller. Use this parameter in conjunction with the UserName parameter.

Specify * to prompt the user to supply a password.

RebootOnCompletion:{<Yes> | No}

Specifies whether to restart the computer upon completion, regardless of success.

The default is Yes.

RebootOnSuccess:{<Yes> | No | NoAndNoPromptEither}

Specifies whether to restart the computer upon successful completion.

The default is Yes.

RemoveApplicationPartitions:{Yes | <No>}

Specifies whether to remove application partitions during the removal of AD DS from a domain controller.

The default is No.

RemoveDNSDelegation:{<Yes> | No}

Specifies whether to remove DNS delegations that point to this DNS server from the parent DNS zone.

The default is Yes.

RetainDCMetadata:{Yes | <No>}

Retains domain controller metadata in the domain after AD DS removal to allow a delegated administrator to remove AD DS from an RODC.

The default is No.

UserDomain:"domain_name"

Specifies the domain name for the user name (account credentials) for the operation. This parameter also helps to specify the forest where you plan to install the domain controller or create an RODC account. If no value is specified, the domain of the computer will be used.

UserName:"user_name"

Specifies the user name (account credentials) for the operation. If no value is specified, the credentials of the current user are used for the operation.

Examples

The following example supplies an answer file named NewForestInstallation:

Copy Code
dcpromo /answer:NewForestInstallation

The following example creates the first domain controller in a new child domain where you expect to install at least some Windows Server 2003 domain controllers:

Copy Code
dcpromo /unattend /InstallDns:yes /ParentDomainDNSName:contoso.com /replicaOrNewDomain:domain /newDomain:child /newDomainDnsName:east.contoso.com /childName:east /DomainNetbiosName:east /databasePath:"e:\ntds" /logPath:"e:\ntdslogs" /sysvolpath:"g:\sysvol" /safeModeAdminPassword:FH#3573.cK /forestLevel:2 /domainLevel:2 /rebootOnCompletion:yes

The following example creates an additional domain controller with the global catalog, and it installs and configures the DNS Server service:

Copy Code
dcpromo /unattend /InstallDns:yes /confirmGC:yes /replicaOrNewDomain:replica /databasePath:"e:\ntds" /logPath:"e:\ntdslogs" /sysvolpath:"g:\sysvol" /safeModeAdminPassword:M6$,U8Gvx4 /rebootOnCompletion:yes

Change History

Date | Revision
10/4/2010 | Removed the DNSDelegation, DNSDelegationUserName, DNSDelegationPassword, and TransferIMRoleIfNecessary parameters from the /UseExistingAccount operation.


Defrag

Applies To: Windows Vista,Windows Server 2008

Locates and consolidates fragmented files on local volumes to improve system performance.

Membership in the local Administrators group, or equivalent, is the minimum required to run this command.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
defrag <volumes> | /C | /E <volumes>    [/H] [/M | [/U] [/V]]
defrag <volumes> | /C | /E <volumes> /A [/H] [/M | [/U] [/V]]
defrag <volumes> | /C | /E <volumes> /X [/H] [/M | [/U] [/V]]
defrag <volume> /T [/H] [/U] [/V]

Parameters

Parameter | Description
<volume> | Specifies the drive letter or mount point path of the volume to be defragmented or analyzed.
C | Perform the operation on all volumes.
A | Perform analysis on the specified volumes.
E | Perform the operation on all volumes except those specified.
H | Run the operation at normal priority (default is low).
M | Run the operation on each volume in parallel in the background.
T | Track an operation already in progress on the specified volume.
U | Print the progress of the operation on the screen.
V | Print verbose output containing the fragmentation statistics.
X | Perform free space consolidation on the specified volumes.
? | Displays this help information.

Remarks

  • You cannot defragment specific types of file system volumes or drives:

    • You cannot defragment volumes that the file system has locked.

    • You cannot defragment volumes that the file system has marked as dirty, which indicates possible corruption. You must run chkdsk on a dirty volume before you can defragment it. You can determine if a volume is dirty by using the fsutil dirty query command. For more information about chkdsk and fsutil dirty, see Additional references.

    • You cannot defragment network drives.

    • You cannot defragment CDROMs.

    • You cannot defragment file system volumes that are not NTFS, FAT or FAT32.

  • With Windows Server® 2008 R2, Windows Server 2008, and, Windows Vista®, you can schedule to defragment a volume. However, you cannot schedule to defragment a Solid State Drive (SSD) or a volume on a Virtual Hard Disk (VHD) that resides on an SSD.

  • To perform this procedure, you must be a member of the Administrators group on the local computer, or you must have been delegated the appropriate authority. If the computer is joined to a domain, members of the Domain Admins group might be able to perform this procedure. As a security best practice, consider using Run as to perform this procedure.

  • A volume must have at least 15% free space for defrag to completely and adequately defragment it. Defrag uses this space as a sorting area for file fragments. If a volume has less than 15% free space, defrag will only partially defragment it. To increase the free space on a volume, delete unneeded files or move them to another disk.

  • While defrag is analyzing and defragmenting a volume, it displays a blinking cursor. When defrag is finished analyzing and defragmenting the volume, it displays the analysis report, the defragmentation report, or both reports, and then exits to the command prompt.

  • By default, defrag displays a summary of both the analysis and defragmentation reports if you do not specify the /a or /v parameters.

  • You can send the reports to a text file by typing >FileName.txt, where FileName.txt is a file name you specify. For example: defragVolume/v>FileName.txt

  • To interrupt the defragmentation process, at the command line, press CTRL+C.

  • Running the defrag command and Disk Defragmenter are mutually exclusive. If you are using Disk Defragmenter to defragment a volume and you run the defrag command at a command-line, the defrag command fails. Conversely, if you run the defrag command and open Disk Defragmenter, the defragmentation options in Disk Defragmenter are unavailable.

Examples

To defragment the volume on drive C while providing progress and verbose output, type:

Copy Code
defrag C: /U /V

To defragment the volumes on drives C and D in parallel in the background, type:

Copy Code
defrag C: D: /M

To perform a fragmentation analysis of a volume mounted on drive C and provide progress, type:

Copy Code
defrag C: mountpoint /A /U

To defragment all volumes with normal priority and provide verbose output, type:

Copy Code
Defrag /C /H /V

Additional references

  • Chkdsk

  • Fsutil

  • Fsutil dirty

  • Command-Line Syntax Key


Del

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista

Deletes one or more files. This command is the same as the erase command.

For examples of how to use this command, see Examples.

Syntax

Copy Code
del [/p] [/f] [/s] [/q] [/a[:]<Attributes>] <Names>
erase [/p] [/f] [/s] [/q] [/a[:]<Attributes>] <Names>

Parameters

Parameter | Description
<Names> | Specifies a list of one or more files or directories. Wildcards may be used to delete multiple files. If a directory is specified, all files within the directory will be deleted.
/p | Prompts for confirmation before deleting the specified file.
/f | Forces deletion of read-only files.
/s | Deletes specified files from the current directory and all subdirectories. Displays the names of the files as they are being deleted.
/q | Specifies quiet mode. You are not prompted for delete confirmation.
/a[:]<Attributes> | Deletes files based on the following file attributes: r Read-only files h Hidden files i Not content indexed files s System files a Files ready for archiving l Reparse points - Prefix meaning 'not'
/? | Displays help at the command prompt.

Remarks

Caution
If you use del to delete a file from your disk, you cannot retrieve it.

  • If you use /p, del displays the name of a file and sends the following message:

    FileName, Delete (Y/N)?

    To confirm the deletion, press Y. To cancel the deletion and display the next file name (that is, if you specified a group of files), press N. To stop the del command, press CTRL+C.

  • If you disable command extensions, /s displays the names of any files that were not found instead of displaying the names of files that are being deleted (that is, the behavior is reversed).

  • If you specify a folder in Names, all of the files in the folder are deleted. For example, the following command deletes all of the files in the \Work folder:

    Copy Code
    del \work
  • You can use wildcards (* and ?) to delete more than one file at a time. However, to avoid deleting files unintentionally, you should use wildcards cautiously with the del command. For example, if you type the following command:

    Copy Code
    del *.*
    The del command displays the following prompt:

    Are you sure (Y/N)?

    To delete all of the files in the current directory, press Y and then press ENTER. To cancel the deletion, press N and then press ENTER.

Note
Before you use wildcard characters with the del command, use the same wildcard characters with the dir command to list all the files that will be deleted.

  • The del command, with different parameters, is available from the Recovery Console.

Examples

To delete all the files in a folder named Test on drive C, type either of the following:

Copy Code
del c:\test
del c:\test\*.*

To delete all files with the .bat file name extension from the current directory, type:

Copy Code
del *.bak

To delete all read-only files in the current directory, type:

Copy Code
del /a:r *.*

Additional references

Command-Line Syntax Key


Dfscmd

Applies To: Windows Server 2008

Configures DFS folders and folder targets in a DFS namespace.

Syntax

Copy Code
Dfscmd [options]

Parameters

Parameter Description

/help

Display this message.

/map \\DFSname\DFSshare\path \\server\share\path [comment] [/restore]

Creates a DFS folder and assigns the specified shared folder as the folder target. When used with the /restore parameter, does not verify the existence of the shared folder. DFSDFS

/unmap \\DFSname\DFSshare\path

Delete a DFS folder and removes all of its folder targets.

/add \\DFSname\DFSshare\path \\server\share\path [/restore]

Adds a folder target to a DFS folder. When used with the /restore parameter, does not verify the existence of the shared folder.

/remove \\DFSname\DFSshare\path \\server\share\path

Removes a folder target from a DFS folder.

/view \\DFSname\DFSshare [/partial | /full | /batch || /batchrestore]

View all the DFS folders in the DFS namespace. Without arguments, view just the volume names.

Additional parameters:

  • /partial - view comment also.

  • /full - display a list of all the servers for a volume.

  • /batch - output a batch file to recreate the DFS.

  • /batchrestore - output a batch file to recreate the DFS using the /restore switch.

/move \\DFSname\DFSshare\path1 \\DFSname\DFSshare\path2 [/force]

Move a folder that is in the DFS to a different logical path. With /force, Replace links that exist if necessary

Note
Paths or comments with spaces should be enclosed in quotes.


Dir

Applies To: Windows Server 2008,Windows Vista

Displays a list of a directory's files and subdirectories. If used without parameters, dir displays the disk's volume label and serial number, followed by a list of directories and files on the disk (including their names and the date and time each was last modified). For files, dir displays the name extension and the size in bytes. Dir also displays the total number of files and directories listed, their cumulative size, and the free space (in bytes) remaining on the disk.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dir [<Drive>:][<Path>][<FileName>] [...] [/p] [/q] [/w] [/d] [/a[[:]<Attributes>]][/o[[:]<SortOrder>]] [/t[[:]<TimeField>]] [/s] [/b] [/l] [/n] [/x] [/c] [/4]

Parameters

Parameter Description

[<Drive>:][<Path>]

Specifies the drive and directory for which you want to see a listing.

[<FileName>]

Specifies a particular file or group of files for which you want to see a listing.

/p

Displays one screen of the listing at a time. To see the next screen, press any key on the keyboard.

/q

Displays file ownership information.

/w

Displays the listing in wide format, with as many as five file names or directory names on each line.

/d

Displays the listing in the same format as /w, but the files are sorted by column.

/a[[:]<Attributes>]

Displays only the names of those directories and files with the attributes that you specify. If you omit /a, dir displays the names of all files except hidden and system files. If you use /a without specifying Attributes, dir displays the names of all files, including hidden and system files.

The following list describes each of the values that you can use for Attributes. Using a colon (:) is optional. Use any combination of these values, and do not separate the values with spaces.

d Directories

h Hidden files

s System files

l Reparse points

r Read-only files

a Files ready for archiving

i Not content indexed files

- Prefix meaning "not"

/o[[:]<SortOrder>]

Sorts the output according to SortOrder, which can be any combination of the following values:

n By name (alphabetical)

e By extension (alphabetical)

g Group directories first

s By size (smallest first)

d By date/time (oldest first)

- Prefix to reverse order

Note
Using a colon is optional. Multiple values are processed in the order in which you list them. Do not separate multiple values with spaces.

If SortOrder is not specified, dir /o lists the directories in alphabetic order, followed by the files, which are also sorted in alphabetic order.

/t[[:]<TimeField>]

Specifies which time field to display or use for sorting. The following list describes each of the values you can use for TimeField:

c Creation

a Last access

w Last written

/s

Lists every occurrence of the specified file name within the specified directory and all subdirectories.

/b

Displays a bare list of directories and files, with no additional information. /b overrides /w.

/l

Displays unsorted directory names and file names in lowercase.

/n

Displays a long list format with file names on the far right of the screen.

/x

Displays the short names generated for non-8dot3 file names. The display is the same as the display for /n, but the short name is inserted before the long name.

/c

Displays the thousand separator in file sizes. This is the default behavior. Use /-c to hide separators.

/4

Displays years in four-digit format.

/?

Displays help at the command prompt.

Remarks

  • To use multiple FileName parameters, separate each file name with a space, comma, or semicolon.

  • You can use wildcard characters (* or?), to represent one or more characters of a file name and to display a subset of files or subdirectories.

    Asterisk (*): Use the asterisk as a substitute for any string of characters, for example:

    • dir *.txt lists all files in the current directory with extensions that begin with .txt, such as .txt, .txt1, .txt_old.

    • dir read*.txt lists all files in the current directory that begin with "read" and with extensions that begin with .txt, such as .txt, .txt1, or .txt_old.

    • dir read*.* lists all files in the current directory that begin with "read" with any extension.

    The asterisk wildcard always uses short file name mapping, so you might get unexpected results. For example, the following directory contains two files (t.txt2 and t97.txt):

    Copy Code
    C:\test>dir /x
Volume in drive C has no label.
Volume Serial Number is B86A-EF32

Directory of C:\test

11/30/2004  01:40 PM <DIR>  .
11/30/2004  01:40 PM <DIR> ..
11/30/2004  11:05 AM 0 T97B4~1.TXT t.txt2
11/30/2004  01:16 PM 0 t97.txt
    You might expect that typing dir t97* would return the file t97.txt. However, typing dir t97* returns both files, because the asterisk wildcard matches the file t.txt2 to t97.txt by using its short name map T97B4~1.TXT. Similarly, typing del t97* would delete both files.

    Question mark (?): Use the question mark as a substitute for a single character in a name. For example, typing dir read???.txt lists any files in the current directory with the .txt extension that begin with "read" and are followed by up to three characters. This includes Read.txt, Read1.txt, Read12.txt, Read123.txt, and Readme1.txt, but not Readme12.txt.

  • Specifying file display attributes

    If you use /a with more than one value in Attributes, dir displays the names of only those files with all the specified attributes. For example, if you use /a with r and -h as attributes (by using either /a:r-h or /ar-h), dir will only display the names of the read-only files that are not hidden.

  • Specifying file name sorting

    If you specify more than one SortOrder value, dir sorts the file names by the first criterion, then by the second criterion, and so on. For example, if you use /o with the e and -s values for SortOrder (by using either /o:e-s or /oe-s), dir sorts the names of directories and files by extension, with the largest first, and then displays the final result. The alphabetic sorting by extension causes file names with no extensions to appear first, then directory names, and then file names with extensions.

  • Using redirection symbols and pipes

    When you use the redirection symbol (>) to send dir output to a file or a pipe (|) to send dir output to another command, use /a:-d and /b to list the file names only. You can use FileName with /b and /s to specify that dir is to search the current directory and its subdirectories for all file names that match FileName. Dir lists only the drive letter, directory name, file name, and file name extension (one path per line), for each file name it finds. Before you use a pipe to send dir output to another command, you should set the TEMP environment variable in your Autoexec.nt file.

  • The dir command, with different parameters, is available from the Recovery Console.

Examples

To display all directories one after the other, in alphabetical order, in wide format, and pausing after each screen, make sure that the root directory is the current directory, and then type:

Copy Code
dir /s/w/o/p

Dir lists the root directory, the subdirectories, and the files in the root directory, including extensions. Then, dir lists the subdirectory names and file names in each subdirectory in the tree.

To alter the preceding example so that dir displays the file names and extensions, but omits the directory names, type:

Copy Code
dir /s/w/o/p/a:-d

To print a directory listing, type:

Copy Code
dir > prn

When you specify prn, the directory list is sent to the printer that is attached to the LPT1 port. If your printer is attached to a different port, you must replace prn with the name of the correct port.

You can also redirect output of the dir command to a file by replacing prn with a file name. You can also type a path. For example, to direct dir output to the file dir.doc in the Records directory, type:

Copy Code
dir > \records\dir.doc

If dir.doc does not exist, dir creates it, unless the Records directory does not exist. In that case, the following message appears:

File creation error

To display a list of all the file names with the .txt extension in all directories on drive C, type:

Copy Code
dir c:\*.txt /w/o/s/p

Dir displays, in wide format, an alphabetized list of the matching file names in each directory, and it pauses each time the screen fills until you press any key to continue.

Additional references

Command-Line Syntax Key


Dirquota

Applies To: Windows Server 2008

Adds, lists, modifies and deletes quotas.

Syntax

Copy Code
Dirquota {Quota | Autoquota | Template | Admin | Notification}

Parameters

Quota

List, add, modify, and delete quotas.

Autoquota

List, add, modify, and delete auto apply quotas.

Template

List, add, modify, and delete quota templates.

Admin

Configure settings and perform administrative operations.

Notification

Display help on notification configuration file syntax.


Diskcomp

Applies To: Windows Server 2008,Windows Vista

Compares the contents of two floppy disks. If used without parameters, diskcomp uses the current drive to compare both disks.

For examples of how to use this command, see Examples.

Syntax

Copy Code
diskcomp [<Drive1>: [<Drive2>:]]

Parameters

Parameter | Description
<Drive1> | Specifies the drive containing one of the floppy disks.
<Drive2> | Specifies the drive containing the other floppy disk.
/? | Displays help at the command prompt.

Remarks

  • Using disks

    The diskcomp command works only with floppy disks. You cannot use diskcomp with a hard disk. If you specify a hard disk drive for Drive1 or Drive2, diskcomp displays the following error message:

    Copy Code
    Invalid drive specification
Specified drive does not exist
or is nonremovable
  • Comparing disks

    If all tracks on the two disks being compared are the same, diskcomp displays the following message:

    Copy Code
    Compare OK
    If the tracks are not the same, diskcomp displays a message similar to the following:

    Copy Code
    Compare error on
side 1, track 2
    When diskcomp completes the comparison, it displays the following message:

    Copy Code
    Compare another diskette (Y/N)?
    If you press Y, diskcomp prompts you to insert the disk for the next comparison. If you press N, diskcomp stops the comparison.

    When diskcomp makes the comparison, it ignores a disk's volume number.

  • Omitting drive parameters

    If you omit the Drive2 parameter, diskcomp uses the current drive for Drive2. If you omit both drive parameters, diskcomp uses the current drive for both. If the current drive is the same as Drive1, diskcomp prompts you to swap disks as necessary.

  • Using one drive

    If you specify the same floppy disk drive for Drive1 and Drive2, diskcomp compares them by using one drive and prompts you to insert the disks as necessary. You might have to swap the disks more than once, depending on the capacity of the disks and the amount of available memory.

  • Comparing different types of disks

    Diskcomp cannot compare a single-sided disk with a double-sided disk, nor a high-density disk with a double-density disk. If the disk in Drive1 is not of the same type as the disk in Drive2, diskcomp displays the following message:

    Copy Code
    Drive types or diskette types not compatible
  • Using diskcomp with networks and redirected drives

    Diskcomp does not work on a network drive or on a drive created by the subst command. If you attempt to use diskcomp with a drive of any of these types, diskcomp displays the following error message:

    Copy Code
    Invalid drive specification
  • Comparing an original disk with a copy

    When you use diskcomp with a disk that you made by using copy, diskcomp might display a message similar to the following:

    Copy Code
    Compare error on
side 0, track 0
    This type of error can occur even if the files on the disks are identical. Although copy duplicates information, it does not necessarily place it in the same location on the destination disk.

  • Understanding diskcomp exit codes

    The following table explains each exit code.

    Exit code Description

    0

    Disks are the same

    1

    Differences were found

    3

    Hard error occurred

    4

    Initialization error occurred

    To process exit codes that are returned by diskcomp, you can use the ERRORLEVEL environment variable on the if command line in a batch program.

Examples

If your computer has only one floppy disk drive (for example, drive A), and you want to compare two disks, type:

Copy Code
diskcomp a: a:

Diskcomp prompts you to insert each disk, as needed.

The following example illustrates how to process a diskcomp exit code in a batch program that uses the ERRORLEVEL environment variable on the if command line:

Copy Code
rem Checkout.bat compares the disks in drive A and B
echo off
diskcomp a: b:
if errorlevel 4 goto ini_error
if errorlevel 3 goto hard_error
if errorlevel 1 goto no_compare
if errorlevel 0 goto compare_ok
:ini_error
echo ERROR: Insufficient memory or command invalid
goto exit
:hard_error
echo ERROR: An irrecoverable error occurred
goto exit
:break
echo "You just pressed CTRL+C" to stop the comparison
goto exit
:no_compare
echo Disks are not the same
goto exit
:compare_ok
echo The comparison was successful; the disks are the same
goto exit
:exit

Additional references

Command-Line Syntax Key


Diskcopy

Applies To: Windows Vista,Windows Server 2008

Copies the contents of the floppy disk in the source drive to a formatted or unformatted floppy disk in the destination drive. If used without parameters, diskcopy uses the current drive for the source disk and the destination disk.

For examples of how to use this command, see Examples.

Syntax

Copy Code
diskcopy [<Drive1>: [<Drive2>:]] [/v]

Parameters

Parameter | Description
<Drive1> | Specifies the drive that contains the source disk.
<Drive2> | Specifies the drive that contains the destination disk.
/v | Verifies that the information is copied correctly. This option slows down the copying process.
/? | Displays help at the command prompt.

Remarks

  • Using disks

    Diskcopy works only with removable disks such as floppy disks, which must be the same type. You cannot use diskcopy with a hard disk. If you specify a hard disk drive for Drive1 or Drive2, diskcopy displays the following error message:

    Copy Code
    Invalid drive specification
Specified drive does not exist or is nonremovable
    The diskcopy command prompts you to insert the source and destination disks and waits for you to press any key on the keyboard before continuing.

    After it copies the disk, diskcopy displays the following message:

    Copy Code
    Copy another diskette (Y/N)?
    If you press Y, diskcopy prompts you to insert source and destination disks for the next copy operation. To stop the diskcopy process, press N.

    If you are copying to an unformatted floppy disk in Drive2, diskcopy formats the disk with the same number of sides and sectors per track as are on the disk in Drive1. Diskcopy displays the following message while it formats the disk and copies the files:

    Copy Code
    Formatting while copying
  • Disk serial numbers

    If the source disk has a volume serial number, diskcopy creates a new volume serial number for the destination disk and displays the number when the copy operation is complete.

  • Omitting drive parameters

    If you omit the Drive2 parameter, diskcopy uses the current drive as the destination drive. If you omit both drive parameters, diskcopy uses the current drive for both. If the current drive is the same as Drive1, diskcopy prompts you to swap disks as necessary.

  • Using one drive for copying

    Run diskcopy from a drive other than the floppy disk drive, for example the C drive. If floppy disk Drive1 and floppy disk Drive2 are the same, diskcopy prompts you to switch disks. If the disks contain more information than the available memory can hold, diskcopy cannot read all of the information at once. Diskcopy reads from the source disk, writes to the destination disk, and prompts you to insert the source disk again. This process continues until you have copied the entire disk.

  • Avoiding disk fragmentation

    Fragmentation is the presence of small areas of unused disk space between existing files on a disk. A fragmented source disk can slow down the process of finding, reading, or writing files.

    Because diskcopy makes an exact copy of the source disk on the destination disk, any fragmentation on the source disk is transferred to the destination disk. To avoid transferring fragmentation from one disk to another, use copy or xcopy to copy your disk. Because copy and xcopy copy files sequentially, the new disk is not fragmented.

Note
You cannot use xcopy to copy a startup disk.

  • Understanding diskcopy exit codes

    The following table explains each exit code.

    Exit code Description

    0

    Copy operation was successful

    1

    Nonfatal Read/Write error occurred

    3

    Fatal hard error occurred

    4

    Initialization error occurred

    To process the exit codes that are returned by diskcomp, you can use the ERRORLEVEL environment variable on the if command line in a batch program.

Examples

To copy the disk in drive B to the disk in drive A, type:

Copy Code
diskcopy b: a:

To use floppy disk drive A to copy one floppy disk to another, first switch to the C drive and then type:

diskcopy a: a:

Additional references

Command-Line Syntax Key


Diskedit

Applies To: Windows Server 2000

This command is not available on Windows Server 2008.


DiskPart

Applies To: Windows Vista,Windows 7,Windows Server 2008,Windows Server 2008 R2

DiskPart is a text-mode command interpreter that enables you to manage objects (disks, partitions, volumes, or virtual hard disks) by using scripts or direct input from a command prompt. Before you can use DiskPart commands, you must first list, and then select an object to give it focus. When an object has focus, any DiskPart commands that you type will act on that object.

You can list the available objects and determine an object's number or drive letter by using the list disk, list volume, list partition, and list vdisk commands. The list disk, list vdisk and list volume commands display all disks and volumes on the computer. However, the list partition command only displays partitions on the disk that has focus. When you use the list commands, an asterisk (*) appears next to the object with focus.

When you select an object, the focus remains on that object until you select a different object. For example, if the focus is set on disk 0 and you select volume 8 on disk 2, the focus shifts from disk 0 to disk 2, volume 8. Some commands automatically change the focus. For example, when you create a new partition, the focus automatically switches to the new partition.

You can only give focus to a partition on the selected disk. When a partition has focus, the related volume (if any) also has focus. When a volume has focus, the related disk and partition also have focus if the volume maps to a single specific partition. If this is not the case, focus on the disk and partition is lost.

DiskPart commands

To start the DiskPart command interpreter, at the command prompt type:

diskpart

Important
Membership in the local Administrators group, or equivalent, is the minimum required to run DiskPart.

You can run the following commands in the Diskpart command interpreter:

  • Active

  • Add

  • Assign

  • Attach vdisk

  • Attributes

  • Automount

  • Break

  • Clean

  • Compact vdisk

  • Convert

  • Create

  • Delete

  • Detach vdisk

  • Detail

  • Exit

  • Expand vdisk

  • Extend

  • Filesystems

  • Format

  • GPT

  • Help

  • Import

  • Inactive

  • List

  • Merge vdisk

  • Offline

  • Online

  • Recover

  • Rem

  • Remove

  • Repair

  • Rescan

  • Retain

  • Examples

  • Select

  • Set id

  • Shrink

  • Uniqueid

Additional references

Command-Line Syntax Key


Active

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows 7,Windows Vista

On basic disks, marks the partition with focus as active.

Caution
DiskPart verifies only that the partition is capable of containing the operating system startup files. DiskPart does not check the contents of the partition. If you mistakenly mark a partition as active and it does not contain the operating system startup files, your computer might not start.

Syntax

Copy Code
active

Remarks

  • This informs the basic input/output system (BIOS) or Extensible Firmware Interface (EFI) that the partition or volume is a valid system partition or system volume.

  • Only partitions can be marked as active.

  • A partition must be selected for this operation to succeed. Use the select partition command to select a partition and shift the focus to it.

Examples

To mark the partition with focus as the active partition, type:

Copy Code
active

Additional references

Command-Line Syntax Key

DiskPart


Add

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows 7

Mirrors the simple volume with focus to the specified disk.

Important
This DiskPart command is not available in any edition of Windows Vista.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
add disk=<n> [align=<n>] [wait] [noerr]

Parameters

Parameter | Description
disk=<n> | Specifies a disk, other than the one containing the existing simple volume, to contain the mirror. You can mirror only simple volumes. The specified disk must have unallocated space at least as large as the size of the simple volume you want to mirror.
align=<n> | Typically used with hardware RAID Logical Unit Number (LUN) arrays to improve performance. Aligns all volume or partition extents to the closest alignment boundary. n is the number of kilobytes (KB) from the beginning of the disk to the closest alignment boundary.
wait | Waits for the volume to finish synchronizing with the added disk before returning. Without this parameter, DiskPart returns after the mirrored volume is created and does not wait for the synchronization to complete.
noerr | For scripting only. When an error is encountered, DiskPart continues to process commands as if the error did not occur. Without this parameter, an error causes DiskPart to exit with an error code.

Remarks

  • A volume must be selected for this operation to succeed. Use the select volume command to select a volume and shift the focus to it.

Examples

To create a mirror of the volume with focus on disk 2, type:

Copy Code
add disk=2

Additional references

Command-Line Syntax Key

DiskPart


Assign

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Assigns a drive letter or mount point to the volume with focus.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
assign [{letter=<d> | mount=<path>}] [noerr]

Parameters

Parameter | Description
letter=<d> | The drive letter you want to assign to the volume.
mount=<path> | The mount point path you want to assign to the volume. For instructions regarding how to use this command, see Assign a mount point folder path to a drive (http://go.microsoft.com/fwlink/?LinkId=207059).
noerr | For scripting only. When an error is encountered, DiskPart continues to process commands as if the error did not occur. Without this parameter, an error causes DiskPart to exit with an error code.

Remarks

  • If no drive letter or mount point is specified, the next available drive letter is assigned. If the drive letter or mount point is already in use, an error is generated.

  • By using the assign command, you can change the drive letter associated with a removable drive.

  • You cannot assign drive letters to system volumes, boot volumes, or volumes that contain the paging file. In addition, you cannot assign a drive letter to an Original Equipment Manufacturer (OEM) partition or any GUID Partition Table (GPT) partition other than a basic data partition.

  • A volume must be selected for this operation to succeed. Use the select volume command to select a volume and shift the focus to it.

Examples

To assign the letter E to the volume in focus, type:

Copy Code
assign letter=e

Additional references

Command-Line Syntax Key

DiskPart


Attributes

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Displays, sets, or clears the attributes of a disk or volume.

Syntax

Copy Code
Attributes disk
Attributes volume

Parameters

Parameter | Description
Attributes disk | Displays, sets, or clears the attributes of a disk.
Attributes volume | Displays, sets, or clears the attributes of a volume.

Additional references

Command-Line Syntax Key

DiskPart


Automount

Applies To: Windows 7,Windows Vista,Windows Server 2008,Windows Server 2008 R2

Enables or disables the automount feature. When enabled (the default), Windows automatically mounts the file system for a new basic or dynamic volume when it is added to the system, and then assigns a drive letter to the volume.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
automount [ { enable | disable } ] [scrub] [noerr]

Parameters

Parameter | Description
enable | Enables Windows to automatically mount new basic and dynamic volumes that are added to the system and to assign them drive letters.
disable | Prevents Windows from automatically mounting any new basic and dynamic volumes that are added to the system.
scrub | Removes volume mount point directories and registry settings for volumes that are no longer in the system. This prevents volumes that were previously in the system from being automatically mounted and given their former volume mount point(s) when they are added back to the system.
noerr | For scripting only. When an error is encountered, DiskPart continues to process commands as if the error did not occur. Without this parameter, an error causes DiskPart to exit with an error code.

Remarks

  • In storage area network (SAN) configurations, disabling automount prevents Windows from automatically mounting or assigning drive letters to any new basic volumes that are visible to the system.

Examples

To see if the automount feature is enabled, type:

Copy Code
automount

To enable the automount feature, type:

Copy Code
automount enable

To disable the automount feature, type:

Copy Code
automount disable

Additional references

Command-Line Syntax Key

DiskPart


Break

Applies To: Windows Vista,Windows 7,Windows Server 2008 R2,Windows Server 2008

Breaks the mirrored volume with focus into two simple volumes.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
break disk=<n> [nokeep] [noerr]

Parameters

Parameter | Description
disk=<n> | Specifies the disk that contains the mirrored volume. This disk is given focus and does not retain the drive letter or any mount points. If the specified disk is the current system or startup disk, the command fails.
nokeep | Specifies that only one of the mirrored volumes is retained; the simple volume on disk N is deleted and converted to free space. Neither the volume nor the free space receives the focus.
noerr | For scripting only. When an error is encountered, DiskPart continues to process commands as if the error did not occur. Without this parameter, an error causes DiskPart to exit with an error code.

Remarks

  • Applies to dynamic disks only. Breaks the mirrored volume with focus into two simple volumes. One simple volume retains the drive letter and any mount points of the mirrored volume. The other simple volume receives the focus so you can assign it a drive letter.

  • By default, the contents of both halves of the mirror are retained. Each half becomes a simple volume. By using the nokeep parameter, you retain only one half of the mirror as a simple volume, and the other half is deleted and converted to free space. Neither volume receives the focus.

  • A mirrored volume must be selected for this operation to succeed. Use the select volume command to select a mirrored volume and shift the focus to it.

Examples

To break the mirrored disk 2 into two simple volumes, type:

Copy Code
break disk=2

Additional references

Command-Line Syntax Key

DiskPart


Clean

Applies To: Windows 7,Windows Vista,Windows Server 2008 R2,Windows Server 2008

Removes any and all partition or volume formatting from the disk with focus.

Syntax

Copy Code
clean [all]

Parameters

Parameter | Description
all | Specifies that each and every sector on the disk is set to zero, which completely deletes all data contained on the disk.

Remarks

  • On master boot record (MBR) disks, only the MBR partitioning information and hidden sector information are overwritten.

  • On GUID Partition Table (GPT) disks, the GPT partitioning information, including the Protective MBR, is overwritten. There is no hidden sector information.

  • A disk must be selected for this operation to succeed. Use the select disk command to select a disk and shift the focus to it.

Examples

To remove all formatting from the selected disk, type:

Copy Code
clean

Additional references

Command-Line Syntax Key

DiskPart


Convert

Applies To: Windows 7,Windows Vista,Windows Server 2008,Windows Server 2008 R2

Converts a disk from one disk type to another.

Syntax

Copy Code
convert basic
convert dynamic
convert gpt
convert mbr

Parameters

Parameter | Description
Convert basic | Converts an empty dynamic disk into a basic disk.
Convert dynamic | Converts a basic disk into a dynamic disk.
Convert gpt | Converts an empty basic disk with the master boot record (MBR) partition style into a basic disk with the GUID partition table (GPT) partition style.
Convert mbr | Converts an empty basic disk with the GUID Partition Table (GPT) partition style into a basic disk with the master boot record (MBR) partition style.

Additional references

Command-Line Syntax Key

DiskPart


Convert basic

Applies To: Windows Vista,Windows 7,Windows Server 2008,Windows Server 2008 R2

Converts an empty dynamic disk to a basic disk.

For instructions regarding how to use this command, see Change a Dynamic Disk Back to a Basic Disk (http://go.microsoft.com/fwlink/?LinkId=207048).

Syntax

Copy Code
convert basic [noerr]

Parameters

Parameter | Description
noerr | For scripting only. When an error is encountered, DiskPart continues to process commands as if the error did not occur. Without this parameter, an error causes DiskPart to exit with an error code.

Remarks

Important
The disk must be empty to convert it to a basic disk. Back up your data, and then delete all partitions or volumes before converting the disk.

  • A dynamic disk must be selected for this operation to succeed. Use the select disk command to select a dynamic disk and shift the focus to it.

Examples

To convert the selected dynamic disk to basic, type:

Copy Code
convert basic

Additional references

Command-Line Syntax Key

DiskPart


Convert dynamic

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows 7,Windows Vista

Converts a basic disk into a dynamic disk.

For instructions regarding how to use this command, see Change a Basic Disk into a Dynamic Disk (http://go.microsoft.com/fwlink/?LinkId=207047).

Syntax

Copy Code
convert dynamic [noerr]

Parameters

Parameter | Description
noerr | For scripting only. When an error is encountered, DiskPart continues to process commands as if the error did not occur. Without this parameter, an error causes DiskPart to exit with an error code.

Remarks

  • Any existing partitions on the basic disk become simple volumes.

  • A basic disk must be selected for this operation to succeed. Use the select disk command to select a basic disk and shift the focus to it.

Examples

To convert a basic disk into a dynamic disk, type:

Copy Code
convert dynamic

Additional references

Command-Line Syntax Key

DiskPart


Convert gpt

Applies To: Windows Vista,Windows 7,Windows Server 2008,Windows Server 2008 R2

Converts an empty basic disk with the master boot record (MBR) partition style into a basic disk with the GUID partition table (GPT) partition style.

For instructions regarding how to use this command, see Change a Master Boot Record Disk into a GUID Partition Table Disk (http://go.microsoft.com/fwlink/?LinkId=207049).

Syntax

Copy Code
convert gpt [noerr]

Parameters

Parameter | Description
noerr | For scripting only. When an error is encountered, DiskPart continues to process commands as if the error did not occur. Without this parameter, an error causes DiskPart to exit with an error code.

Remarks

Important
The disk must be empty to convert it into a GPT disk. Back up your data, and then delete all partitions or volumes before converting the disk.

  • The required minimum disk size for conversion to GPT is 128 megabytes.

  • A basic MBR disk must be selected for this operation to succeed. Use the select disk command to select a basic disk and shift the focus to it.

Examples

To convert a basic disc from MBR partition style to GPT partition style, type:

Copy Code
convert gpt

Additional references

Command-Line Syntax Key

DiskPart


Convert mbr

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows 7,Windows Vista

Converts an empty basic disk with the GUID Partition Table (GPT) partition style into a basic disk with the master boot record (MBR) partition style.

Important
The disk must be empty to convert it into an MBR disk. Back up your data, and then delete all partitions or volumes before converting the disk.

For instructions regarding how to use this command, see Change a GUID Partition Table Disk into a Master Boot Record Disk (http://go.microsoft.com/fwlink/?LinkId=207050).

Syntax

Copy Code
convert mbr [noerr]

Parameters

Parameter | Description
noerr | For scripting only. When an error is encountered, DiskPart continues to process commands as if the error did not occur. Without this parameter, an error causes DiskPart to exit with an error code.

Remarks

  • A basic disk must be selected for this operation to succeed. Use the select disk command to select a basic disk and shift the focus to it.

Examples

To convert a basic disc from GPT partition style to MBR partition style, type>:

Copy Code
convert mbr

Additional references

Command-Line Syntax Key

DiskPart


Create

Applies To: Windows Vista,Windows 7,Windows Server 2008 R2,Windows Server 2008

Creates a partition on a disk, a volume on one or more disks, or a virtual hard disk (VHD).

Syntax

Copy Code
create partition
create volume
create vdisk

Parameters

Parameter | Description
Create partition | Creates a partition on a disk.
Create volume | Creates a volume on one or more disks, depending on the type of volume you specify.
Create vdisk | Creates a new VHD file using the available disk space on the computer, and then saves it to the location that you specify.

Additional references

Command-Line Syntax Key

DiskPart


Create partition

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows 7,Windows Vista

Creates a partition on a disk.

Syntax

Copy Code
create partition efi
create partition extended
create partition logical
create partition msr
create partition primary

Parameters

Parameter | Description
Create partition efi | On Itanium-based computers, creates an Extensible Firmware Interface (EFI) system partition on a GUID Partition Table (GPT) disk.
Create partition extended | Creates an extended partition on the disk with focus.
Create partition logical | Creates a logical partition in an extended partition.
Create partition msr | Creates a Microsoft Reserved (MSR) partition on a GUID Partition Table (GPT) disk.
Create partition primary | Creates a primary partition on the basic disk with focus.

Additional references

Command-Line Syntax Key

DiskPart


Create partition efi

Applies To: Windows Vista,Windows 7,Windows Server 2008 R2,Windows Server 2008

On Itanium-based computers, creates an Extensible Firmware Interface (EFI) system partition on a GUID Partition Table (GPT) disk.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
create partition efi [size=<n>] [offset=<n>] [noerr]

Parameters

Parameter | Description
size=<n> | The size of the partition in megabytes (MB). If no size is given, the partition continues until there is no more free space in the current region.
offset=<n> | The offset in kilobytes (KB), at which the partition is created. If no offset is given, the partition is placed in the first disk extent that is large enough to hold it.
noerr | For scripting only. When an error is encountered, DiskPart continues to process commands as if the error did not occur. Without this parameter, an error causes DiskPart to exit with an error code.

Remarks

  • After the partition has been created, the focus is given to the new partition.

  • A GPT disk must be selected for this operation to succeed. Use the select disk command to select a disk and shift the focus to it.

Examples

To create an EFI partition of 1000 megabytes on the selected disk, type:

Copy Code
create partition efi size=1000

Additional references

Command-Line Syntax Key

DiskPart


Create partition extended

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows 7,Windows Vista

Creates an extended partition on the disk with focus. You can use this command only on Master Boot Record (MBR) disks.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
create partition extended [size=<n>] [offset=<n>] [align=<n>] [noerr]

Parameters

Parameter | Description
size=<n> | Specifies the size of the partition in megabytes (MB). If no size is given, the partition continues until there is no more free space in the extended partition.
offset=<n> | Specifies the offset in kilobytes (KB), at which the partition is created. If no offset is given, the partition will start at the beginning of the free space on the disk that is large enough to hold the new partition.
align=<n> | Aligns all partition extents to the closest alignment boundary. Typically used with hardware RAID Logical Unit Number (LUN) arrays to improve performance. <n> is the number of kilobytes (KB) from the beginning of the disk to the closest alignment boundary.
noerr | For scripting only. When an error is encountered, DiskPart continues to process commands as if the error did not occur. Without this parameter, an error causes DiskPart to exit with an error code.

Remarks

  • After the partition has been created, the focus automatically shifts to the new partition.

  • Only one extended partition can be created per disk.

  • This command fails if you attempt to create an extended partition within another extended partition.

  • You must create an extended partition before you can create logical drives.

  • A basic MBR disk must be selected for this operation to succeed. Use the select disk command to select a disk and shift the focus to it.

Examples

To create an extended partition of 1000 megabytes in size, type:

Copy Code
create partition extended size=1000

Additional references

Command-Line Syntax Key

DiskPart


Create partition logical

Applies To: Windows Vista,Windows 7,Windows Server 2008 R2,Windows Server 2008

Creates a logical partition in an existing extended partition. You can only use this command on master boot record (MBR) disks.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
create partition logical [size=<n>] [offset=<n>] [align=<n>] [noerr]

Parameters

Parameter | Description
size=<n> | Specifies the size of the logical partition in megabytes (MB), which must be smaller than the extended partition. If no size is given, the partition continues until there is no more free space in the extended partition.
offset=<n> | Specifies the offset in kilobytes (KB), at which the partition is created. The offset rounds up to completely fill whatever cylinder size is used. If no offset is given, then the partition is placed in the first disk extent that is large enough to hold it. The partition is at least as long in bytes as the number specified by size=<n>. If you specify a size for the logical partition, it must be smaller than the extended partition.
align=<n> | Aligns all volume or partition extents to the closest alignment boundary. Typically used with hardware RAID Logical Unit Number (LUN) arrays to improve performance. <n> is the number of kilobytes (KB) from the beginning of the disk to the closest alignment boundary.
noerr | For scripting only. When an error is encountered, DiskPart continues to process commands as if the error did not occur. Without this parameter, an error causes DiskPart to exit with an error code.

Remarks

  • If the size and offset parameters are not specified, the logical partition is created in the largest disk extent available in the extended partition.

  • After the partition has been created, the focus automatically shifts to the new logical partition.

  • A basic MBR disk must be selected for this operation to succeed. Use the select disk command to select a disk and shift the focus to it.

Examples

To create a logical partition of 1000 megabytes in size, in the extended partition of the selected disk, type:

Copy Code
create partition logical size=1000

Additional references

Command-Line Syntax Key

DiskPart


Create partition msr

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows 7,Windows Vista

Creates a Microsoft Reserved (MSR) partition on a GUID partition table (GPT) disk.

Caution
Be very careful when using this command. Because GPT disks require a specific partition layout, creating Microsoft Reserved partitions could cause the disk to become unreadable.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
create partition msr [size=<n>] [offset=<n>] [noerr]

Parameters

Parameter | Description
size=<n> | The size of the partition in megabytes (MB). The partition is at least as long in bytes as the number specified by <n>. If no size is given, the partition continues until there is no more free space in the current region.
offset=<n> | Specifies the offset in kilobytes (KB), at which the partition is created. The offset rounds up to completely fill whatever sector size is used. If no offset is given, the partition is placed in the first disk extent that is large enough to hold it.
noerr | For scripting only. When an error is encountered, DiskPart continues to process commands as if the error did not occur. Without this parameter, an error causes DiskPart to exit with an error code.

Remarks

  • On GPT disks that are used to boot the Windows operating system, the Extensible Firmware Interface (EFI) system partition is the first partition on the disk, followed by the Microsoft Reserved partition. GPT disks that are used only for data storage do not have an EFI system partition, in which case the Microsoft Reserved partition is the first partition.

  • Windows does not mount Microsoft Reserved partitions. You cannot store data on them and you cannot delete them.

  • A Microsoft Reserved partition is required on every GPT disk. The size of this partition depends on the total size of the GPT disk. The size of the GPT disk must be at least 32 MB to create a Microsoft Reserved partition.

  • A basic GPT disk must be selected for this operation to succeed. Use the select disk command to select a basic GPT disk and shift the focus to it.

Examples

To create a Microsoft Reserved partition of 1000 megabytes in size, type:

Copy Code
create partition msr size=1000

Additional references

Command-Line Syntax Key

DiskPart


Create partition primary

Applies To: Windows Vista,Windows 7,Windows Server 2008 R2,Windows Server 2008

Creates a primary partition on the basic disk with focus.

Caution

For examples of how this command can be used, see Examples.

Syntax

Copy Code
create partition primary [size=<n>] [offset=<n>] [id={ <byte> | <guid> }] [align=<n>] [noerr]

Parameters

Parameter Description

size=<n>

Specifies the size of the partition in megabytes (MB). If no size is given, the partition continues until there is no more unallocated space in the current region.

offset=<n>

The offset in kilobytes (KB), at which the partition is created. If no offset is given, the partition will start at the beginning of the largest disk extent that is large enough to hold it.

align=<n>

Aligns all partition extents to the closest alignment boundary. Typically used with hardware RAID Logical Unit Number (LUN) arrays to improve performance. <n> is the number of kilobytes (KB) from the beginning of the disk to the closest alignment boundary.

id={ <byte> | <guid> }

Specifies the partition type. This parameter is intended for original equipment manufacturer (OEM) use only. Any partition type byte or GUID can be specified with this parameter. DiskPart does not check the partition type for validity except to ensure that it is a byte in hexadecimal form or a GUID.

Caution
Creating partitions with this parameter might cause your computer to fail or be unable to start up. Unless you are an OEM or an IT professional experienced with GPT disks, do not create partitions on GPT disks using this parameter. Instead, always use the create partition efi command to create EFI System partitions, the create partition msr command to create Microsoft Reserved partitions, and the create partition primary command (without the id={byte|guid} parameter) to create primary partitions on GPT disks.

Master boot record disks

For master boot record (MBR) disks, you specify a partition type byte, in hexadecimal form, for the partition. If this parameter is not specified for an MBR disk, the command creates a partition of type 0x06, which specifies that a file system is not installed. Examples include:

  • LDM data partition: 0x42

  • Recovery partition: 0x27

  • Recognized OEM partition: 0x12, 0x84, 0xDE, 0xFE, 0xA0

GUID partition table disks

For GUID partition table (GPT) disks, you can specify a partition type GUID for the partition that you want to create. Recognized GUIDs include:

  • EFI system partition: c12a7328-f81f-11d2-ba4b-00a0c93ec93b

  • Microsoft Reserved partition: e3c9e316-0b5c-4db8-817d-f92df00215ae

  • Basic data partition: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7

  • LDM metadata partition on a dynamic disk: 5808c8aa-7e8f-42e0-85d2-e1e90434cfb3

  • LDM data partition on a dynamic disk: af9b60a0-1431-4f62-bc68-3311714a69ad

  • Recovery partition: de94bba4-06d1-4d40-a16a-bfd50179d6ac

If this parameter is not specified for a GPT disk, the command creates a basic data partition.

noerr

For scripting only. When an error is encountered, DiskPart continues to process commands as if the error did not occur. Without the noerr parameter, an error causes DiskPart to exit with an error code.

Remarks

  • After you create the partition, the focus automatically shifts to the new partition.

  • The partition does not receive a drive letter. You must use the assign command in DiskPart to assign a drive letter to the partition.

  • A basic disk must be selected for this operation to succeed. Use the select disk command to select a basic disk and shift the focus to it.

Examples

To create a primary partition of 1000 megabytes in size, type:

Copy Code
create partition primary size=1000

Additional references

Command-Line Syntax Key

DiskPart


Create volume

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows 7,Windows Vista

Creates a volume on one or more dynamic disks, depending on the type of volume that you specify.

Syntax

Copy Code
create volume raid
create volume simple
create volume stripe
create volume mirror

Parameters

Parameter | Description
Create volume raid | Creates a RAID-5 volume using three or more specified dynamic disks.
Create volume simple | Creates a simple volume on a single dynamic disk.
Create volume stripe | Creates a striped volume using two or more specified dynamic disks.
Create volume mirror | Creates a mirror volume using two specified dynamic disks.

Additional references

Command-Line Syntax Key

DiskPart


Create volume raid

Applies To: Windows 7,Windows Server 2008 R2,Windows Server 2008

Creates a RAID-5 volume using three or more specified dynamic disks.

Important
This DiskPart command is not available in any edition of Windows Vista.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
create volume raid [size=<n>] disk=<n>,<n>,<n>[,<n>,...] [align=<n>] [noerr]

Parameters

Parameter | Description
size=<n> | The amount of disk space, in megabytes (MB), that the volume will occupy on each disk. If no size is given, the largest possible RAID-5 volume will be created. The disk with the smallest available contiguous free space determines the size for the RAID-5 volume and the same amount of space is allocated from each disk. The actual amount of usable disk space in the RAID-5 volume is less than the combined amount of disk space because some of the disk space is required for parity.
disk=<n>,<n>,<n>[,<n>,...] | The dynamic disks on which to create the RAID-5 volume. You need at least three dynamic disks in order to create a RAID-5 volume. An amount of space equal to size=<n> is allocated on each disk.
align=<n> | Aligns all volume extents to the closest alignment boundary. Typically used with hardware RAID Logical Unit Number (LUN) arrays to improve performance. n is the number of kilobytes (KB) from the beginning of the disk to the closest alignment boundary.
noerr | For scripting only. When an error is encountered, DiskPart continues to process commands as if the error did not occur. Without this parameter, an error causes DiskPart to exit with an error code.

Remarks

  • After you create the volume, the focus automatically shifts to the new volume.

Examples

To create a RAID-5 volume of 1000 megabytes in size, using disks 1, 2 and 3, type:

Copy Code
create volume raid size=1000 disk=1,2,3

Additional references

Command-Line Syntax Key

DiskPart


Create volume simple

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows 7,Windows Vista

Creates a simple volume on the specified dynamic disk.

Important
For Windows Vista, this DiskPart command is only available in the Windows Vista Ultimate, Windows Vista Enterprise and Windows Vista Business editions.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
create volume simple [size=<n>] [disk=<n>] [align=<n>] [noerr]

Parameters

Parameter | Description
size=<n> | The size of the volume in megabytes (MB). If no size is given, the new volume takes up the remaining free space on the disk.
disk=<n> | The dynamic disk on which the volume is created. If no disk is specified, the current disk is used.
align=<n> | Aligns all volume extents to the closest alignment boundary. Typically used with hardware RAID Logical Unit Number (LUN) arrays to improve performance. n is the number of kilobytes (KB) from the beginning of the disk to the closest alignment boundary.
noerr | For scripting only. When an error is encountered, DiskPart continues to process commands as if the error did not occur. Without this parameter, an error causes DiskPart to exit with an error code.

Remarks

  • After you create the volume, the focus automatically shifts to the new volume.

Examples

To create a volume of 1000 megabytes in size, on disk 1, type:

Copy Code
create volume simple size=1000 disk=1

Additional references

Command-Line Syntax Key

DiskPart


Create volume stripe

Applies To: Windows Vista,Windows 7,Windows Server 2008 R2,Windows Server 2008

Creates a striped volume using two or more specified dynamic disks.

Important
For Windows Vista, this DiskPart command is only available in the Windows Vista Ultimate, Windows Vista Enterprise and Windows Vista Business editions.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
create volume stripe [size=<n>] disk=<n>,<n>[,<n>,...] [align=<n>] [noerr]

Parameters

Parameter | Description
size=<n> | The amount of disk space, in megabytes (MB), that the volume will occupy on each disk. If no size is given, the new volume takes up the remaining free space on the smallest disk and an equal amount of space on each subsequent disk.
disk=<n>,<n>[,<n>,...] | The dynamic disks on which the striped volume is created. You need at least two dynamic disks to create a striped volume. An amount of space equal to size=<n> is allocated on each disk.
align=<n> | Aligns all volume extents to the closest alignment boundary. Typically used with hardware RAID Logical Unit Number (LUN) arrays to improve performance. n is the number of kilobytes (KB) from the beginning of the disk to the closest alignment boundary.
noerr | For scripting only. When an error is encountered, DiskPart continues to process commands as if the error did not occur. Without this parameter, an error causes DiskPart to exit with an error code.

Remarks

  • After you create the volume, the focus automatically shifts to the new volume.

Examples

To create a striped volume of 1000 megabytes in size, on disks 1 and 2, type:

Copy Code
create volume stripe size=1000 disk=1,2

Additional references

Command-Line Syntax Key

DiskPart


Delete

Applies To: Windows Vista,Windows 7,Windows Server 2008,Windows Server 2008 R2

Deletes a partition or a volume. It also deletes a dynamic disk from the list of disks.

Syntax

Copy Code
delete disk
delete partition
delete volume

Parameters

Parameter | Description
Delete disk | Deletes a missing dynamic disk from the list of disks.
Delete partition | Deletes a partition.
Delete volume | Deletes a volume.

Additional references

Command-Line Syntax Key

DiskPart


Delete disk

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows 7,Windows Vista

Deletes a missing dynamic disk from the list of disks.

For instructions regarding how to use this command, see Remove a Missing Dynamic Disk (http://go.microsoft.com/fwlink/?LinkId=207055).

Syntax

Copy Code
delete disk [noerr] [override]

Parameters

Parameter | Description
noerr | For scripting only. When an error is encountered, DiskPart continues to process commands as if the error did not occur. Without this parameter, an error causes DiskPart to exit with an error code.
override | Enables DiskPart to delete all simple volumes on the disk. If the disk contains half of a mirrored volume, the half of the mirror on the disk is deleted. The delete disk override command fails if the disk is a member of a RAID-5 volume.

Examples

To delete a missing dynamic disk from the list of disks, type:

Copy Code
delete disk

Additional references

Command-Line Syntax Key

DiskPart


Delete partition

Applies To: Windows Vista,Windows 7,Windows Server 2008,Windows Server 2008 R2

Deletes the partition with focus.

Syntax

Copy Code
delete partition [noerr] [override]

Parameters

Parameter | Description
override | Enables DiskPart to delete any partition regardless of type. Typically, DiskPart only permits you to delete known data partitions.
noerr | For scripting only. When an error is encountered, DiskPart continues to process commands as if the error did not occur. Without this parameter, an error causes DiskPart to exit with an error code.

Remarks

Caution
Deleting a partition on a dynamic disk can delete all dynamic volumes on the disk, thus destroying any data and leaving the disk in a corrupt state. To delete a dynamic volume, always use the delete volume command instead. Partitions can be deleted from dynamic disks, but they should not be created. For example, it is possible to delete an unrecognized GUID Partition Table (GPT) partition on a dynamic GPT disk. Deleting such a partition does not cause the resulting free space to become available. This command is intended to allow you to reclame space on a corrupted offline dynamic disk in an emergency situation where the clean command in DiskPart cannot be used.

  • You cannot delete the system partition, boot partition, or any partition that contains the active paging file or crash dump information.

  • A partition must be selected for this operation to succeed. Use the select partition command to select a partition and shift the focus to it.

Examples

To delete the partition with focus, type:

Copy Code
delete partition

Additional references

Command-Line Syntax Key

DiskPart


Delete volume

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows 7,Windows Vista

Deletes the selected volume.

Syntax

Copy Code
delete volume [noerr]

Parameters

Parameter | Description
noerr | For scripting only. When an error is encountered, DiskPart continues to process commands as if the error did not occur. Without this parameter, an error causes DiskPart to exit with an error code.

Remarks

  • You cannot delete the system volume, boot volume, or any volume that contains the active paging file or crash dump (memory dump).

  • A volume must be selected for this operation to succeed. Use the select volume command to select a volume and shift the focus to it.

Examples

To delete the volume with focus, type:

Copy Code
delete volume

Additional references

Command-Line Syntax Key

DiskPart


Detail

Applies To: Windows Vista,Windows 7,Windows Server 2008 R2,Windows Server 2008

Displays information about the selected disk, partition, volume, or virtual hard disk (VHD).

Syntax

Copy Code
detail disk
detail partition
detail volume
detail vdisk

Parameters

Parameter | Description
Detail disk | Displays the properties of the selected disk and the volumes on that disk.
Detail partition | Displays the properties of the selected partition.
Detail volume | Displays the disks on which the current volume resides.
Detail Vdisk | Displays the properties of the selected VHD.

Additional references

Command-Line Syntax Key

DiskPart


Detail disk

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows 7,Windows Vista

Displays the properties of the selected disk and the volumes on that disk.

Syntax

Copy Code
detail disk

Remarks

  • A disk must be selected for this operation to succeed. Use the select disk command to select a disk and shift the focus to it.

Examples

To see the properties of the selected disk, and information about the volumes in the disk, type:

Copy Code
detail disk

Additional references

Command-Line Syntax Key

DiskPart


Detail partition

Applies To: Windows Vista,Windows 7,Windows Server 2008 R2,Windows Server 2008

Displays the properties of the selected partition.

Syntax

Copy Code
detail partition

Remarks

  • A partition must be selected for this operation to succeed. Use the select partition command to select a partition and shift the focus to it.

Examples

To see the properties of the selected partition, type:

Copy Code
detail partition

Additional references

Command-Line Syntax Key

DiskPart


Detail volume

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows 7,Windows Vista

Displays the disks on which the current volume resides.

Syntax

Copy Code
detail volume

Remarks

  • A volume must be selected for this operation to succeed. Use the select volume command to select a volume and shift the focus to it.

  • The volume details are not applicable to read-only volumes, such as a DVD-ROM or CD-ROM drive.

Examples

To see all the disks in which the current volume resides, type:

Copy Code
detail volume

Additional references

Command-Line Syntax Key

DiskPart


Exit

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Exits the DiskPart command interpreter.

Syntax

Copy Code
exit

Additional references

Command-Line Syntax Key

DiskPart


Extend

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Vista,Windows 7

Extends the volume or partition with focus and its file system into free (unallocated) space on a disk.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
extend [size=<n>] [disk=<n>] [noerr]
extend filesystem [noerr]

Parameters

Parameter | Description
size=<n> | Specifies the amount of space in megabytes (MB) to add to the current volume or partition. If no size is given, all of the contiguous free space that is available on the disk is used.
disk=<n> | Specifies the disk on which the volume or partition is extended. If no disk is specified, the volume or partition is extended on the current disk.
filesystem | Extends the file system of the volume with focus. For use only on disks where the file system was not extended with the volume.
noerr | For scripting only. When an error is encountered, DiskPart continues to process commands as if the error did not occur. Without this parameter, an error causes DiskPart to exit with an error code.

Remarks

  • On basic disks, the free space must be on the same disk as the volume or partition with focus. It must also immediately follow the volume or partition with focus (that is, it must start at the next sector offset).

  • On dynamic disks with simple or spanned volumes, a volume can be extended to any free space on any dynamic disk. Using this command, you can convert a simple dynamic volume into a spanned dynamic volume. Mirrored, RAID-5 and striped volumes cannot be extended.

  • If the partition was previously formatted with the NTFS file system, the file system is automatically extended to fill the larger partition and no data loss will occur.

  • If the partition was previously formatted with a file system other than NTFS, the command fails with no change to the partition.

  • If the partition was not previously formatted with a file system, the partition will still be extended.

  • The partition must have an associated volume before it can be extended.

Examples

To extend the volume or partition with focus by 500 megabytes, on disk 3, type:

Copy Code
extend size=500 disk=3

To extend the file system of a volume after it was extended, type:

Copy Code
extend filesystem

Additional references

Command-Line Syntax Key

DiskPart


Filesystems

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows 7,Windows Vista

Displays information about the current file system of the volume with focus and lists the file systems that are supported for formatting the volume.

Syntax

Copy Code
filesystems

Remarks

  • A volume must be selected for this operation to succeed. Use the select volume command to select a volume and shift the focus to it.

Additional references

Command-Line Syntax Key

DiskPart


Format

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Vista,Windows 7

Formats the partition or volume with focus for use with Windows.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
format [{fs=<ntfs|fat|fat32>] [revision=<x.xx>] | recommended}] [label=<label>] [unit=<n>] [quick] [compress] [override] [duplicate] [nowait] [noerr]

Parameters

Parameter | Description
fs=<ntfs|fat|fat32> | Specifies the type of file system. If no file system is specified, the default file system is used. To view the default file system, run the filesystems command in DiskPart.
revision=<x.xx> | Specifies the file system revision (if applicable).
recommended | If a recommended file system exists, DiskPart will use that file system and revision instead of the default file system and revision. To view the recommended file system (if one exists), run the filesystems command in DiskPart.
label=<label> | Specifies the volume label.
unit=<n> | Overrides the default allocation unit size. Default settings are strongly recommended for general use. To view the default allocation unit size for each file system that is supported by the volume, run the filesystems command in DiskPart. Note that NTFS compression is not supported for allocation unit sizes above 4096.
quick | Performs a quick format.
compress | This parameter only applies to volumes that will be formatted with the NTFS file system. When you use this command, files created on the new volume will be compressed by default.
override | Forces the volume to dismount first if necessary. If the volume is forcefully dismounted, some open handles (files in use by an application) to that volume can become invalid.
duplicate | This parameter only applies only to the universal disk format (UDF), revision 2.50 and above. When this parameter is used, DiskPart duplicates the file system metadata on a second set of sectors on the disk. The duplicate metadata will be used by applications (for example repair or recovery applications) if the primary metadata sectors become corrupt.
nowait | Specifies to return the format immediately while the operation is still in progress. If this parameter is not specified, DiskPart will print out formatting progress in percentage.
noerr | For scripting only. When an error is encountered, DiskPart continues to process commands as if the error did not occur. Without this parameter, an error causes DiskPart to exit with an error code.

Remarks

  • A partition or volume must be selected for this operation to succeed. Use the select partition or the select volume command to select a partition or volume and shift the focus to it.

Examples

To perform a quick format of a partition or volume with the NTFS file system, assign the "Main Volume" label to it, and specify that files added to the new volume be compressed by default, type:

Copy Code
format fs=ntfs label="Main Volume" quick compress

To format the selected partition or volume that uses the recommended file system and force the volume to dismount if necessary, type:

Copy Code
format recommended override

Additional references

Command-Line Syntax Key

DiskPart


GPT

Applies To: Windows 7,Windows Vista,Windows Server 2008 R2,Windows Server 2008

On basic GUID partition table (GPT) disks, assigns the GPT attribute(s) to the partition with focus. GPT partition attributes give additional information about the use of the partition. Some attributes are specific to the partition type GUID.

For examples of how this command can be used, see Examples.

Caution
Changing the GPT attributes might cause your basic data volumes to fail to be assigned drive letters, or to prevent the file system from mounting. You should not change the GPT attributes unless you are an original equipment manufacturer (OEM) or an IT professional who is experienced with GPT disks.

Syntax

Copy Code
gpt attributes=<n>

Parameters

Parameter Description

attributes=<n>

Specifies the value for the attribute that you want to apply to the partition with focus. The GPT attribute field is a 64-bit field that contains two subfields. The higher field is interpreted only in the context of the partition ID, while the lower field is common to all partition IDs. Accepted values include:

  • 0x0000000000000001. Specifies that the partition is required by the computer to function properly.

  • 0x8000000000000000. Specifies that the partition will not receive a drive letter by default when the disk is moved to another computer or when the disk is seen for the first time by a computer.

  • 0x4000000000000000. Hides a partition's volume. That is, the partition will not be detected by the Mount Manager.

  • 0x2000000000000000. Specifies that the partition is a shadow copy of another partition.

  • 0x1000000000000000. Specifies that the partition is read-only. This attribute prevents the volume from being written to.

For more information about these attributes, see the Attributes section at CREATE_PARTITION_PARAMETERS Structure (http://go.microsoft.com/fwlink/?LinkId=203812).

Remarks

  • The EFI System partition contains only those binaries necessary to start the operating system. This makes it easy for OEM binaries or binaries specific to an operating system to be placed in other partitions.

  • A basic GPT partition must be selected for this operation to succeed. Use the select partition command to select a basic GPT partition and shift the focus to it.

Examples

If you are moving a GPT disk to a new computer and would like to prevent that computer from automatically assigning a drive letter to the partition with focus, type:

Copy Code
gpt attributes=0x8000000000000000

Additional references

Command-Line Syntax Key

DiskPart


Help

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows 7,Windows Vista

Displays a list of the available commands or detailed help information on a specified command.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
help [<command>]

Parameters

Parameter | Description
<command> | Specifies the command for which to display detailed help information.

Remarks

  • If no command is specified, help will display all possible commands.

Examples

To display a list of all commands available in DiskPart, type:

Copy Code
help

To display detailed help information about how to use the create partition primary command in DiskPart, type:

Copy Code
help create partition primary

Additional references

Command-Line Syntax Key

DiskPart


Import

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Vista,Windows 7

Imports a foreign disk group into the disk group of the local computer.

Syntax

Copy Code
import [noerr]

Parameters

Parameter | Description
noerr | For scripting only. When an error is encountered, DiskPart continues to process commands as if the error did not occur. Without this parameter, an error causes DiskPart to exit with an error code.

Remarks

  • The import command imports every disk that is in the same group as the disk with focus.

  • A dynamic disk in a foreign disk group must be selected for this operation to succeed. Use the select disk command to select a disk and shift the focus to it.

Examples

To import every disk that is in the same disk group as the disk with focus into the disk group of the local computer, type:

Copy Code
import

Additional references

Command-Line Syntax Key

DiskPart


Inactive

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows 7,Windows Vista

On basic master boot record (MBR) disks, marks the system partition or boot partition with focus as inactive.

Syntax

Copy Code
inactive

Remarks

Caution
Your computer might not start without an active partition. Do not mark a system or boot partition as inactive unless you are an experienced user with a thorough understanding of the Windows family of operating systems.

If you are unable to start your computer after marking the system or boot partition as inactive, insert the Windows Setup CD in the CD-ROM drive, restart the computer, and then repair the partition using the fixmbr and fixboot commands in the Recovery Console.

  • After you mark the system partition or boot partition as inactive, your computer starts from the next option specified in the BIOS, such as the CD-ROM drive or a Pre-Boot eXecution Environment (PXE).

  • An active system or boot partition must be selected for this operation to succeed. Use the select partition command to select the active partition and shift the focus to it.

Examples

Copy Code
inactive

Additional references

Command-Line Syntax Key

DiskPart


List

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Vista,Windows 7

Displays a list of disks, of partitions in a disk, of volumes in a disk, or of virtual hard disks (VHDs).

Syntax

Copy Code
list { disk | partition | volume | vdisk }

Parameters

Parameter Description

disk

Displays a list of disks and information about them, such as their size, amount of available free space, whether the disk is a basic or dynamic disk, and whether the disk uses the master boot record (MBR) or GUID partition table (GPT) partition style.

partition

Displays the partitions listed in the partition table of the current disk.

volume

Displays a list of basic and dynamic volumes on all disks.

vdisk

Displays a list of the VHDs that are attached and/or selected. This command lists detached VHDs if they are currently selected; however, the disk type is set to Unknown until the VHD is attached. The VHD marked with an asterisk (*) has focus.

Note
This command is only available for Windows 7 and Windows Server 2008 R2.

Remarks

  • When listing partitions on a dynamic disk, the partitions may not correspond to the dynamic volumes on the disk. This discrepancy occurs because dynamic disks contain entries in the partition table for the system volume or boot volume (if present on the disk). They also contain a partition that occupies the remainder of the disk in order to reserve the space for use by dynamic volumes.

  • The object marked with an asterisk (*) has focus.

Examples

Copy Code
list disk
list partition
list volume
list vdisk

Additional references

Command-Line Syntax Key

DiskPart


Offline

Applies To: Windows 7,Windows Server 2008 R2,Windows Server 2008

Takes an online disk or volume to the offline state.

Syntax

Copy Code
Offline disk
Offline volume

Parameters

Parameter | Description
Offline disk | Takes the online disk with focus to the offline state.
Offline volume | Takes the online volume with focus to the offline state.

Additional references

Command-Line Syntax Key

DiskPart


Online

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows 7

Takes an offline disk or volume to the online state.

Syntax

Copy Code
Offline disk
Offline volume

Parameters

Parameter | Description
Offline disk | Takes the offline disk with focus to the online state.
Offline volume | Takes the offline volume with focus to the online state.

Additional references

Command-Line Syntax Key

DiskPart


Recover

Applies To: Windows 7,Windows Server 2008,Windows Server 2008 R2

Refreshes the state of all disks in a disk group, attempt to recover disks in an invalid disk group, and resynchronizes mirrored volumes and RAID-5 volumes that have stale data.

Important
This DiskPart command is not available in any edition of Windows Vista.

Syntax

Copy Code
recover [noerr]

Parameters

Parameter | Description
noerr | For scripting only. When an error is encountered, DiskPart continues to process commands as if the error did not occur. Without this parameter, an error causes DiskPart to exit with an error code.

Remarks

  • This command operates on a disk group.

  • This command applies only to groups of dynamic disks. If this command is used on a group with a basic disk, it will not return an error but no action will be taken.

  • This command operates on disks that are failed or failing. It also operates on volumes that are failed, failing, or in failed redundancy state.

  • A disk that is part of a disk group must be selected for this command to succeed. Use the select disk command to select a disk and shift the focus to it.

Examples

To recover the disk group that contains the disk with focus, type:

Copy Code
recover

Additional references

Command-Line Syntax Key

DiskPart


Rem

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows 7,Windows Vista

Provides a way to add comments to a script.

Syntax

Copy Code
rem

Examples

In this example script, rem is used to provide a comment about what the script does:

Copy Code
rem The commands in this script set up 3 drives.
rem The first drive is a primary partition and is
rem assigned the letter D. The second and third drives
rem are logical partitions, and are assigned letters
rem E and F.
create partition primary size=2048
assign d:
create partition extended
create partition logical size=2048
assign e:
create partition logical
assign f:

Additional references

Command-Line Syntax Key

DiskPart


Remove

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows 7,Windows Vista

Removes a drive letter or mount point from a volume.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
remove [{letter=<d> | mount=<path> | all}] [dismount] [noerr]

Parameters

Parameter | Description
letter=<d> | Specifies the drive letter to be removed.
mount=<path> | Specifies the mount point path to be removed.
all | Removes all current drive letters and mount points.
dismount | Dismounts the basic volume, when all drive letters and mount points have been removed from the volume, and takes the basic volume offline, making it unmountable. If other processes are using the volume, DiskPart closes any open files in use by an application before dismounting the volume. You can make the volume mountable again by assigning it a driver letter or by creating a mount point path to the volume. Dismount will fail if used on a volume that has any remaining drive letters or mount points. For scripting, using remove all dismount is recommended.
noerr | For scripting only. When an error is encountered, DiskPart continues to process commands as if the error did not occur. Without this parameter, an error causes DiskPart to exit with an error code.

Remarks

  • If no drive letter or mount point is specified, DiskPart removes the first drive letter or mount point it encounters.

  • The command can be used to change the drive letter associated with a removable drive.

  • You cannot remove the drive letter on a system, boot, or paging volume. In addition, you cannot remove the drive letter for an OEM partition, any GPT partition with an unrecognized GUID, or any of the special, non-data, GPT partitions such as the EFI system partition.

Examples

To remove the drive letter K, type:

Copy Code
remove letter=k

To remove G:\MountH, type:

Copy Code
remove mount=G:\MountH

To remove all current drive letters and mount points, and dismount the volumes, type:

Copy Code
remove all dismount

Additional references

Command-Line Syntax Key

DiskPart


Repair

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows 7,Windows Vista

Repairs the RAID-5 volume with focus by replacing the failed disk region with the specified dynamic disk.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
repair disk=<n> [align=<n>] [noerr]

Parameters

Parameter | Description
disk=<n> | Specifies the dynamic disk that will replace the failed disk region.
align=<n> | Aligns all volume or partition extents to the closest alignment boundary. n is the number of kilobytes (KB) from the beginning of the disk to the closest alignment boundary.
noerr | For scripting only. When an error is encountered, DiskPart continues to process commands as if the error did not occur. Without this parameter, an error causes DiskPart to exit with an error code.

Remarks

  • The specified dynamic disk must have free space greater than or equal to the total size of the failed disk region in the RAID-5 volume.

  • A volume in a RAID-5 array must be selected for this operation to succeed. Use the select volume command to select a volume and shift the focus to it.

Examples

To replace the volume with focus by replacing it with dynamic disk 4, type:

Copy Code
repair disk=4

Additional references

Command-Line Syntax Key

DiskPart


Rescan

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Locates new disks that may have been added to the computer.

Syntax

Copy Code
rescan

Additional references

Command-Line Syntax Key

DiskPart


Retain

Applies To: Windows Vista,Windows 7,Windows Server 2008,Windows Server 2008 R2

Prepares an existing dynamic simple volume to be used as a boot or system volume.

Syntax

Copy Code
retain

Remarks

  • On a master boot record (MBR) dynamic disk, this command creates a partition entry in the master boot record.

  • On a GUID partition table (GPT) dynamic disk, this command creates a partition entry in the GUID partition table.

Additional references

Command-Line Syntax Key

DiskPart


Select

Applies To: Windows 7,Windows Vista,Windows Server 2008 R2,Windows Server 2008

Shifts the focus to a disk, partition, volume, or virtual hard disk (VHD).

Syntax

Copy Code
select disk
select partition
select volume
select vdisk

Parameters

Parameter | Description
Select disk | Shifts the focus to a disk.
Select partition | Shifts the focus to a partition.
Select volume | Shifts the focus to a volume.
Select vdisk | Shifts the focus to a VHD.

Remarks

  • If a volume is selected with a corresponding partition, the partition will be automatically selected.

  • If a partition is selected with a corresponding volume, the volume will be automatically selected.

Additional references

Command-Line Syntax Key

DiskPart


Select disk

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Vista,Windows 7

Selects the specified disk and shifts the focus to it.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
select disk={ <n> | <disk path> | system | next }
Note
The <disk path>, system, and next parameters are only available in Windows 7 and Windows Server 2008 R2.

Parameters

Parameter Description

<n>

Specifies the number of the disk to receive focus. You can view the numbers for all the disks on the computer by using the list disk command in DiskPart.

Note
When configuring systems with multiple disks, do not use select disk=0 to specify the system disk. The computer may reassign disk numbers when you reboot, and different computers with the same disk configuration can have different disk numbers.

<disk path>

Specifies the location of the disk to receive focus, for example, PCIROOT(0)#PCI(0F02)#ATA(C00T00L00). To view the location path of a disk, select it and then type detail disk.

system

On BIOS computers, specifies that disk 0 receives focus. On EFI computers, the disk containing the EFI system partition (ESP) that is used for the current boot receives focus. On EFI computers, the command will fail if there is no ESP, if there is more than one ESP, or the computer is booted from Windows Preinstallation Environment (Windows PE).

next

Once a disk is selected, this command iterates over all disks in the disk list. When you run this command, the next disk in the list will receive focus.

Examples

To shift the focus to disk 1, type:

Copy Code
select disk=1

To select a disk by using its location path, type:

Copy Code
select disk=PCIROOT(0)#PCI(0100)#ATA(C00T00L01)

To shift the focus to the system disk, type:

Copy Code
select disk=system

To shift the focus to the next disk on the computer, type:

Copy Code
select disk=next

Additional references

Command-Line Syntax Key

DiskPart


Select partition

Applies To: Windows 7,Windows Vista,Windows Server 2008 R2,Windows Server 2008

Selects the specified partition and shifts the focus to it. This command can also be used to display the partition that currently has the focus in the selected disk.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
select partition=<n>

Parameters

Parameter | Description
partition=<n> | The number of the partition to receive the focus. You can view the numbers for all partitions on the disk currently selected by using the list partition command in DiskPart.

Remarks

  • Before you can select a partition you must first select a disk using the select disk command.

  • If no partition number is specified, this command displays the partition that currently has the focus in the selected disk.

  • If a volume is selected with a corresponding partition, the partition will be automatically selected.

  • If a partition is selected with a corresponding volume, the volume will be automatically selected.

Examples

To shift the focus to partition 3, type:

Copy Code
select partitition=3

To display the partition that currently has the focus in the selected disk, type:

Copy Code
select partition

Additional references

Command-Line Syntax Key

DiskPart


Select volume

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Vista,Windows 7

Selects the specified volume and shifts the focus to it. This command can also be used to display the volume that currently has the focus in the selected disk.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
select volume={<n>|<d>}

Parameters

Parameter | Description
<n> | The number of the volume to receive the focus. You can view the numbers for all volumes on the disk currently selected by using the list volume command in DiskPart.
<d> | The drive letter or mount point path of the volume to receive the focus.

Remarks

  • If no volume is specified, this command displays the volume that currently has the focus in the selected disk.

  • On a basic disk, selecting a volume also gives the focus to the corresponding partition.

  • If a volume is selected with a corresponding partition, the partition will be automatically selected.

  • If a partition is selected with a corresponding volume, the volume will be automatically selected.

Examples

To shift the focus to volume 2, type:

Copy Code
select volume=2

To shift the focus to drive C, type:

Copy Code
select volume=c

To shift the focus to the volume mounted on a folder named "mountpath", type:

Copy Code
select volume=c:\mountpath

To display the volume that currently has the focus in the selected disk, type:

Copy Code
select volume

Additional references

Command-Line Syntax Key

DiskPart


Set id

Applies To: Windows Vista,Windows 7,Windows Server 2008 R2,Windows Server 2008

Changes the partition type field for the partition with focus.

Important
This command is intended for use by original equipment manufacturers (OEMs) only. Changing partition type fields with this parameter might cause your computer to fail or be unable to boot. Unless you are an OEM or experienced with GPT disks, you should not change partition type fields on GPT disks by using this parameter. Instead, always use the Create partition efi command to create EFI system partitions, the Create partition msr command to create Microsoft Reserved partitions, and the Create partition primary command without the ID parameter to create primary partitions on GPT disks.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
set id={ <byte> | <GUID> } [override] [noerr]

Parameters

Parameter Description

<byte>

For master boot record (MBR) disks, specifies the new value for the type field, in hexadecimal form, for the partition. Any partition type byte can be specified with this parameter except for type 0x42, which specifies an LDM partition. Note that the leading “0x” is omitted when specifying the hexadecimal partition type.

<GUID>

For GUID partition table (GPT) disks, specifies the new GUID value for the type field for the partition. Recognized GUIDs include:

  • EFI system partition: c12a7328-f81f-11d2-ba4b-00a0c93ec93b

  • Basic data partition: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7

Any partition type GUID can be specified with this parameter except the following:

  • Microsoft Reserved partition: e3c9e316-0b5c-4db8-817d-f92df00215ae

  • LDM metadata partition on a dynamic disk:5808c8aa-7e8f-42e0-85d2-e1e90434cfb3

  • LDM data partition on a dynamic disk: af9b60a0-1431-4f62-bc68-3311714a69ad

  • Cluster metadata partition: db97dba9-0840-4bae-97f0-ffb9a327c7e1

override

Forces the file system on the volume to dismount before changing the partition type. When you run the Set id command, DiskPart attempts to lock and dismount the file system on the volume. If override is not specified, and the call to lock the file system fails (for example, because there is an open handle), the operation will fail. When override is specified, DiskPart forces the dismount even if the call to lock the file system fails, and any open handles to the volume will become invalid.

This command is only available for Windows 7 and Windows Server 2008 R2.

noerr

Used for scripting only. When an error is encountered, DiskPart continues to process commands as if the error did not occur. Without this parameter, an error causes DiskPart to exit with an error code.

Remarks

  • Other than the limitations previously mentioned, DiskPart does not check the validity of the value that you specify (except to ensure that it is a byte in hexadecimal form or a GUID).

  • This command does not work on dynamic disks or on Microsoft Reserved partitions.

Examples

To set the type field to 0x07 and force the file system to dismount, type:

Copy Code
set id=0x07 override

To set the type field to be a basic data partition, type:

Copy Code
set id=ebd0a0a2-b9e5-4433-87c0-68b6b72699c7

Additional references

Command-Line Syntax Key

DiskPart


Shrink

Applies To: Windows Vista,Windows 7,Windows Server 2008 R2,Windows Server 2008

Reduces the size of the selected volume by the amount you specify. This parameter makes free disk space available from the unused space at the end of the volume.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
shrink [desired=<n>] [minimum=<n>] [nowait] [noerr]
shrink querymax [noerr]

Parameters

Parameter | Description
desired=<n> | Specifies the desired amount of space in megabytes (MB) to reduce the size of the volume by. If a desired amount is not specified, the volume will be reduced by the maximum amount of free space available on the volume.
minimum=<n> | Specifies the minimum amount of space in MB to reduce the size of the volume by.
querymax | Returns the maximum amount of space in MB by which the volume can be reduced (that is, the free space available on the volume). This value may change if applications are currently accessing the volume.
nowait | Forces the command to return immediately while the shrink process is still in progress.
noerr | For scripting only. When an error is encountered, DiskPart continues to process commands as if the error did not occur. Without this parameter, an error causes DiskPart to exit with an error code.

Remarks

  • You can reduce the size of a volume only if it is formatted using the NTFS file system or if it does not have a file system.

  • This command works on basic volumes, and on simple or spanned dynamic volumes.

  • If a minimum amount is not specified, the volume will be reduced by either the desired amount (if specified), or by the maximum amount of free space available on the volume.

  • If a minimum amount is specified but not enough free space is available, the command will fail.

  • A volume must be selected for this operation to succeed. Use the select volume command to select a volume and shift the focus to it.

  • This command does not operate on original equipment manufacturer (OEM) partitions, Extensible Firmware Interface (EFI) system partitions, or recovery partitions.

Examples

To reduce the size of the selected volume by the largest possible amount between 250 and 500 megabytes, type:

Copy Code
shrink desired=500 minimum=250

To display the maximum number of MB that the volume can be reduced by, type:

Copy Code
shrink querymax

Additional references

Command-Line Syntax Key

DiskPart


Uniqueid

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows 7

Displays or sets the GUID partition table (GPT) identifier or master boot record (MBR) signature for the disk with focus.

Important
This DiskPart command is not available in any edition of Windows Vista.

Syntax

Copy Code
uniqueid disk [id={<dword> | <GUID>}] [noerr]

Parameters

Parameter | Description
id={<dword> | <GUID>} | For MBR disks, specifies a four-byte (DWORD) value in hexadecimal form for the signature. For GPT disks, specifies a GUID for the identifier.
noerr | For scripting only. When an error is encountered, DiskPart continues to process commands as if the error did not occur. Without this parameter, an error causes DiskPart to exit with an error code.

Remarks

  • This command works on basic and dynamic disks.

  • A disk must be selected for this command to succeed. Use the select disk command to select a disk and shift the focus to it.

Examples

To display the signature of the MBR disk with focus, type:

Copy Code
uniqueid disk

To set the signature of the MBR disk with focus to 5f1b2c36, type:

Copy Code
uniqueid disk id=5f1b2c36

To set the identifier of the GPT disk with focus to baf784e7-6bbd-4cfb-aaac-e86c96e166ee, type:

Copy Code
uniqueid disk id=baf784e7-6bbd-4cfb-aaac-e86c96e166ee

Additional references

Command-Line Syntax Key

DiskPart


DiskRAID

Applies To: Windows Server 2008,Windows Vista

DiskRAID is a command-line tool that enables you to configure and manage redundant array of independent (or inexpensive) disks (RAID) storage subsystems.

RAID is a method used to standardize and categorize fault-tolerant disk systems. RAID levels provide various mixes of performance, reliability, and cost. RAID is usually used on servers. Some servers provide three of the RAID levels: Level 0 (striping), Level 1 (mirroring), and Level 5 (striping with parity).

A hardware RAID subsystem distinguishes physically addressable storage units from one another by using a Logical Unit Number (LUN). A LUN object must have at least one plex, and can have any number of additional plexes. Each plex contains a copy of the data on the LUN object. Plexes can be added to and removed from a LUN object.

Most DiskRAID commands operate on a specific host bus adapter (HBA) port, initiator adapter, initiator portal, provider, subsystem, controller, port, drive, LUN, target portal, target, or target portal group. You use the SELECT command to select an object. The selected object is said to have focus. Focus simplifies common configuration tasks, such as creating multiple LUNs within the same subsystem.

Note
The DiskRAID command-line tool works only with storage subsystems that support Virtual Disk Service (VDS).

DiskRAID commands

To view the command syntax, click a command:

  • add

  • associate

  • automagic

  • break

  • chap

  • create

  • delete

  • detail

  • dissociate

  • exit

  • extend

  • flushcache

  • help

  • importtarget

  • initiator

  • invalidatecache

  • lbpolicy

  • list

  • login

  • logout

  • maintenance

  • name

  • offline

  • online

  • recover

  • reenumerate

  • refresh

  • rem

  • remove

  • replace

  • reset

  • select

  • setflag

  • shrink

  • standby

  • unmask

add

Adds an existing LUN to the currently selected LUN, or adds an iSCSI target portal to the currently selected iSCSI target portal group.
Syntax
Copy Code
add plex lun=n [noerr]
add tpgroup tportal=n [noerr]
Parameters

plex lun=n

Specifies the LUN number to add as a plex to the currently selected LUN.

Caution
All data on the LUN being added as a plex will be deleted.

tpgroup tportal= n

Specifies the iSCSI target portal number to add to the currently selected iSCSI target portal group.

noerr

Specifies that any failures that occur while performing this operation will be ignored. This is useful in script mode.

associate

Sets the specified list of controller ports as active for the currently selected LUN (other controller ports are made inactive), or adds the specified controller ports to the list of existing active controller ports for the currently selected LUN, or associates the specified iSCSI target for the currently selected LUN.
Syntax
Copy Code
associate controllers [add] <n>[,<n> [,…]]
associate ports [add] <n-m>[,<n-m>[,…]]
associate targets [add] <n>[,<n> [,…]]
Parameters

controllers

For use with VDS 1.0 providers only. Adds to or replaces the list of controllers that are associated with the currently selected LUN.

ports

For use with VDS 1.1 providers only. Adds to or replaces the list of controller ports that are associated with the currently selected LUN.

targets

For use with VDS 1.1 providers only. Adds to or replaces the list of iSCSI targets that are associated with the currently selected LUN.

add

For VDS 1.0 providers, adds the specified controllers to the existing list of controllers associated with the LUN. If this parameter is not specified, the list of controllers replaces the existing list of controllers associated with this LUN.

For VDS 1.1 providers, adds the specified controller ports to the existing list of controller ports associated with the LUN. If this parameter is not specified, the list of controller ports replaces the existing list of controller ports associated with this LUN.

Copy Code
<n>[,<n> [, ...]]

For use with the controllers or targets parameter. Specifies the numbers of the controllers or iSCSI targets to set to active or associate.

Copy Code
<n-m>[,<n-m>[,…]]

For use with the ports parameter. Specifies the controller ports to set active using a controller number (n) and port number (m) pair.

Example

The following example shows how to associate and add ports to a LUN that uses a VDS 1.1 provider:

Copy Code
DISKRAID> SEL LUN 5
LUN 5 is now the selected LUN.

DISKRAID> ASSOCIATE PORTS 0-0,0-1
Controller port associations changed.
(Controller ports active after this command: Ctlr 0 Port 0, Ctlr 0 Port 1)

DISKRAID> ASSOCIATE PORTS ADD 1-1
Controller port associations changed.
(Controller ports active after this command: Ctlr 0 Port 0, Ctlr 0 Port 1, Ctlr 1 Port 1)

automagic

Sets or clears flags that give hints to providers on how to configure a LUN. Used with no parameters, the automagic operation displays a list of flags.
Syntax
Copy Code
automagic {set | clear | apply} all <flag=value> [<flag=value> [...]]
Parameters

set

Sets the specified flags to the specified values.

clear

Clears the specified flags. The all keyword clears all the automagic flags.

apply

Applies the current flags to the selected LUN.

<flag>

Flags are identified by three-letter acronyms.

Flag | Description
FCR | Fast Crash Recovery Required
FTL | Fault Tolerant
MSR | Mostly Reads
MXD | Maximum Drives
MXS | Maximum Size Expected
ORA | Optimal Read Alignment
ORS | Optimal Read Size
OSR | Optimize For Sequential Reads
OSW | Optimize For Sequential Writes
OWA | Optimal Write Alignment
OWS | Optimal Write Size
RBP | Rebuild Priority
RBV | Read Back Verify Enabled
RMP | Remap Enabled
STS | Stripe Size
WTC | Write-Through Caching Enabled
YNK | Removable

break

Removes the plex from the currently selected LUN. The plex and the data it contained are not retained, and the drive extents may be reclaimed.
Syntax
Copy Code
break plex=<plex_number> [noerr]
Parameters

plex

Specifies the number of the plex to remove. The plex and the data it contained will not be retained, and the resources used by this plex will be reclaimed. The data contained on the LUN is not guaranteed to be consistent. If you want to retain this plex, use the Volume Shadow Copy Service (VSS).

noerr

Specifies that any failures that occur while performing this operation will be ignored. This is useful in script mode.

Remarks
Note
You must first select a mirrored LUN before using the break command.

Caution
All data on the plex will be deleted.

Caution
All data contained on the original LUN is not guaranteed to be consistent.

chap

Sets the Challenge Handshake Authentication Protocol (CHAP) shared secret so that iSCSI initiators and iSCSI targets can communicate with one another.
Syntax
Copy Code
chap initiator set secret=[<secret>] [target=<target>]
chap initiator remember secret=[<secret>] target=<target>
chap target set secret=[<secret>] [initiator=<initiatorname>]
chap target remember secret=[<secret>] initiator=<initiatorname>
Parameters

initiator set

Sets the shared secret in the local iSCSI initiator service used for mutual CHAP authentication when the initiator authenticates the target.

initiator remember

Communicates the CHAP secret of an iSCSI target to the local iSCSI initiator service so that the initiator service can use the secret in order to authenticate itself to the target during CHAP authentication.

target set

Sets the shared secret in the currently selected iSCSI target used for CHAP authentication when the target authenticates the initiator.

target remember

Communicates the CHAP secret of an iSCSI initiator to the current in-focus iSCSI target so that the target can use the secret in order to authenticate itself to the initiator during mutual CHAP authentication.

secret

Specifies the secret to use. If empty the secret will be cleared.

target

Specifies a target in the currently selected subsystem to associate with the secret. This is optional when setting a secret on the initiator and leaving it out indicates that the secret will be used for all targets that do not already have an associated secret.

initiatorname

Specifies an initiator iSCSI name to associate with the secret. This is optional when setting a secret on a target and leaving it out indicates that the secret will be used for all initiators that do not already have an associated secret.

create

Creates a new LUN or iSCSI target on the currently selected subsystem, or creates a target portal group on the currently selected target. You can view the actual binding using the DiskRAID list command.
Syntax
Copy Code
create lun simple [size=<n>] [drives=<n>] [noerr]
create lun stripe [size=<n>] [drives=<n, n> [,...]]  [stripesize=<n>] [noerr]
create lun raid [size=<n>] [drives=<n, n> [,...]] [stripesize=<n>] [noerr]
create lun mirror [size=<n>] [drives=<n, n> [,...]] [stripesize=<n>] [noerr]
create lun automagic size=<n> [noerr]
create target name=<name> [iscsiname=<iscsiname>] [noerr]
create tpgroup [noerr]
Parameter

simple

Creates a simple LUN.

stripe

Creates a striped LUN.

RAID

Creates a striped LUN with parity.

mirror

Creates a mirrored LUN.

automagic

Creates a LUN using the automagic hints currently in effect. See the automagic sub-command for more information.

size=

Specifies the total LUN size in megabytes. If the size= parameter is not specified, the LUN created will be the largest possible size allowed by all the specified drives.

A provider typically creates a LUN at least as big as the requested size, but the provider may have to round up to the next largest size in some cases. For example, if size is specified as .99 GB and the provider can only allocate GB disk extents, the resulting LUN would be 1 GB.

To specify the size using other units, use one of the following recognized suffixes immediately after the size:

  • B for byte.

  • KB for kilobyte.

  • MB for megabyte.

  • GB for gigabyte.

  • TB for terabyte.

  • PB for petabyte.

drives=

Specifies the drive_number for the drives to use to create a LUN. If the size= parameter is not specified, the LUN created is the largest possible size allowed by all the specified drives. If the size= parameter is specified, providers will select drives from the specified drive list to create the LUN. Providers will attempt to use the drives in the order specified when possible.

stripesize=

Specifies the size in megabytes for a stripe or RAID LUN. The stripesize cannot be changed after the LUN is created.

To specify the size using other units, use one of the following recognized suffixes immediately after the size:

  • B for byte.

  • KB for kilobyte.

  • MB for megabyte.

  • GB for gigabyte.

  • TB for terabyte.

  • PB for petabyte.

target

Creates a new iSCSI target on the currently selected subsystem.

name

Supplies the friendly name for the target.

iscsiname

Supplies the iSCSI name for the target and can be omitted to have the provider generate a name.

tpgroup

Creates a new iSCSI target portal group on the currently selected target.

noerr

Specifies that any failures that occur while performing this operation will be ignored. This is useful in script mode.

Remarks
  • Either the size= or the drives= parameter must be specified. They can also be used together.

  • The stripe size for a LUN cannot be changed after creation.

delete

Deletes the currently selected LUN, iSCSI target (as long as there are not any LUNs associated with the iSCSI target) or iSCSI target portal group.
Syntax
Copy Code
delete lun [uninstall] [noerr]
delete target [noerr]
delete tpgroup [noerr]
Parameters

lun

Deletes the currently selected LUN and all data on it.

uninstall

Specifies that the disk on the local system associated with the LUN will be cleaned up before the LUN is deleted.

target

Deletes the currently selected iSCSI target if no LUNs are associated with the target.

tpgroup

Deletes the currently selected iSCSI target portal group.

noerr

Specifies that any failures that occur while performing this operation will be ignored. This is useful in script mode.

detail

Displays detailed information about the currently selected object of the specified type.
Syntax
Copy Code
Detail {hbaport | iadapter | iportal | provider | subsystem | controller | port | drive | lun | tportal | target | tpgroup} [verbose]
Parameters

hbaport

Lists detailed information about the currently selected host bus adapter (HBA) port.

iadapter

Lists detailed information about the currently selected iSCSI initiator adapter.

iportal

Lists detailed information about the currently selected iSCSI initiator portal.

provider

Lists detailed information about the currently selected provider.

subsystem

Lists detailed information about the currently selected subsystem.

controller

Lists detailed information about the currently selected controller.

port

Lists detailed information about the currently selected controller port.

drive

Lists detailed information about the currently selected drive, including the occupying LUNs.

lun

Lists detailed information about the currently selected LUN, including the contributing drives. The output differs slightly depending on whether the LUN is part of a Fibre Channel or iSCSI subsystem.

tportal

Lists detailed information about the currently selected iSCSI target portal.

target

Lists detailed information about the currently selected iSCSI target.

tpgroup

Lists detailed information about the currently selected iSCSI target portal group.

verbose

For use only with the LUN parameter. Lists additional information, including its plexes.

dissociate

Sets specified list of controller ports as inactive for the currently selected LUN (other controller ports are not affected), or dissociates the specified list of iSCSI targets for the currently selected LUN.
Syntax
Copy Code
dissociate controllers <n> [,<n> [,...]]
dissociate ports <n-m>[,<n-m>[,…]]
dissociate targets <n> [,<n> [,…]]
Parameter

controllers

For use with VDS 1.0 providers only. Removes controllers from the list of controllers that are associated with the currently selected LUN.

ports

For use with VDS 1.1 providers only. Removes controller ports from the list of controller ports that are associated with the currently selected LUN.

targets

For use with VDS 1.1 providers only. Removes targets from the list of iSCSI targets that are associated with the currently selected LUN.

Copy Code
<n> [,<n> [,…]]

For use with the controllers or targets parameter. Specifies the numbers of the controllers or iSCSI targets to set as inactive or dissociate.

Copy Code
<n-m>[,<n-m>[,…]]

For use with the ports parameter. Specifies the controller ports to set as inactive by using a controller number (n) and port number (m) pair.

Example
Copy Code
DISKRAID> SEL LUN 5
LUN 5 is now the selected LUN.

DISKRAID> ASSOCIATE PORTS 0-0,0-1
Controller port associations changed.
(Controller ports active after this command: Ctlr 0 Port 0, Ctlr 0 Port 1)

DISKRAID> ASSOCIATE PORTS ADD 1-1
Controller port associations changed.
(Controller ports active after this command: Ctlr 0 Port 0, Ctlr 0 Port 1, Ctlr 1 Port 1)

DISKRAID> DISSOCIATE PORTS 0-0,1-1
Controller port associations changed.
(Controller ports active after this command: Ctlr 0 Port 1)

exit

Exits DiskRAID.
Syntax
Copy Code
exit

extend

Extends the currently selected LUN by adding sectors to the end of the LUN. Not all providers support extending LUNs. Does not extend any volumes or file systems contained on the LUN. After you extend the LUN, you should extend the associated on-disk structures using the DiskPart extend command.
Syntax
Copy Code
extend lun [size=<LUN_size>] [drives=<drive_number>, [<drive_number>, ...]] [noerr]
Parameters

size=

Specifies the size in megabytes to extend the LUN. If the size= parameter is not specified, the LUN is extended by the largest possible size allowed by all the specified drives. If the size= parameter is specified, providers select drives from the list specified by the drives= parameter to create the LUN.

To specify the size using other units, use one of the following recognized suffixes immediately after the size:

  • B for byte.

  • KB for kilobyte.

  • MB for megabyte.

  • GB for gigabyte.

  • TB for terabyte

  • PB for petabyte

drives=

Specifies the <drive_number> for the drives to use when creating a LUN. If the size= parameter is not specified, the LUN created is the largest possible size allowed by all the specified drives. Providers use the drives in the order specified when possible.

noerr

Specifies that any failures that occur while performing this operation should be ignored. This is useful in script mode.

Remarks

Either the size or the <drive> parameter must be specified. They can also be used together.

flushcache

Clears the cache on the currently selected controller.
Syntax
Copy Code
flushcache controller

help

Displays a list of all DiskRAID commands.
Syntax
Copy Code
help

importtarget

Retrieves or sets the current Volume Shadow Copy Service (VSS) import target that is set for the currently selected subsystem.
Syntax
Copy Code
importtarget subsystem [set target]
Parameter

set target

If specified, sets the currently selected target to the VSS import target for the currently selected subsystem. If not specified, the command retrieves the current VSS import target that is set for the currently selected subsystem.

initiator

Retrieves information about the local iSCSI initiator.
Syntax
Copy Code
initiator

invalidatecache

Invalidates the cache on the currently selected controller.
Syntax
Copy Code
invalidatecache controller

lbpolicy

Sets the load balance policy on the currently selected LUN.
Syntax
Copy Code
lbpolicy set lun type=<type> [paths=<path>-{primary | <weight>}[,<path>-{primary | <weight>}[,…]]]
lbpolicy set lun paths=<path>-{primary | <weight>}[,<path>-{primary | <weight>}[,…]]
Parameters

type

Specifies the load balance policy. If the type is not specified, then the path parameter must be specified. Type can be one of the following:

FAILOVER: Uses one primary path with other paths being backup paths.

ROUNDROBIN: Uses all paths in round-robin fashion, which tries each path sequentially.

SUBSETROUNDROBIN: Uses all primary paths in round-robin fashion; backup paths are used only if all primary paths fail.

DYNLQD: Uses the path with the least number of active requests.

WEIGHTED: Uses the path with the least weight (each path must be assigned a weight).

LEASTBLOCKS: Uses the path with the least blocks.

VENDORSPECIFIC: Uses a vendor-specific policy.

paths

Specifies whether a path is primary or has a particular <weight>. Any paths not specified are implicitly set as backup. Any paths listed must be one of the currently selected LUN’s paths.

list

Displays a list of objects of the specified type.
Syntax
Copy Code
List {hbaports | iadapters | iportals | providers | subsystems | controllers | ports | drives | LUNs | tportals | targets | tpgroups}
Parameters

hbaports

Lists summary information about all HBA ports known to VDS. The currently selected HBA port is marked by an asterisk (*).

iadapters

Lists summary information about all iSCSI initiator adapters known to VDS. The currently selected initiator adapter is marked by an asterisk (*).

iportals

Lists summary information about all iSCSI initiator portals in the currently selected initiator adapter. The currently selected initiator portal is marked by an asterisk (*).

providers

Lists summary information about each provider known to VDS. The currently selected provider is marked by an asterisk (*).

subsystems

Lists summary information about each subsystem in the system. The currently selected subsystem is marked by an asterisk (*).

controllers

Lists summary information about each controller in the currently selected subsystem. The currently selected controller is marked by an asterisk (*).

ports

Lists summary information about each controller port in the currently selected controller. The currently selected port is marked by an asterisk (*).

drives

Lists summary information about each drive in the currently selected subsystem. The currently selected drive is marked by an asterisk (*).

luns

Lists summary information about each LUN in the currently selected subsystem. The currently selected LUN is marked by an asterisk (*).

tportals

Lists summary information about all iSCSI target portals in the currently selected subsystem. The currently selected target portal is marked by an asterisk (*).

targets

Lists summary information about all iSCSI targets in the currently selected subsystem. The currently selected target is marked by an asterisk (*).

tpgroups

Lists summary information about all iSCSI target portal groups in the currently selected target. The currently selected portal group is marked by an asterisk (*).

login

Logs the specified iSCSI initiator adapter into the currently selected iSCSI target.
Syntax
Copy Code
login target iadapter=<iadapter> [type={manual | persistent | boot}] [chap={none | oneway | mutual}] [iportal=<iportal>] [tportal=<tportal>] [<flag> [<flag> […]]]
Parameters

type

Specifies the type of login to perform: manual, persistent, or boot. If unspecified, a manual login will be performed.

manual - Login manually.

persistent - Automatically use the same login when the computer is restarted.

boot - (This option is for future development and is not currently used.)

chap

Specifies the type of CHAP authentication to use: none, oneway CHAP, or mutual CHAP; if unspecified, no authentication will be used.

tportal

Specifies an optional target portal in the currently selected subsystem to use for the log in.

iportal

Specifies an optional initiator portal in the specified initiator adapter to use for the log in.

<flag>

Identified by three letter acronyms:

IPS: Require IPsec

EMP: Enable multipath

EHD: Enable header digest

EDD: Enable data digest

logout

Logs the specified iSCSI initiator adapter out of the currently selected iSCSI target.
Syntax
Copy Code
logout target iadapter= <iadapter>
Parameters

iadapter

Specifies the initiator adapter with a login session to logout from.

maintenance

Performs maintenance operations on the currently selected object of the specified type.
Syntax
Copy Code
maintenance <object operation> [count=<iteration>]
Parameters

<object>

Specifies the type of object on which to perform the operation. The object type can be a subsystem, controller, port, drive or LUN.

<operation>

Specifies the maintenance operation to perform. The operation type can be spinup, spindown, blink, beep or ping. An operation must be specified.

count=

Specifies the number of times to repeat the operation. This is typically used with blink, beep,or ping.

name

Sets the friendly name of the currently selected subsystem, LUN, or iSCSI target to the specified name.
Syntax
Copy Code
name {subsystem | lun | target} [<name>]
Parameter

<name>

Specifies a name for the subsystem, LUN, or target. The name must be less than 64 characters in length. If no name is supplied, the existing name, if any, is deleted.

offline

Sets the state of the currently selected object of the specified type to offline.
Syntax
Copy Code
offline <object>
Parameter

<object>

Specifies the type of object on which to perform this operation. The <object>

type can be subsystem, controller, drive, LUN, or tportal.

online

Sets the state of the selected object of the specified type to online. If object is hbaport, changes the status of the paths to the currently selected HBA port to online.
Syntax
Copy Code
online <object>
Parameter

<object>

Specifies the type of object on which to perform this operation. The <object>

type can be hbaport, subsystem, controller, drive, LUN, or tportal.

recover

Performs operations necessary, such as resynchronization or hot sparing, to repair the currently selected fault-tolerant LUN. For example, RECOVER might cause a hot spare to be bound to a RAID set that has a failed disk or other disk extent reallocation.
Syntax
Copy Code
recover <lun>

reenumerate

Reenumerates objects of the specified type.
Syntax
Copy Code
reenumerate {subsystems | drives}
Parameters

subsystems

Queries the provider to discover any new subsystems that were added in the currently selected provider.

drives

Queries the internal I/O buses to discover any new drives that were added in the currently selected subsystem.

refresh

Refreshes internal data for the currently selected provider.
Syntax
Copy Code
refresh provider

rem

Used to comment scripts.
Syntax
Copy Code
Rem <comment>

remove

Removes the specified iSCSI target portal from the currently selected target portal group.
Syntax
Copy Code
remove tpgroup tportal=<tportal> [noerr]
Parameter

tpgroup tportal= <tportal>

Specifies the iSCSI target portal to remove.

noerr

Specifies that any failures that occur while performing this operation should be ignored. This is useful in script mode.

replace

Replaces the specified drive with the currently selected drive.
Syntax
Copy Code
replace drive=<drive_number>
Parameter

drive=

Specifies the <drive_number> for the drive to be replaced.

Remarks
  • The specified drive may not be the currently selected drive.

reset

Resets the currently selected controller or port.
Syntax
Copy Code
Reset {controller | port}
Parameters

controller

Resets the controller.

port

Resets the port.

select

Displays or changes the currently selected object.
Syntax
Copy Code
Select {hbaport | iadapter | iportal | provider | subsystem | controller | port | drive | lun | tportal | target | tpgroup } [<n>]
Parameters

object

Specifies the type of object to select. The <object> type can be provider, subsystem, controller, drive, or LUN.

hbaport [<n>]

Sets the focus to the specified local HBA port. If no HBA port is specified, the command displays the currently selected HBA port (if any). Specifying an invalid HBA port index results in no in-focus HBA port. Selecting an HBA port deselects any selected initiator adapters and initiator portals.

iadapter [<n>]

Sets the focus to the specified local iSCSI initiator adapter. If no initiator adapter is specified, the command displays the currently selected initiator adapter (if any). Specifying an invalid initiator adapter index results in no in-focus initiator adapter. Selecting an initiator adapter deselects any selected HBA ports and initiator portals.

iportal [<n>]

Sets the focus to the specified local iSCSI initiator portal within the selected iSCSI initiator adapter. If no initiator portal is specified, the command displays the currently selected initiator portal (if any). Specifying an invalid initiator portal index results in no selected initiator portal.

provider [<n>]

Sets the focus to the specified provider. If no provider is specified, the command displays the currently selected provider (if any). Specifying an invalid provider index results in no in-focus provider.

subsystem [<n>]

Sets the focus to the specified subsystem. If no subsystem is specified, the command displays the subsystem with focus (if any). Specifying an invalid subsystem index results in no in-focus subsystem. Selecting a subsystem implicitly selects its associated provider.

controller [<n>]

Sets the focus to the specified controller within the currently selected subsystem. If no controller is specified, the command displays the currently selected controller (if any). Specifying an invalid controller index results in no in-focus controller. Selecting a controller deselects any selected controller ports, drives, LUNs, target portals, targets, and target portal groups.

port [<n>]

Sets the focus to the specified controller port within the currently selected controller. If no port is specified, the command displays the currently selected port (if any). Specifying an invalid port index results in no selected port.

drive [<n>]

Sets the focus to the specified drive, or physical spindle, within the currently selected subsystem. If no drive is specified, the command displays the currently selected drive (if any). Specifying an invalid drive index results in no in-focus drive. Selecting a drive deselects any selected controllers, controller ports, LUNs, target portals, targets, and target portal groups.

lun [<n>]

Sets the focus to the specified LUN within the currently selected subsystem. If no LUN is specified, the command displays the currently selected LUN (if any). Specifying an invalid LUN index results in no selected LUN. Selecting a LUN deselects any selected controllers, controller ports, drives, target portals, targets, and target portal groups.

tportal [<n>]

Sets the focus to the specified iSCSI target portal within the currently selected subsystem. If no target portal is specified, the command displays the currently selected target portal (if any). Specifying an invalid target portal index results in no selected target portal. Selecting a target portal deselects any controllers, controller ports, drives, LUNs, targets, and target portal groups.

target [<n>]

Sets the focus to the specified iSCSI target within the currently selected subsystem. If no target is specified, the command displays the currently selected target (if any). Specifying an invalid target index results in no selected target. Selecting a target deselects any controllers, controller ports, drives, LUNs, target portals, and target portal groups.

tpgroup [<n>]

Sets the focus to the specified iSCSI target portal group within the currently selected iSCSI target. If no target portal group is specified, the command displays the currently selected target portal group (if any). Specifying an invalid target portal group index results in no in-focus target portal group.

[<n>]

Specifies the <object number> to select. If the <object number> specified is not valid, any existing selections for objects of the specified type are cleared. If no <object number> is specified, the current object is displayed.

setflag

Sets the currently selected drive as a hot spare.
Syntax
Copy Code
setflag drive hotspare={true | false}
Parameters

true

Selects the currently selected drive as a hot spare.

false

Unselects the currently selected drive as a hot spare.

Remarks

Hot spares cannot be used for ordinary LUN binding operations. They are reserved for fault handling only. The drive must not be currently bound to any existing LUN.

shrink

Reduces the size of the selected LUN.
Syntax
Copy Code
shrink lun size=<n> [noerr]
Parameters

size=

Specifies the desired amount of space in megabytes (MB) to reduce the size of the LUN by. To specify the size using other units, use one of the recognized suffixes (B, KB, MB, GB, TB and PB) immediately after the size.

noerr

Specifies that any failures that occur while performing this operation will be ignored. This is useful in script mode.

standby

Changes the status of the paths to the currently selected host bus adapter (HBA) port to STANDBY.
Syntax
Copy Code
standby hbaport
Parameters

hbaport

Changes the status of the paths to the currently selected host bus adapter (HBA) port to STANDBY.

unmask

Makes the currently selected LUNs accessible from the specified hosts.
Syntax
Copy Code
unmask LUN {all | none | [add] wwn=<hexadecimal_number> [;<hexadecimal_number> [;…]] | [add] initiator=<initiator>[;<initiator>[;…]]} [uninstall]
Parameters

all

Specifies that the LUN should be made accessible from all hosts. However, you cannot unmask the LUN to all targets in an iSCSI subsystem.

Important
You must logout of the target before you run the UNMASK ALL command.

none

Specifies that the LUN should not be accessible to any host.

Important
You must logout of the target before you run the UNMASK LUN NONE command.

add

Specifies that the hosts specified must be added to the existing list of hosts that this LUN is accessible from. If this parameter is not specified, the list of hosts supplied replaces the existing list of hosts that this LUN is accessible from.

WWN=

Specifies a list of hexadecimal numbers representing world-wide names from which the LUN or hosts should be made accessible. To mask/unmask to a specific set of hosts in a Fibre Channel subsystem, you can type a semicolon-separated list of WWN’s for the ports on the host machines of interest.

initiator=

Specifies a list of iSCSI initiators to which the currently selected LUN should be made accessible. To mask/unmask to a specific set of hosts in an iSCSI subsystem, you can type a semicolon-separated list of iSCSI initiator names for the initiators on the host computers of interest.

uninstall

If specified, uninstalls the disk associated with the LUN on the local system before the LUN is masked.

Scripting DiskRAID

DiskRAID can be scripted on any computer running Windows Server 2008 or Windows Server 2003 with an associated VDS hardware provider. To invoke a DiskRAID script, at the command prompt type:

Copy Code
diskraid /s <script.txt>

By default, DiskRAID stops processing commands and returns an error code if there is a problem in the script. To continue running the script and ignore errors, include the NOERR parameter on the command. This permits such useful practices as using a single script to delete all the LUNs in a subsystem regardless of the total number of LUNs. Not all commands support the NOERR parameter. Errors are always returned on command-syntax errors, regardless of whether you included the NOERR parameter,

DiskRAID error codes

Error Code | Error Description
0 | No error occurred. The entire script ran without failure.
1 | A fatal exception occurred.
2 | The arguments specified on a DiskRAID command line were incorrect.
3 | DiskRAID was unable to open the specified script or output file.
4 | One of the services DiskRAID uses returned a failure.
5 | A command syntax error occurred. The script failed because an object was improperly selected or was invalid for use with that command.

Example: Interactively View Status of Subsystem

If you want to view the status of subsystem 0 on your computer, type the following at the command line:

Copy Code
diskraid

Press ENTER. The following is displayed:

Copy Code
Microsoft Diskraid version 5.2.xxxx
Copyright (c) 2003 Microsoft Corporation
On computer: COMPUTER_NAME

To select subsystem 0, type the following at the DiskRAID prompt:

Copy Code
select subsystem 0

Press ENTER. Output similar to the following is displayed:

Copy Code
Subsystem 0 is now the selected subsystem.

DISKRAID> list drives

  Drive ###  Status      Health          Size      Free    Bus  Slot  Flags
  ---------  ----------  ------------  --------  --------  ---  ----  -----
  Drive 0    Online      Healthy         107 GB    107 GB    0     1
  Drive 1    Offline     Healthy          29 GB     29 GB    1     0
  Drive 2    Online      Healthy         107 GB    107 GB    0     2
  Drive 3    Not Ready   Healthy          19 GB     19 GB    1     1

To exit DiskRAID, type the following at the DiskRAID prompt:

Copy Code
exit


Diskshadow

Applies To: Windows Server 2008

DiskShadow.exe is a tool that exposes the functionality offered by the Volume Shadow Copy Service (VSS). By default, DiskShadow uses an interactive command interpreter similar to that of DiskRAID or DiskPart. DiskShadow also includes a scriptable mode.

Note
Membership in the local Administrators group, or equivalent, is the minimum required to run DiskShadow.

For examples of how to use DiskShadow commands, see Examples.

Syntax

For interactive mode, type the following at the command prompt to start the DiskShadow command interpreter:

Copy Code
diskshadow

For script mode, type the following, where script.txt is a script file containing DiskShadow commands:

Copy Code
diskshadow -s script.txt

DiskShadow commands

You can run the following commands in the DiskShadow command interpreter or through a script file:

Parameter | Description
Set | Sets the context, options, verbose mode, and metadata file for creating shadow copies.
Simulate restore | Tests writer involvement in restore sessions on the computer without issuing PreRestore or PostRestore events to writers.
Load metadata | Loads a metadata .cab file prior to importing a transportable shadow copy or loads the writer metadata in the case of a restore.
Writer | Verifies that a writer or component is included or excludes a writer or component from the backup or restore procedure.
Add | Adds volumes to the set of volumes that are to be shadow copied, or adds aliases to the alias environment.
Create | Starts the shadow copy creation process, using the current context and option settings.
Exec | Executes a file on the local computer.
Begin backup | Starts a full backup session.
End backup | Ends a full backup session and issues a BackupComplete event with the appropriate writer state, if needed.
Begin restore | Starts a restore session and issues a PreRestore event to involved writers.
End restore | Ends a restore session and issues a PostRestore event to involved writers.
Reset | Resets DiskShadow to the default state.
List | Lists writers, shadow copies, or currently registered shadow copy providers that are on the system.
Delete shadows | Deletes shadow copies.
Import | Imports a transportable shadow copy from a loaded metadata file into the system.
Mask | Removes hardware shadow copies that were imported by using the import command.
Expose | Exposes a persistent shadow copy as a drive letter, share, or mount point.
Unexpose | Unexposes a shadow copy that was exposed by using the expose command.
Break | Disassociates a shadow copy volume from VSS.
Revert | Reverts a volume back to a specified shadow copy.
Exit | Exits DiskShadow.

Remarks

  • At a minimum, only add and create are necessary to create a shadow copy. However, this will forfeit the context and option settings, will be a copy backup, and will only create a shadow copy with no backup execution script.

Examples

This is a sample sequence of commands that will create a shadow copy for backup. It can be saved to file as script.dsh, and executed with DISKSHADOW /s script.dsh

Assume the following:

  • You have an existing directory called c:\diskshadowdata.

  • Your system volume is C: and your data volume is D:.

  • You have a backupscript.cmd file in c:\diskshadowdata.

  • Your backupscript.cmd file will perform the copy of shadow data p: and q: to your backup drive.

You can enter these commands manually or script them:

Copy Code
#DiskShadow script file
set context persistent nowriters
set metadata c:\diskshadowdata\example.cab
set verbose on
begin backup
add volume c: alias SystemVolumeShadow
add volume d: alias DataVolumeShadow

create

expose %SystemVolumeShadow% p:
expose %DataVolumeShadow% q:
exec c:\diskshadowdata\backupscript.cmd
end backup
#End of script

Additional references

Command-Line Syntax Key


Add

Applies To: Windows Server 2008

Adds volumes to the set of volumes that are to be shadow copied, or adds aliases to the alias environment. If used without subcommands, add lists the current volumes and aliases.

Note
Aliases are not added to the alias environment until the shadow copy is created. Aliases that you need immediately should be added by using add alias.

For examples of how to use this command, see Examples.

Syntax

Copy Code
add
add volume <Volume> [provider <ProviderID>]
add alias <AliasName> <AliasValue>

Add subcommands

Subcommand | Description
volume | Adds a volume to the Shadow Copy Set, which is the set of volumes to be shadow copied. See Add volume for syntax and parameters.
alias | Adds the given name and value to the alias environment. See Add alias for syntax and parameters.
/? | Displays help at the command line.

Examples

To display the volumes added and the aliases that are currently in the environment, type:

Copy Code
add

The following output shows that drive C has been added to the Shadow Copy Set:

Copy Code
Volume c: alias System1    GUID \\?\Volume{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}\
1 volume in Shadow Copy Set.
No Diskshadow aliases in the environment.

Additional references

Command-Line Syntax Key


Add volume

Applies To: Windows Server 2008

Adds volumes to the Shadow Copy Set, which is the set of volumes to be shadow copied. This command is necessary to create shadow copies. If used without parameters, add volume displays help at the command prompt.

For examples of how to use this command, see Examples.

Syntax

Copy Code
add volume <Volume> [provider <ProviderID>]

Parameters

Parameter | Description
<Volume> | Specifies a volume to add to the Shadow Copy Set. At least one volume is required for shadow copy creation.
[provider <ProviderID>] | Specifies the Provider ID of a registered provider to use to create the shadow copy. If provider is not specified, the default provider is used.

Remarks

  • Volumes are added one at a time.

  • Each time a volume is added, it is checked to ensure that VSS supports shadow copy creation of that volume. This primary check may be invalidated, however, by later use of the set context command.

  • When a shadow copy is created, an environment variable links the alias to the shadow ID, so the alias can then be used for scripting.

Examples

To view the current list of registered providers, at the DISKSHADOW> prompt, type:

Copy Code
list providers

The following output displays a single provider, which will be used by default:

Copy Code
* ProviderID: {b5946137-7b9f-4925-af80-51abd60b20d5}
        Type: [1] VSS_PROV_SYSTEM
        Name: Microsoft Software Shadow Copy provider 1.0
        Version: 1.0.0.7
        CLSID: {65ee1dba-8ff4-4a58-ac1c-3470ee2f376a}
1 provider registered.

To add drive C to the Shadow Copy Set and assign an alias named System1, type:

Copy Code
add volume c: alias System1

Additional references

Command-Line Syntax Key


Add alias

Applies To: Windows Server 2008

Adds aliases to the alias environment. If used without parameters, add alias displays help at the command prompt.

For examples of how to use this command, see Examples.

Syntax

Copy Code
add alias <AliasName> <AliasValue>

Parameters

Parameter | Description
<AliasName> | Specifies the name of the alias.
<AliasValue> | Specifies the value of the alias.
/? | Displays help at the command prompt.

Remarks

  • Aliases are saved in the metadata file and will be loaded with the load metadata command.

Examples

To list all shadows, including their aliases, type:

Copy Code
list shadows all

The following excerpt shows a shadow copy to which the default alias, VSS_SHADOW_x, has been assigned:

Copy Code
* Shadow Copy ID = {ff47165a-1946-4a0c-b7f4-80f46a309278}
%VSS_SHADOW_1%

To assign a new alias with the name System1 to this shadow copy, type:

Copy Code
add alias System1 %VSS_SHADOW_1%

Alternatively, you can assign the alias by using the shadow copy ID:

Copy Code
add alias System1 {ff47165a-1946-4a0c-b7f4-80f46a309278}

Additional references

Command-Line Syntax Key


Begin backup

Applies To: Windows Server 2008

Starts a full backup session.

Syntax

Copy Code
begin backup

Remarks

  • This command overrides the default copy backup setting.

Additional references

Command-Line Syntax Key


Begin restore

Applies To: Windows Server 2008

Starts a restore session and issues a PreRestore event to involved writers.

Syntax

Copy Code
begin restore

Additional references

Command-Line Syntax Key


Break

Applies To: Windows Server 2008

Disassociates a shadow copy volume from VSS and makes it accessible as a regular volume. The volume can then be accessed using a drive letter (if assigned) or volume name. If used without parameters, break displays help at the command prompt.

Note
This command is relevant only for hardware shadow copies after import.

For examples of how to use this command, see Examples.

Syntax

Copy Code
break [writable] <SetID>

Parameters

Parameter | Description
[writable] | Enables read/write access on the volume.
<SetID> | Specifies the ID of the shadow copy set.

Remarks

  • Exposed volumes, like the shadow copies they originate from, are read-only by default.

  • The alias of the shadow copy ID, which is stored as an environment variable by the load metadata command, can be used in the SetID parameter.

Examples

To make a shadow copy with the alias name Alias1 accessible as a writable volume in the operating system, type:

Copy Code
break writable %Alias1%
Note
Access to the volume is made directly to the hardware provider without record of the volume having been a shadow copy.

Additional references

Command-Line Syntax Key


Create

Applies To: Windows Server 2008

Starts the shadow copy creation process, using the current context and option settings. Requires at least one volume in the Shadow Copy Set.

Syntax

Copy Code
create

Remarks

  • You must add at least one volume with the add volume command before you can use the create command.

  • You can use the begin backup command to specify a full backup, rather than a copy backup.

  • After you run the create command, you can use the exec command to run a duplication script for backup from the shadow copy.

Additional references

Command-Line Syntax Key


Delete shadows

Applies To: Windows Server 2008

Deletes shadow copies.

Syntax

Copy Code
delete shadows [all | volume <Volume> | oldest <Volume> | set <SetID> | id <ShadowID> | exposed {<Drive> | <MountPoint>}]

Parameters

Parameter | Description
all | Deletes all shadow copies.
volume <Volume> | Deletes all shadow copies of the given volume.
oldest <Volume> | Deletes the oldest shadow copy of the given volume.
set <SetID> | Deletes the shadow copies in the Shadow Copy Set of the given ID. You can specify an alias by using the % symbol if the alias exists in the current environment.
id <ShadowID> | Deletes a shadow copy of the given ID. You can specify an alias by using the % symbol if the alias exists in the current environment.
exposed {<Drive> | <MountPoint>} | Deletes the shadow copy exposed at the specified drive letter or mount point. Specify mount points as c:\mountPoint or by the drive letter such as p:.

Additional references

Command-Line Syntax Key


End backup

Applies To: Windows Server 2008

Ends a full backup session and issues a BackupComplete event with the appropriate writer state, if needed.

Syntax

Copy Code
end backup

Remarks

  • This command should be used for all full backups.

Additional references

Command-Line Syntax Key


End restore

Applies To: Windows Server 2008

Ends a restore session and issues a PostRestore event to involved writers.

Syntax

Copy Code
end restore

Additional references

Command-Line Syntax Key


Exec

Applies To: Windows Server 2008

Executes a file on the local computer. The file can be a cmd script.

Syntax

Copy Code
exec <ScriptFile.cmd>

Parameters

Parameter | Description
<ScriptFile.cmd> | Specifies the script file to execute.

Remarks

  • This command is used to duplicate or restore data as part of a backup or restore sequence.

  • If the script fails, an error is returned and DiskShadow quits.

Additional references

Command-Line Syntax Key


Exit

Applies To: Windows Server 2008

Exits DiskShadow.

Syntax

Copy Code
exit

Additional references

Command-Line Syntax Key


Expose

Applies To: Windows Server 2008

Exposes a persistent shadow copy as a drive letter, share, or mount point.

For examples of how to use this command, see Examples.

Syntax

Copy Code
expose <ShadowID> {<Drive:> | <Share> | <MountPoint>}

Parameters

Parameter | Description
ShadowID | Specifies the shadow ID of the shadow copy you want to expose.
<Drive:> | Exposes the specified shadow copy as a drive letter (for example, P:).
<Share> | Exposes the specified shadow copy at a share (for example, \\MachineName\).
<MountPoint> | Exposes the specified shadow copy to a mount point (for example, C:\shadowcopy\).

Remarks

  • You can use an existing alias or an environment variable in place of ShadowID. Use add without parameters to see existing aliases.

Examples

To expose the persistent shadow copy associated with the VSS_SHADOW_1 environment variable as drive X, type:

Copy Code
expose %vss_shadow_1% x:

Additional references

Command-Line Syntax Key


Import

Applies To: Windows Server 2008

Imports a transportable shadow copy from a loaded metadata file into the system.

For examples of how to use this command, see Examples.

Syntax

Copy Code
import

Remarks

  • Transportable shadow copies are not stored on the system immediately. Their details are stored in a Backup Components Document XML file, which DiskShadow automatically requests and saves in a .cab metadata file in the working directory. You can change the path and name of this file using the set metadata command.

  • Before you can use import, you must load a DiskShadow metadata file using the load metadata command.

Examples

The following is a sample DiskShadow script that demonstrates the use of the import command:

Copy Code
   #Sample DiskShadow script demonstrating IMPORT
   SET CONTEXT PERSISTENT
   SET CONTEXT TRANSPORTABLE
   SET METADATA transHWshadow_p.cab
   #P: is the volume supported by the Hardware Shadow Copy provider
   ADD VOLUME P:
   CREATE
   END BACKUP
   #The (transportable) shadow copy is not in the system yet.
   #You can reset or exit now if you wish.

   LOAD METADATA transHWshadow_p.cab
   IMPORT
   #The shadow copy will now be loaded into the system.

Additional references

Command-Line Syntax Key


List

Applies To: Windows Server 2008

Lists writers, shadow copies, or currently registered shadow copy providers that are on the system. If used without parameters, list displays help at the command prompt.

For examples of how to use this command, see Examples.

Syntax

Copy Code
list writers [metadata | detailed | status]
list shadows {all | set <SetID> | id <ShadowID>}
list providers

Parameters

Parameter | Description
writers | Lists writers. See List writers for syntax and parameters.
shadows | Lists persistent and existing non-persistent shadow copies. See List shadows for syntax and parameters.
providers | Lists currently registered shadow copy providers. See List providers for syntax and parameters.

Examples

To list all shadow copies, type:

Copy Code
list shadows all

Additional references

Command-Line Syntax Key


List writers

Applies To: Windows Server 2008

Lists writers that are on the system. If used without parameters, list displays the output for list metadata by default.

For examples of how to use this command, see Examples.

Syntax

Copy Code
list writers [metadata | detailed | status]

Parameters

Parameter | Description
metadata | Lists the identity and status of writers, and displays metadata such as component details and excluded files. This is the default parameter.
detailed | Lists the same information as metadata, but detailed includes the full file list for all components.
status | Lists only the identity and status of registered writers.

Examples

To list only the identity and status of writers, type:

Copy Code
list writers status

Output that is similar to the following displays:

Copy Code
Listing writer status ...
* WRITER "System Writer"
        - Status: 5 (VSS_WS_WAITING_FOR_BACKUP_COMPLETE)
        - Writer Failure code: 0x00000000 (S_OK)
        - Writer ID: {e8132975-6f93-4464-a53e-1050253ae220}
        - Instance ID: {7e631031-c695-4229-9da1-a7de057e64cb}
* WRITER "Shadow Copy Optimization Writer"
        - Status: 1 (VSS_WS_STABLE)
        - Writer Failure code: 0x00000000 (S_OK)
        - Writer ID: {4dc3bdd4-ab48-4d07-adb0-3bee2926fd7f}
        - Instance ID: {9e362607-9794-4dd4-a7cd-b3d5de0aad20}
...
...
...
* WRITER "Registry Writer"
        - Status: 1 (VSS_WS_STABLE)
        - Writer Failure code: 0x00000000 (S_OK)
        - Writer ID: {afbab4a2-367d-4d15-a586-71dbb18f8485}
        - Instance ID: {e87ba7e3-f8d8-42d8-b2ee-c76ae26b98e8}
8 writers listed.

Additional references

Command-Line Syntax Key


List shadows

Applies To: Windows Server 2008

Lists persistent and existing non-persistent shadow copies that are on the system.

Syntax

Copy Code
list shadows {all | set <SetID> | id <ShadowID>}

Parameters

Parameter | Description
all | Lists all shadow copies.
set <SetID> | Lists shadow copies that belong to the specified Shadow Copy Set ID.
id <ShadowID> | Lists any shadow copy with the specified shadow copy ID.

Additional references

Command-Line Syntax Key


List providers

Applies To: Windows Server 2008

Lists shadow copy providers that are currently registered on the system.

For examples of how to use this command, see Examples.

Syntax

Copy Code
list providers

Examples

To list the currently registered shadow copy providers, type:

Copy Code
list providers

Output that is similar to the following displays:

Copy Code
* ProviderID: {b5946137-7b9f-4925-af80-51abd60b20d5}
        Type: [1] VSS_PROV_SYSTEM
        Name: Microsoft Software Shadow Copy provider 1.0
        Version: 1.0.0.7
        CLSID: {65ee1dba-8ff4-4a58-ac1c-3470ee2f376a}
1 provider registered.

Additional references

Command-Line Syntax Key


Load metadata

Applies To: Windows Server 2008

Loads a metadata .cab file prior to importing a transportable shadow copy or loads the writer metadata in the case of a restore. If used without parameters, load metadata displays help at the command prompt.

For examples of how to use this command, see Examples.

Syntax

Copy Code
load metadata [<Drive>:][<Path>]<MetaData.cab>

Parameters

Parameter | Description
[<Drive>:][<Path>] | Specifies the location of the metadata file.
MetaData.cab | Specifies the metadata .cab file to load.

Remarks

  • You can use the import command to import a transportable shadow copy based on the metadata specified by load metadata.

  • This command is needed before the begin restore command to load the selected writers and components for the restore.

Examples

To load a metadata file called metafile.cab from the default location, type:

Copy Code
load metadata metafile.cab

Additional references

Command-Line Syntax Key


Mask

Applies To: Windows Server 2008

Removes hardware shadow copies that were imported by using the import command.

For examples of how to use this command, see Examples.

Syntax

Copy Code
mask <ShadowSetID>

Parameters

Parameter | Description
ShadowSetID | Removes shadow copies that belong to the specified Shadow Copy Set ID.

Remarks

  • You can use an existing alias or an environment variable in place of ShadowSetID. Use add without parameters to see existing aliases.

Examples

To remove the imported shadow copy %Import_1%, type:

Copy Code
mask %Import_1%

Additional references

Command-Line Syntax Key


Reset

Applies To: Windows Server 2008

Resets DiskShadow.exe to the default state. Reset is especially useful in separating compound DiskShadow operations such as create, import, backup, or restore.

Syntax

Copy Code
reset

Remarks

  • When you use the reset command, you lose state from commands such as add, set, load, or writer. Reset also releases IVssBackupComponent interfaces and loses non-persistent shadow copies.

Additional references

Command-Line Syntax Key


Revert

Applies To: Windows Server 2008

Reverts a volume back to a specified shadow copy. This is supported only for shadow copies in the CLIENTACCESSIBLE context. These shadow copies are persistent and can only be made by the system provider. If used without parameters, revert displays help at the command prompt.

Syntax

Copy Code
revert <ShadowCopyID>

Parameters

Parameter | Description
<ShadowCopyID> | Specifies the shadow copy ID to revert the volume to.

Additional references

Command-Line Syntax Key


Set

Applies To: Windows Server 2008

Sets the context, options, verbose mode, and metadata file for shadow copy creation. If used without parameters, set lists all current settings.

Syntax

Copy Code
set
set context {clientaccessible | persistent [nowriters] | volatile [nowriters]}
set option {[differential | plex] [transportable] [[rollbackrecover] [txfrecover] | [noautorecover]]}
set verbose {on|off}
set metadata <MetaData.cab>

Set sub-commands

Sub-command | Description
context | Sets the context for shadow copy creation. See Set context for syntax and parameters.
option | Sets options for shadow copy creation. See Set option for syntax and parameters.
verbose | Turns the verbose output mode on or off. See Set verbose for syntax and parameters.
metadata | Sets the name and location of the shadow creation metadata file. See Set metadata for syntax and parameters.
/? | Displays help at the command prompt.

Additional references

Command-Line Syntax Key


Set context

Applies To: Windows Server 2008

Sets the context for shadow copy creation. If used without parameters, set context displays help at the command prompt.

For examples of how to use this command, see Examples.

Syntax

Copy Code
set context {clientaccessible | persistent [nowriters] | volatile [nowriters]}

Parameters

Parameter | Description
clientaccessible | Specifies that the shadow copy is usable by client versions of Windows.
persistent | Specifies that the shadow copy persists across program exit, reset, or restart.
volatile | Deletes the shadow copy on exit or reset.
nowriters | Specifies that all writers are excluded.

Remarks

  • The clientaccessible context is persistent by default.

Examples

To prevent shadow copies from being deleted when you exit DiskShadow, type:

Copy Code
set context persistent

Additional references

Command-Line Syntax Key


Set option

Applies To: Windows Server 2008

Sets the options for shadow copy creation. If used without parameters, set option displays help at the command prompt.

Syntax

Copy Code
set option {[differential | plex] [transportable] [[rollbackrecover] [txfrecover] | [noautorecover]]}

Parameters

Parameter | Description
[differential | plex] | Specifies to the provider the type of shadow copy to create.
[transportable] | Specifies that the shadow copy is not to be imported yet. The metadata .cab file can later be used to import the shadow copy to the same or a different computer.
[rollbackrecover] | Signals writers to use autorecover during the PostSnapshot event. This is useful if the shadow copy will be used for rollback (for example, with data mining).
[txfrecover] | Requests VSS to make the shadow copy transactionally consistent during creation.
[noautorecover] | Stops writers and the file system from performing any recovery changes to the shadow copy to a transactionally consistent state. Noautorecover cannot be used with txfrecover or rollbackrecover.

Additional references

Command-Line Syntax Key


Set verbose

Applies To: Windows Server 2008

Specifies whether verbose output is provided during shadow copy creation. If used without parameters, set verbose displays help at the command prompt.

Syntax

Copy Code
set verbose {on | off}

Parameters

Parameter | Description
{on | off} | Turns verbose mode on or off.

Remarks

  • If verbose mode is on, set provides details of writer inclusion or exclusion and details of metadata compression and extraction.

Additional references

Command-Line Syntax Key


Set metadata

Applies To: Windows Server 2008

Sets the name and location of the shadow creation metadata file used to transfer shadow copies from one computer to another. If used without parameters, set metadata displays help at the command prompt.

Syntax

Copy Code
set metadata [<Drive>:][<Path>]<MetaData.cab>

Parameters

Parameter | Description
[<Drive>:][<Path>] | Specifies the location to create the metadata file.
<MetaData.cab> | Specifies the name of the cab file to store shadow creation metadata.

Additional references

Command-Line Syntax Key


Simulate restore

Applies To: Windows Server 2008

Tests writer involvement in restore sessions on the computer without issuing PreRestore or PostRestore events to writers.

Syntax

Copy Code
simulate restore

Remarks

  • Simulate restore is used to test whether or not restore with writers can be successful.

  • Before you can use simulate restore, you must load a DiskShadow metadata file by using the load metadata command. This loads the selected writers and components for the restore.

Additional references

Command-Line Syntax Key


Unexpose

Applies To: Windows Server 2008

Unexposes a shadow copy that was exposed by using the expose command. The exposed shadow copy can be specified by its Shadow ID, drive letter, share, or mount point.

For examples of how to use this command, see Examples.

Syntax

Copy Code
unexpose {<ShadowID> | <Drive:> | <Share> | <MountPoint>}

Parameters

Parameter | Description
<ShadowID> | Unexposes the shadow copy specified by the given Shadow ID.
<Drive:> | Unexposes the shadow copy associated with the specified drive letter (for example, drive P).
<Share> | Unexposes the shadow copy associated with the specified share (for example, \\MachineName\).
<MountPoint> | Unexposes the shadow copy associated with the specified mount point (for example, C:\shadowcopy\).

Remarks

  • You can use an existing alias or an environment variable in place of ShadowID. Use add without parameters to see existing aliases.

Examples

To unexpose the shadow copy associated with Drive P, type:

Copy Code
unexpose P:

Additional references

Command-Line Syntax Key


Writer

Applies To: Windows Server 2008

Verifies that a writer or component is included or excludes a writer or component from the backup or restore procedure. If used without parameters, writer displays help at the command prompt.

Syntax

Copy Code
writer verify [<Writer> | <Component>]
writer exclude [<Writer> | <Component>]

Parameters

Parameter | Description
verify | Verifies that the specified writer or component is included in the backup or restore procedure. The backup or restore procedure will fail if the writer or component is not included.
exclude | Excludes the specified writer or component from the backup or restore procedure.
[<Writer> | <Component>] | Specifies the writer or component to verify or exclude. Writers are specified by writer GUID or by the writer name, for example "System Writer."

Examples

To verify a writer by specifying its GUID (for this example, 4dc3bdd4-ab48-4d07-adb0-3bee2926fd7f), type:

Copy Code
writer verify {4dc3bdd4-ab48-4d07-adb0-3bee2926fd7f}

To exclude a writer with the name “System Writer,” type:

Copy Code
writer exclude "System Writer"

Additional references

Command-Line Syntax Key


Dispdiag

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Vista,Windows 7

Logs display information to a file.

Syntax

Copy Code
dispdiag [-testacpi] [-d] [-delay <Seconds>] [-out <FilePath>]

Parameters

Parameter | Description
- testacpi | Runs hotkey diagnostics test. Displays the key name, code and scan code for any key pressed during the test.
-d | Generates a dump file with test results.
-delay <Seconds> | Delays the collection of data by specified time in seconds.
-out <FilePath> | Specifies path and filename to save collected data. This must be the last parameter.
-? | Displays available command parameters and provides help for using them.


Djoin

Applies To: Windows 7,Windows Server 2008 R2

Provisions a computer account in a domain and requests an offline domain join when a computer restarts. For examples of how you can use this command, see Examples.

Syntax

Copy Code
djoin /provision /domain <domain_name> /machine <destination computer> /savefile <filename.txt> [/machineou <OU name>] [/dcname <name of domain controller>] [/reuse] [/downlevel] [/defpwd] [/nosearch] [/printblob]
Copy Code
djoin /requestodj /loadfile <filename.txt> /windowspath <path to the Windows directory of the offline image> /localos

Parameters

Parameter | Description
/provision | Creates a computer account in Active Directory Domain Services (AD DS).
/domain <domain name> | Specifies the name of the domain to join.
/machine <destination computer> | Specifies the name of the computer that you want to join to the domain.
/machineou <OU Name> | Specifies the name of the organizational unit (OU) in which you want the computer account to be created. By default, the computer account is created in the Computers container.
/dcname <domain controller name> | Specifies the name of a specific domain controller that will create the computer account. If you do not specify a domain controller, the domain controller Locator (DC Locator) process is used to select a domain controller.
/reuse | Specifies the reuse of any existing computer account. The password for the computer account will be reset.
/downlevel | Supports the use of a domain controller that runs a version of Windows Server that is earlier than Windows Server 2008 R2.
/savefile <filename.txt> | Saves provisioning data to a file.
/defpwd | Uses the default machine account password (not recommended).
/nosearch | Skips account conflict detention. Requires the /DCName parameter.
/printblob | Returns a base64-encoded metadata blob for an answer file.
/requestodj | Requests an offline domain join at the next start.
/Loadfile | Specifies the output from a previous provisioning command.
/windowspath <path to the Windows directory of the offline image> | Specifies the path to the Windows directory of the offline image. If you are using the /localos parameter, specify %systemroot% or %windir% as the value of the /windowspath parameter.
/localos | Targets the local operating system installation, instead of an offline image, with the domain join information. If you use this parameter, the value that you specify for /windowspath should be %systemroot% or %windir%. Run this parameter only on a destination computer that you want to join to the domain. This parameter is blocked from being run on a domain controller. Because this parameter injects the blob data into the locally running operating system image, you must restart the computer to complete the domain join operation, as you must also do for an online domain join.

Remarks

  • You can run Djoin.exe only on computers that run Windows 7 or Windows Server 2008 R2. The computer on which you run Djoin.exe to provision computer account data into AD DS must be running Windows 7 or Windows Server 2008 R2. The computer that you want to join to the domain must also be running Windows 7 or Windows Server 2008 R2.

  • By default, the Djoin.exe commands target a domain controller that runs Windows Server 2008 R2. However, you can specify an optional /downlevel parameter if you want to target a domain controller that is running a version of Windows Server that is earlier than Windows Server 2008 R2.

Examples

To provision a computer account named computer1 in the domain contoso.com and save the resulting metadata blob in a file named offlinedomainjoin.txt, run the following command at an elevated command prompt:

Copy Code
djoin /provision /domain contoso.com /machine computer1 /savefile offlinedomainjoin.txt

To request an offline domain join for a local computer and inject the domain join information from a file named offlinedomainjoin.txt into the local operating system, run the following command at an elevated command prompt:

Copy Code
djoin /requestODJ /loadfile offlinedomainjoin.txt /windowspath %SystemRoot% /localos

Additional references

  • Command-Line Syntax Key

  • Offline Domain Join (Djoin.exe) Step-by-Step Guide (http://go.microsoft.com/fwlink/?LinkId=195444)


Dnscmd

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Server 2003 with SP1,Windows Server 2003 R2,Windows Server 2003

A command-line interface for managing DNS servers. This utility is useful in scripting batch files to help automate routine DNS management tasks, or to perform simple unattended setup and configuration of new DNS servers on your network.

Syntax

Copy Code
dnscmd <ServerName> <command> [<command parameters>]

Parameters

Parameter | Description
<ServerName> | The IP address or host name of a remote or local DNS server.

Commands

Command | Description
dnscmd /ageallrecords | Sets the current time on all time stamps in a zone or node.
dnscmd /clearcache | Clears the DNS server cache.
dnscmd /config | Resets the DNS server or zone configuration.
dnscmd /createbuiltindirectorypartitions | Creates the built-in DNS application directory partitions.
dnscmd /createdirectorypartition | Creates a DNS application directory partition.
dnscmd /deletedirectorypartition | Deletes a DNS application directory partition.
dnscmd /directorypartitioninfo | Lists information about a DNS application directory partition.
dnscmd /enlistdirectorypartition | Adds a DNS server to the replication set of a DNS application directory partition.
dnscmd /enumdirectorypartitions | Lists the DNS application directory partitions for a server.
dnscmd /enumrecords | Lists the resource records in a zone.
dnscmd /enumzones | Lists the zones hosted by the specified server.
dnscmd /exportsettings | Writes server configuration information to a text file.
dnscmd /info | Gets server information.
dnscmd /ipvalidate | Validates remote DNS servers.
dnscmd /nodedelete | Deletes all records for a node in a zone.
dnscmd /recordadd | Adds a resource record to a zone.
dnscmd /recorddelete | Removes a resource record from a zone.
dnscmd /resetforwarders | Sets DNS servers to forward recursive queries.
dnscmd /resetlistenaddresses | Sets server IP addresses to serve DNS requests.
dnscmd /startscavenging | Initiates server scavenging.
dnscmd /statistics | Queries or clears server statistics data.
dnscmd /unenlistdirectorypartition | Removes a DNS server from the replication set of a DNS application directory partition.
dnscmd /writebackfiles | Saves all zone or root-hint data to a file.
dnscmd /zoneadd | Creates a new zone on the DNS server.
dnscmd /zonechangedirectorypartition | Changes the directory partition on which a zone resides.
dnscmd /zonedelete | Deletes a zone from the DNS server.
dnscmd /zoneexport | Writes the resource records of a zone to a text file.
dnscmd /zoneinfo | Displays zone information.
dnscmd /zonepause | Pauses a zone.
dnscmd /zoneprint | Displays all records in the zone.
dnscmd /zonerefresh | Forces a refresh of the secondary zone from the master zone.
dnscmd /zonereload | Reloads a zone from its database.
dnscmd /zoneresetmasters | Changes the master servers that provide zone transfer information to a secondary zone.
dnscmd /zoneresetscavengeservers | Changes the servers that can scavenge a zone.
dnscmd /zoneresetsecondaries | Resets secondary information for a zone.
dnscmd /zoneresettype | Changes the zone type.
dnscmd /zoneresume | Resumes a zone.
dnscmd /zoneupdatefromds | Updates an Active Directory–integrated zone with data from Active Directory Domain Services (AD DS).
dnscmd /zonewriteback | Saves zone data to a file.

dnscmd /ageallrecords

Sets the current time on a time stamp on resource records at a specified zone or node on a DNS server.

Syntax

Copy Code
dnscmd [<ServerName>] /ageallrecords <ZoneName>[<NodeName>] | [/tree]|[/f]

Parameters

<ServerName>

Specifies the DNS server that the administrator plans to manage, represented by IP address, fully qualified domain name (FQDN), or Host name. If this parameter is omitted, the local server is used.

<ZoneName>

Specifies the FQDN of the zone.

<NodeName>

Specifies a specific node or subtree in the zone. NodeName specifies the node or subtree in the zone using the following:

  • @ for root zone or FQDN

  • The FQDN of a node (the name with a period (.) at the end)

  • A single label for the name relative to the zone root

/tree

Specifies that all child nodes also receive the time stamp.

/f

Runs the command without asking for confirmation.

Remarks

  • The ageallrecords command is for backward compatibility between the current version of DNS and previous releases of DNS in which aging and scavenging were not supported. It adds a time stamp with the current time to resource records that do not have a time stamp, and it sets the current time on resource records that do have a time stamp.

  • Record scavenging does not occur unless the records are time stamped. Name server (NS) resource records, start of authority (SOA) resource records, and Windows Internet Name Service (WINS) resource records are not included in the scavenging process, and they are not time stamped even when the ageallrecords command runs.

  • This command fails unless scavenging is enabled for the DNS server and the zone. For information about how to enable scavenging for the zone, see the aging parameter under “Zone-Level Syntax” in the config command.

  • The addition of a time stamp to DNS resource records makes them incompatible with DNS servers that run on operating systems other than Windows 2000, Windows XP, or Windows Server 2003. A time stamp that you add by using the ageallrecords command cannot be reversed.

  • If none of the optional parameters are specified, the command returns all resource records at the specified node. If a value is specified for at least one of the optional parameters, dnscmd enumerates only the resource records that correspond to the value or values that are specified in the optional parameter or parameters.

Example

See Example 1: Set the current time on a time stamp to resource records.

dnscmd /clearcache

Clears the DNS cache memory of resource records on the specified DNS server.

Syntax

Copy Code
dnscmd [<ServerName>] /clearcache

Parameters

<ServerName>

Specifies the DNS server to manage, represented by IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

Sample usage

dnscmd dnssvr1.contoso.com /clearcache

dnscmd /config

Changes values in the registry for the DNS server and individual zones. Accepts server-level settings and zone-level settings.

Caution
Do not edit the registry directly unless you have no alternative. The registry editor bypasses standard safeguards, allowing settings that can degrade performance, damage your system, or even require you to reinstall Windows. You can safely alter most registry settings by using the programs in Control Panel or Microsoft Management Console (MMC). If you must edit the registry directly, back it up first. Read the Registry Editor Help for more information.

Server-level syntax

Copy Code
dnscmd [<ServerName>] /config <Parameter>

dnscmd /config

Modifies the configuration of the specified server.

Parameters

<ServerName>

Specifies the DNS server that you are planning to manage, represented by local computer syntax, IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

<Parameter>

Specify a setting and, as an option, a value. Parameter values use this syntax: Parameter [Value]

The following parameter values are described in the remainder of this section:

  • /addressanswerlimit

  • /bindsecondaries

  • /bootmethod

  • /defaultagingstate

  • /defaultnorefreshinterval

  • /defaultrefreshinterval

  • /disableautoreversezones

  • /disablensrecordsautocreation

  • /dspollinginterval

  • /dstombstoneinterval

  • /ednscachetimeout

  • /enablednsprobes

  • /enablednssec

  • /enableglobalnamessupport

  • /enableglobalqueryblocklist

  • /eventloglevel

  • /forwarddelegations

  • /forwardingtimeout

  • /globalnamesqueryorder

  • /globalqueryblocklist

  • /isslave

  • /localnetpriority

  • /logfilemaxsize

  • /logfilepath

  • /logipfilterlist

  • /loglevel

  • /maxcachesize

  • /maxcachettl

  • /namecheckflag

  • /notcp

  • /norecursion

  • /recursionretry

  • /recursiontimeout

  • /roundrobin

  • /rpcprotocol

  • /scavenginginterval

  • /secureresponses

  • /sendport

  • /strictfileparsing

  • /updateoptions

  • /writeauthorityns

  • /xfrconnecttimeout

/addressanswerlimit [0|5-28]

Specifies the maximum number of host records that a DNS server can send in response to a query. The value can be zero (0), or it can be in the range of 5 through 28 records. The default value is zero (0).

/bindsecondaries [0|1]

Changes the format of the zone transfer so that it can achieve maximum compression and efficiency. However, this format is not compatible with earlier versions of Berkeley Internet Name Domain (BIND).

0

Uses maximum compression. This format is compatible with BIND versions 4.9.4 and later only.

1

Sends only one resource record per message to non-Microsoft DNS servers. This format is compatible with BIND versions earlier than 4.9.4. This is the default setting.

/bootmethod [0|1|2|3]

Determines the source from which the DNS server gets its configuration information.

0

Clears the source of configuration information.

1

Loads from the BIND file that is located in the DNS directory, which is %systemroot%\System32\DNS by default.

2

Loads from the registry.

3

Loads from AD DS and the registry. This is the default setting.

/defaultagingstate [0|1]

Determines whether the DNS scavenging feature is enabled by default on newly created zones.

0

Disables scavenging. This is the default setting.

1

Enables scavenging.

/defaultnorefreshinterval [0x1-0xFFFFFFFF|0xA8]

Sets a period of time in which no refreshes are accepted for dynamically updated records. Zones on the server inherit this value automatically. To change the default value, type a value in the range of 0x1-0xFFFFFFFF. The default value from the server is 0xA8.

/defaultrefreshinterval [0x1-0xFFFFFFFF|0xA8]

Sets a period of time that is allowed for dynamic updates to DNS records. Zones on the server inherit this value automatically. To change the default value, type a value in the range of 0x1-0xFFFFFFFF. The default value from the server is 0xA8.

/disableautoreversezones [0|1]

Enables or disables the automatic creation of reverse lookup zones. Reverse lookup zones provide resolution of Internet Protocol (IP) addresses to DNS domain names.

0

Enables the automatic creation of reverse lookup zones. This is the default setting.

1

Disables the automatic creation of reverse lookup zones.

/disablensrecordsautocreation {0|1}

Specifies whether the DNS server automatically creates name server (NS) resource records for zones that it hosts.

0

Automatically creates name server (NS) resource records for zones that the DNS server hosts.

1

Does not automatically create name server (NS) resource records for zones that the DNS server hosts.

/dspollinginterval 0-30

Specifies how often the DNS server polls AD DS for changes in Active Directory–integrated zones.

/dstombstoneinterval [1-30]

The amount of time in seconds to retain deleted records in AD DS.

/ednscachetimeout [<seconds>]

Specifies the number of seconds that Extended DNS (EDNS) information is cached. The minimum value is 3600, and the maximum value is 15,724,800. The default value is 604,800 seconds (one week).

/enableednsprobes {0|1}

Enables or disables the server to probe other servers to determine if they support EDNS.

0

Disables active support for EDNS probes.

1

Enables active support for EDNS probes.

/enablednssec {0|1}

Enables or disables support for DNS Security Extensions (DNSSEC).

0

Disables DNSSEC.

1

Enables DNSSEC.

/enableglobalnamessupport {0|1}

Enables or disables support for the GlobalNames zone. The GlobalNames zone supports resolution of single-label DNS names across a forest.

0

Disables support for the GlobalNames zone. When you set the value of this command to 0, the DNS Server service does not resolve single-label names in the GlobalNames zone.

1

Enables support for the GlobalNames zone. When you set the value of this command to 1, the DNS Server service resolves single-label names in the GlobalNames zone.

/enableglobalqueryblocklist {0|1}

Enables or disables support for the global query block list that blocks name resolution for names in the list. The DNS Server service creates and enables the global query block list by default when the service starts the first time. To view the current global query block list, use the dnscmd /info /globalqueryblocklist command.

0

Disables support for the global query block list. When you set the value of this command to 0, the DNS Server service responds to queries for names in the block list.

1

Enables support for the global query block list. When you set the value of this command to 1, the DNS Server service does not respond to queries for names in the block list.

/eventloglevel [0|1|2|4]

Determines which events are logged in the DNS server log in Event Viewer.

0

Logs no events.

1

Logs only errors.

2

Logs only errors and warnings.

4

Logs errors, warnings, and informational events. This is the default setting.

/forwarddelegations [0|1]

Determines how the DNS server handles a query for a delegated subzone. These queries can be sent either to the subzone that is referred to in the query or to the list of forwarders that is named for the DNS server. Entries in the setting are used only when forwarding is enabled.

0

Automatically sends queries that refer to delegated subzones to the appropriate subzone. This is the default setting.

1

Forwards queries that refer to the delegated subzone to the existing forwarders.

/forwardingtimeout [<seconds>]

Determines how many seconds (0x1-0xFFFFFFFF) a DNS server waits for a forwarder to respond before trying another forwarder. The default value is 0x5, which is 5 seconds.

/globalneamesqueryorder {0|1}

Specifies whether the DNS Server service looks first in the GlobalNames zone or local zones when it resolves names.

0

The DNS Server service attempts to resolve names by querying the GlobalNames zone before it queries the zones for which it is authoritative.

1

The DNS Server service attempts to resolve names by querying the zones for which it is authoritative before it queries the GlobalNames zone.

/globalqueryblocklist [[<name> [<name>]...]

Replaces the current global query block list with a list of the names that you specify. If you do not specify any names, this command clears the block list. By default, the global query block list contains the following items:

  • isatap

  • wpad

The DNS Server service can remove either or both of these names when it starts the first time, if it finds these names in an existing zone.

/isslave [0|1]

Determines how the DNS server responds when queries that it forwards receive no response.

0

Specifies that the DNS server is not a subordinate (also known as a slave). If the forwarder does not respond, the DNS server attempts to resolve the query itself. This is the default setting.

1

Specifies that the DNS server is a subordinate. If the forwarder does not respond, the DNS server terminates the search and sends a failure message to the resolver.

/localnetpriority [0|1]

Determines the order in which host records are returned when the DNS server has multiple host records for the same name.

0

Returns the records in the order in which they are listed in the DNS database.

1

Returns the records that have similar IP network addresses first. This is the default setting.

/logfilemaxsize [<size>]

Specifies the maximum size in bytes (0x10000-0xFFFFFFFF) of the Dns.log file. When the file reaches its maximum size, DNS overwrites the oldest events. The default size is 0x400000, which is 4 megabytes (MB).

/logfilepath [<Path+LogFileName>]

Specifies the path of the Dns.log file. The default path is %systemroot%\System32\Dns\Dns.log. You can specify a different path by using the format Path+LogFileName.

/logipfilterlist <IPAddress> [,<IPAddress>...]

Specifies which packets are logged in the debug log file. The entries are a list of IP addresses. Only packets going to and from the IP addresses in the list are logged.

/loglevel [<EventType>]

Determines which types of events are recorded in the Dns.log file. Each event type is represented by a hexadecimal number. If you want more than one event in the log, use hexadecimal addition to add the values, and then enter the sum.

0x0

The DNS server does not create a log. This is the default entry.

0x10

Logs queries.

0x10

Logs notifications.

0x20

Logs updates.

0xFE

Logs nonquery transactions.

0x100

Logs question transactions.

0x200

Logs answers.

0x1000

Logs send packets.

0x2000

Logs receive packets.

0x4000

Logs User Datagram Protocol (UDP) packets.

0x8000

Logs Transmission Control Protocol (TCP) packets.

0xFFFF

Logs all packets.

0x10000

Logs Active Directory write transactions.

0x20000

Logs Active Directory update transactions.

0x1000000

Logs full packets.

0x80000000

Logs write-through transactions.

/maxcachesize

Specifies the maximum size, in kilobytes (KB), of the DNS server’s memory cache.

/maxcachettl [<seconds>]

Determines how many seconds (0x0-0xFFFFFFFF) a record is saved in the cache. If the 0x0 setting is used, the DNS server does not cache records. The default setting is 0x15180 (86,400 seconds or 1 day).

/maxnegativecachettl [<seconds>]

Specifies how many seconds (0x1-0xFFFFFFFF) an entry that records a negative answer to a query remains stored in the DNS cache. The default setting is 0x384 (900 seconds).

/namecheckflag [0|1|2|3]

Specifies which character standard is used when checking DNS names.

0

Uses ANSI characters that comply with Internet Engineering Task Force (IETF) Request for Comments (RFCs).

1

Uses ANSI characters that do not necessarily comply with IETF RFCs.

2

Uses multibyte UCS Transformation Format 8 (UTF-8) characters. This is the default setting.

3

Uses all characters.

/norecursion [0|1]

Determines whether a DNS server performs recursive name resolution.

0

The DNS server performs recursive name resolution if it is requested in a query. This is the default setting.

1

The DNS server does not perform recursive name resolution.

/notcp

This parameter is obsolete, and it has no effect in current versions of Windows Server.

/recursionretry [<seconds>]

Determines the number of seconds (0x1-0xFFFFFFFF) that a DNS server waits before again trying to contact a remote server. The default setting is 0x3 (three seconds). This value should be increased when recursion occurs over a slow wide area network (WAN) link.

/recursiontimeout [<seconds>]

Determines the number of seconds (0x1-0xFFFFFFFF) that a DNS server waits before discontinuing attempts to contact a remote server. The settings range from 0x1 through 0xFFFFFFFF. The default setting is 0xF (15 seconds). This value should be increased when recursion occurs over a slow WAN link.

/roundrobin [0|1]

Determines the order in which host records are returned when a server has multiple host records for the same name.

0

The DNS server does not use round robin. Instead, it returns the first record to every query.

1

The DNS server rotates among the records that it returns from the top to the bottom of the list of matching records. This is the default setting.

/rpcprotocol [0x0|0x1|0x2|0x4|0xFFFFFFFF]

Specifies the protocol that remote procedure call (RPC) uses when it makes a connection from the DNS server.

0x0

Disables RPC for DNS.

0x1

Uses TCP/IP.

0x2

Uses named pipes.

0x4

Uses local procedure call (LPC).

0xFFFFFFFF

All protocols. This is the default setting.

/scavenginginterval [<hours>]

Determines whether the scavenging feature for the DNS server is enabled, and sets the number of hours (0x0-0xFFFFFFFF) between scavenging cycles. The default setting is 0x0, which disables scavenging for the DNS server. A setting greater than 0x0 enables scavenging for the server and sets the number of hours between scavenging cycles.

/secureresponses [0|1]

Determines whether DNS filters records that are saved in a cache.

0

Saves all responses to name queries to a cache. This is the default setting.

1

Saves only the records that belong to the same DNS subtree to a cache.

/sendport [<port>]

Specifies the port number (0x0-0xFFFFFFFF) that DNS uses to send recursive queries to other DNS servers. The default setting is 0x0, which means that the port number is selected randomly.

/serverlevelplugindll[<DllPath>]

Specifies the path of a custom plug-in. When DllPath specifies the fully qualified path name of a valid DNS server plug-in, the DNS server calls functions in the plug-in to resolve name queries that are outside the scope of all locally hosted zones. If a queried name is out of the scope of the plug-in, the DNS server performs name resolution using forwarding or recursion, as configured. If DllPath is not specified, the DNS server ceases to use a custom plug-in if a custom plug-in was previously configured.

/strictfileparsing [0|1]

Determines a DNS server's behavior when it encounters an erroneous record while loading a zone.

0

The DNS server continues to load the zone even if the server encounters an erroneous record. The error is recorded in the DNS log. This is the default setting.

1

The DNS server stops loading the zone, and it records the error in the DNS log.

/updateoptions <RecordValue>

Prohibits dynamic updates of specified types of records. If you want more than one record type to be prohibited in the log, use hexadecimal addition to add the values, and then enter the sum.

0x0

Does not restrict any record types.

0x1

Excludes start of authority (SOA) resource records.

0x2

Excludes name server (NS) resource records.

0x4

Excludes delegation of name server (NS) resource records.

0x8

Excludes server host records.

0x100

During secure dynamic update, excludes start of authority (SOA) resource records.

0x200

During secure dynamic update, excludes root name server (NS) resource records.

0x30F

During standard dynamic update, excludes name server (NS) resource records, start of authority (SOA) resource records, and server host records. During secure dynamic update, excludes root name server (NS) resource records and start of authority (SOA) resource records. Allows delegations and server host updates.

0x400

During secure dynamic update, excludes delegation name server (NS) resource records.

0x800

During secure dynamic update, excludes server host records.

0x1000000

Excludes delegation signer (DS) records.

0x80000000

Disables DNS dynamic update.

/writeauthorityns [0|1]

Determines when the DNS server writes name server (NS) resource records in the Authority section of a response.

0

Writes name server (NS) resource records in the Authority section of referrals only. This setting complies with RFC 1034, “Domain names—concepts and facilities,” and with RFC 2181, “Clarifications to the DNS Specification.” This is the default setting.

1

Writes name server (NS) resource records in the Authority section of all successful authoritative responses.

/xfrconnecttimeout [<seconds>]

Determines the number of seconds (0x0-0xFFFFFFFF) a primary DNS server waits for a transfer response from its secondary server. The default value is 0x1E (30 seconds). After the time-out value expires, the connection is terminated.

Zone-level syntax

Copy Code
dnscmd /config <Parameters>

dnscmd /config

Modifies the configuration of the specified zone.

Parameters

<Parameters>

Specify a setting, a zone name, and, as an option, a value. Parameter values use this syntax: ZoneName Parameter [Value]

The following parameter values are documented in the remainder of this section:

  • /aging

  • /allownsrecordsautocreation

  • /allowupdate

  • /forwarderslave

  • /forwardertimeout

  • /norefreshinterval

  • /refreshinterval

  • /securesecondaries

/aging <ZoneName>

Enables or disables scavenging in a specific zone.

/allownsrecordsautocreation <ZoneName> [<Value>]

Overrides the DNS server's name server (NS) resource record autocreation setting. Name server (NS) resource records that were previously registered for this zone are not affected. Therefore, you must remove them manually if you do not want them.

/allowupdate <ZoneName>

Determines whether the specified zone accepts dynamic updates.

/forwarderslave <ZoneName>

Overrides the DNS server /isslave setting.

/forwardertimeout <ZoneName>

Determines how many seconds a DNS zone waits for a forwarder to respond before trying another forwarder. This value overrides the value that is set at the server level.

/norefreshinterval <ZoneName>

Sets a time interval for a zone during which no refreshes can dynamically update DNS records in a specified zone.

/refreshinterval <ZoneName>

Sets a time interval for a zone during which refreshes can dynamically update DNS records in a specified zone.

/securesecondaries <ZoneName>

Determines which secondary servers can receive zone updates from the master server for this zone.

Remarks

  • The zone name must be specified only for zone-level parameters.

dnscmd /createbuiltindirectorypartitions

Creates a DNS application directory partition. When DNS is installed, an application directory partition for the service is created at the forest and domain levels. Use this command to create DNS application directory partitions that were deleted or never created. With no parameter, this command creates a built-in DNS directory partition for the domain.

Syntax

Copy Code
dnscmd [<ServerName>] /createbuiltindirectorypartitions [/forest] [/alldomains]

Parameters

<ServerName>

Specifies the DNS server to manage, represented by IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

/forest

Creates a DNS directory partition for the forest.

/alldomains

Creates DNS partitions for all domains in the forest.

dnscmd /createdirectorypartition

Creates a DNS application directory partition. When DNS is installed, an application directory partition for the service is created at the forest and domain levels. This operation creates additional DNS application directory partitions.

Syntax

Copy Code
dnscmd [<ServerName>] /createdirectorypartition <PartitionFQDN>

Parameters

<ServerName>

Specifies the DNS server to manage, represented by IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

<PartitionFQDN>

The FQDN of the DNS application directory partition that will be created.

dnscmd /deletedirectorypartition

Removes an existing DNS application directory partition.

Syntax

Copy Code
dnscmd [<ServerName>] /deletedirectorypartition <PartitionFQDN>

Parameters

<ServerName>

Specifies the DNS server to manage, represented by IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

<PartitionFQDN>

The FQDN of the DNS application directory partition that will be removed.

dnscmd /directorypartitioninfo

Lists information about a specified DNS application directory partition.

Syntax

Copy Code
dnscmd [<ServerName>] /directorypartitioninfo <PartitionFQDN> [/detail]

Parameters

<ServerName>

Specifies the DNS server to manage, represented by IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

<PartitionFQDN>

The FQDN of the DNS application directory partition.

/detail

Lists all information about the application directory partition.

dnscmd /enlistdirectorypartition

Adds the DNS server to the specified directory partition's replica set.

Syntax

Copy Code
dnscmd [<ServerName>] /enlistdirectorypartition <PartitionFQDN>

Parameters

<ServerName>

Specifies the DNS server to manage, represented by IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

<PartitionFQDN>

The FQDN of the DNS application directory partition.

dnscmd /enumdirectorypartitions

Lists the DNS application directory partitions for the specified server.

Syntax

Copy Code
dnscmd [<ServerName>] /enumdirectorypartitions [/custom]

Parameters

<ServerName>

Specifies the DNS server to manage, represented by IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

/custom

Lists only user-created directory partitions.

dnscmd /enumrecords

Lists the resource records of a specified node in a DNS zone.

Syntax

Copy Code
dnscmd [<ServerName>] /enumrecords <ZoneName> <NodeName> [/type <RRType> <RRData>] [/authority] [/glue] [/additional] [/node | /child | /startchild<ChildName>] [/continue | /detail]

Parameters

<ServerName>

Specifies the DNS server that you plan to manage, represented by IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

/enumrecords

Lists resource records in the specified zone.

<ZoneName>

Specifies the name of the zone to which the resource records belong.

<NodeName>

Specifies the name of the node of the resource records.

/type <RRType> <RRData>

Specifies the type of resource records to be listed and the type of data that is expected:

<RRType>

Specifies the type of resource records to be listed.

<RRData>

Specifies the type of data that is expected record.

/authority

Includes authoritative data.

/glue

Includes glue data.

/additional

Includes all additional information about the listed resource records.

{/node | /child | /startchild <ChildName>}

Filters or adds information to the resource record display:

/node

Lists only the resource records of the specified node.

/child

Lists only the resource records of a specified child domain.

/startchild <ChildName>

Begins the list at the specified child domain.

/continue | /detail

Specifies how the returned data is displayed.

/continue

Lists only the resource records with their type and data.

/detail

Lists all information about the resource records.

Sample usage

dnscmd /enumrecords test.contoso.com test /additional

dnscmd /enumzones

Lists the zones that exist on the specified DNS server.

Syntax

Copy Code
dnscmd [<ServerName>] /enumzones [/primary | /secondary | /forwarder | /stub | /cache | /auto-created] [/forward | /reverse | /ds | /file] [/domaindirectorypartition | /forestdirectorypartition | /customdirectorypartition | /legacydirectorypartition | /directorypartition <PartitionFQDN>]

Parameters

<ServerName>

Specifies the DNS server to manage, represented by IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

/primary | /secondary | /forwarder | /stub | /cache | /auto-created

Filters the types of zones to display:

/primary

Lists all zones that are either standard primary zones or Active Directory–integrated zones.

/secondary

Lists all standard secondary zones.

/forwarder

Lists zones that forward unresolved queries to another DNS server.

/stub

Lists all stub zones.

/cache

Lists only the zones that are loaded into the cache.

/auto-created

Lists the zones that were created automatically during the DNS server installation.

/forward | /reverse | /ds | /file

Specifies additional filters of the types of zones to display:

/forward

Lists forward lookup zones.

/reverse

Lists reverse lookup zones.

/ds

Lists Active Directory–integrated zones.

/file

Lists zones that are backed by files.

/domaindirectorypartition

Lists zones that are stored in the domain directory partition.

/forestdirectorypartition

Lists zones that are stored in the forest DNS application directory partition.

/customdirectorypartition

Lists all zones that are stored in a user-defined application directory partition.

/legacydirectorypartition

Lists all zones that are stored in the domain directory partition.

/directorypartition <PartitionFQDN>

Lists all zones that are stored in the specified directory partition.

Remarks

  • The enumzones parameters act as filters on the list of zones. If no filters are specified, a complete list of zones is returned. When a filter is specified, only the zones that meet that filter's criteria are included in the returned list of zones.

Example

See Example 2: Display a complete list of zones on a DNS server or Example 3: Display a list of autocreated zones on a DNS server.

dnscmd /exportsettings

Creates a text file that lists the configuration details of a DNS server. The text file is named DnsSettings.txt. It is located in the %systemroot%\system32\dns directory of the server.

Syntax

Copy Code
dnscmd [<ServerName>] /exportsettings

Parameters

<ServerName>

Specifies the DNS server to manage, represented by local computer syntax, IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

Remarks

  • You can use the information in the file that dnscmd /exportsettings creates to troubleshoot configuration problems or to ensure that you have configured multiple servers identically.

dnscmd /info

Displays settings from the DNS section of the registry of the specified server: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DNS\Parameters

Syntax

Copy Code
dnscmd [<ServerName>] /info [<Setting>]

Parameters

<ServerName>

Specifies the DNS server to manage, represented by IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

<Setting>

Any setting that the info command returns can be specified individually. If a setting is not specified, a report of common settings is returned.

Remarks

  • This command displays registry settings that are at the DNS server level. To display zone-level registry settings, use the zoneinfo command. To see a list of settings that can be displayed with this command, see the config description.

Example

See Example 4: Display the IsSlave setting from a DNS server or Example 5: Display the RecursionTimeout setting from a DNS server.

dnscmd /ipvalidate

Tests whether an IP address identifies a functioning DNS server or whether the DNS server can act as a forwarder, a root hint server, or a master server for a specific zone.

Syntax

Copy Code
dnscmd [<ServerName>] /ipvalidate <Context> [<ZoneName>] [[<IPAddress>]…]

Parameters

<ServerName>

Specifies the DNS server to manage, represented by local computer syntax, IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

<Context>

Specifies the type of test to perform. You can specify any of the following tests:

  • /dnsservers tests that the computers with the addresses that you specify are functioning DNS servers.

  • /forwarders tests that the addresses that you specify identify DNS servers that can act as forwarders.

  • /roothints tests that the addresses that you specify identify DNS servers that can act as root hint name servers.

  • /zonemasters tests that the addresses that you specify identify DNS servers that are master servers for ZoneName.

<ZoneName>

Identifies the zone. Use this parameter with the /zonemasters parameter.

<IPAddress>

Specifies the IP addresses that the command tests.

Sample usage

dnscmd dnssvr1.contoso.com /ipvalidate /dnsservers 10.0.0.1 10.0.0.2

dnscmd dnssvr1.contoso.com /ipvalidate /zonemasters corp.contoso.com 10.0.0.2

dnscmd /nodedelete

Deletes all records for a specified host.

Syntax

Copy Code
dnscmd [<ServerName>] /nodedelete <ZoneName> <NodeName> [/tree] [/f]

Parameters

<ServerName>

Specifies the DNS server to manage, represented by IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

<ZoneName>

Specifies the name of the zone.

<NodeName>

Specifies the host name of the node to delete.

/tree

Deletes all the child records.

/f

Executes the command without asking for confirmation.

Example

See Example 6: Delete the records from a node.

dnscmd /recordadd

Adds a record to a specified zone in a DNS server.

Syntax

Copy Code
dnscmd [<ServerName>] /recordadd <ZoneName> <NodeName> <RRType> <RRData>

Parameters

<ServerName>

Specifies the DNS server to manage, represented by local computer syntax, IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

<ZoneName>

Specifies the zone in which the record resides.

<NodeName>

Specifies a specific node in the zone.

<RRType>

Specifies the type of record to be added.

<RRData>

Specifies the type of data that is expected.

Note
When you add a record, make sure that you use the correct data type and data format. For a list of resource record types and the appropriate data types, see Resource records reference.

Sample usage

dnscmd dnssvr1.contoso.com /recordadd test A 10.0.0.5

dnscmd /recordadd test.contoso.com test MX 10 mailserver.test.contoso.com

dnscmd /recorddelete

Deletes a resource record from a specified zone.

Syntax

Copy Code
dnscmd <ServerName> /recorddelete <ZoneName> <NodeName> <RRType> <RRData>[/f]

Parameters

<ServerName>

Specifies the DNS server to manage, represented by IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

<ZoneName>

Specifies the zone in which the resource record resides.

<NodeName>

Specifies the name of the host.

<RRType>

Specifies the type of resource record to be deleted.

<RRData>

Specifies the type of data that is expected.

/f

Executes the command without asking for confirmation:

  • Because nodes can have more than one resource record, this command requires you to be very specific about the type of resource record that you want to delete.

  • If you specify a data type and you do not specify a type of resource record data, all records with that specific data type for the specified node are deleted. For a list of resource record types and the appropriate data types, see Resource records reference.

Sample usage

dnscmd /recorddelete test.contoso.com test MX 10 mailserver.test.contoso.com

dnscmd /resetforwarders

Selects or resets the IP addresses to which the DNS server forwards DNS queries when it cannot resolve them locally.

Syntax

Copy Code
dnscmd [<ServerName>] /resetforwarders [<IPAddress> [,<IPAddress>]...][/timeout <TimeOut>] [/slave|/noslave]

Parameters

<ServerName>

Specifies the DNS server to manage, represented by IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

<IPAddress>

Lists the IP addresses to which the DNS server forwards unresolved queries.

/timeout <TimeOut>

Sets the number of seconds that the DNS server waits for a response from the forwarder. By default, this value is five seconds.

/slave|/noslave

Determines whether the DNS server performs its own iterative queries if the forwarder fails to resolve a query:

/slave

Prevents the DNS server from performing its own iterative queries if the forwarder fails to resolve a query.

/noslave

Allows the DNS server to perform its own iterative queries if the forwarder fails to resolve a query. This is the default setting.

Remarks

  • By default, a DNS server performs iterative queries when it cannot resolve a query.

  • Setting IP addresses by using the resetforwarders command causes the DNS server to perform recursive queries to the DNS servers at the specified IP addresses. If the forwarders do not resolve the query, the DNS server can then perform its own iterative queries.

  • If the /slave parameter is used, the DNS server does not perform its own iterative queries. This means that the DNS server forwards unresolved queries only to the DNS servers in the list, and it does not attempt iterative queries if the forwarders do not resolve them. It is more efficient to set one IP address as a forwarder for a DNS server. You can use the resetforwarders command for internal servers in a network to forward their unresolved queries to one DNS server that has an external connection.

  • Listing a forwarder’s IP address twice causes the DNS server to attempt to forward to that server twice.

Sample usage

dnscmd dnssvr1.contoso.com /resetforwarders 10.0.0.1 /timeout 7 /slave

dnscmd dnssvr1.contoso.com /resetforwarders /noslave

dnscmd /resetlistenaddresses

Specifies the IP addresses on a server that listens for DNS client requests.

Syntax

Copy Code
dnscmd [<ServerName>] /resetlistenaddresses [<ListenAddress>]

Parameters

<ServerName>

Specifies the DNS server to manage, represented by IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

<ListenAddress>

Specifies an IP address on the DNS server that listens for DNS client requests. If no listen address is specified, all IP addresses on the server listen for client requests.

Remarks

  • By default, all IP addresses on a DNS server listen for client DNS requests.

Sample usage

dnscmd dnssvr1.contoso.com /resetlistenaddresses 10.0.0.1

dnscmd /startscavenging

Tells a DNS server to attempt an immediate search for stale resource records in a specified DNS server.

Syntax

Copy Code
dnscmd [<ServerName>] /startscavenging

Parameter

<ServerName>

Specifies the DNS server to manage, represented by IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

Remarks

  • Successful completion of this command starts a scavenge immediately.

  • Although the command to start the scavenge appears to complete successfully, the scavenge does not start unless the following preconditions are met:

    • Scavenging is enabled for both the server and the zone.

    • The zone is started.

    • The resource records have a time stamp.

  • For information about how to enable scavenging for the server, see the scavenginginterval parameter under “Server-level syntax” in the config section.

  • For information about how to enable scavenging for the zone, see the aging parameter under “Zone-level syntax” in the config section.

  • For information about how to start a zone that is paused, see the zoneresume section.

  • For information about how to check resource records for a time stamp, see the ageallrecords section.

  • If the scavenge fails, no warning message appears.

Sample usage

dnscmd dnssvr1.contoso.com /startscavenging

dnscmd /statistics

Displays or clears data for a specified DNS server.

Syntax

Copy Code
dnscmd [<ServerName>] /statistics [<StatID>] [/clear]

Parameters

<ServerName>

Specifies the DNS server to manage, represented by IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

<StatID>

Specifies which statistic or combination of statistics to display. An identification number is used to identify a statistic. If no statistic ID number is specified, all statistics display.

The following is a list of numbers that can be specified and the corresponding statistic that displays:

00000001

Time

00000002

Query

00000004

Query2

00000008

Recurse

00000010

Master

00000020

Secondary

00000040

WINS

00000100

Update

00000200

SkwanSec

00000400

Ds

00010000

Memory

00100000

PacketMem

00040000

Dbase

00080000

Records

00200000

NbstatMem

/clear

Resets the specified statistics counter to zero.

Remarks

  • The statistics command displays counters that begin on the DNS server when it is started or resumed.

Examples

See Example 7: Display time statistics for a DNS server or Example 8: Display NbstatMem statistics for a DNS server.

dnscmd /unenlistdirectorypartition

Removes the DNS server from the specified directory partition's replica set.

Syntax

Copy Code
dnscmd [<ServerName>] /unenlistdirectorypartition <PartitionFQDN>

Parameters

<ServerName>

Specifies the DNS server to manage, represented by IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

<PartitionFQDN>

The FQDN of the DNS application directory partition that will be removed.

dnscmd /writebackfiles

Checks the DNS server memory for changes, and writes them to persistent storage.

Syntax

Copy Code
dnscmd [<ServerName>] /writebackfiles [<ZoneName>]

Parameters

<ServerName>

Specifies the DNS server to manage, represented by IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

<ZoneName>

Specifies the name of the zone to be updated.

Remarks

  • The writebackfiles command updates all dirty zones or a specified zone. A zone is “dirty” when there are changes in memory that have not yet been written to persistent storage. This is a server-level operation that checks all zones. You can specify one zone in this operation or you can use the zonewriteback operation.

Sample usage

dnscmd dnssvr1.contoso.com /writebackfiles

dnscmd /zoneadd

Adds a zone to the DNS server.

Syntax

Copy Code
dnscmd [<ServerName>] /zoneadd <ZoneName> <ZoneType> [/dp <FQDN>| {/domain|/enterprise|/legacy}]

Parameters

<ServerName>

Specifies the DNS server to manage, represented by IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

<ZoneName>

Specifies the name of the zone.

<ZoneType>

Specifies the type of zone to create. Each zone type has different required parameters:

/dsprimary

Creates an Active Directory–integrated zone.

/primary /file <FileName>

Creates a standard primary zone, and specifies the name of the file that will store the zone information.

/secondary <MasterIPAddress> [<MasterIPAddress>...]

Creates a standard secondary zone.

/stub <MasterIPAddress> [<MasterIPAddress>...] /file <FileName>

Creates a file-backed stub zone.

/dsstub <MasterIPAddress> [<MasterIPAddress>...]

Creates an Active Directory–integrated stub zone.

/forwarder <MasterIPAddress> [<MasterIPAddress>]... /file <FileName>

Specifies that the created zone forwards unresolved queries to another DNS server.

/dsforwarder

Specifies that the created Active Directory–integrated zone forwards unresolved queries to another DNS server.

/dp <FQDN> {/domain | /enterprise | /legacy}

Specifies the directory partition on which to store the zone.

<FQDN>

Specifies FQDN of the directory partition.

/domain

Stores the zone on the domain directory partition.

/enterprise

Stores the zone on the enterprise directory partition.

/legacy

Stores the zone on a legacy directory partition.

Remarks

  • Specifying a zone type of /forwarder or /dsforwarder creates a zone that performs conditional forwarding.

Sample usage

dnscmd dnssvr1.contoso.com /zoneadd test.contoso.com /dsprimary

dnscmd dnssvr1.contoso.com /zoneadd secondtest.contoso.com /secondary 10.0.0.2

dnscmd /zonechangedirectorypartition

Changes the directory partition on which the specified zone resides.

Syntax

Copy Code
dnscmd [<ServerName>] /zonechangedirectorypartition <ZoneName>] {[<NewPartitionName>] | [<ZoneType>] }

Parameters

<ServerName>

Specifies the DNS server to manage, represented by IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

<ZoneName>

The FQDN of the current directory partition on which the zone resides.

<NewPartitionName>

The FQDN of the directory partition that the zone will be moved to.

<ZoneType>

Specifies the type of directory partition that the zone will be moved to.

/domain

Moves the zone to the built-in domain directory partition.

/forest

Moves the zone to the built-in forest directory partition.

/legacy

Moves the zone to the directory partition that is created for pre–Active Directory domain controllers. These directory partitions are not necessary for native mode.

dnscmd /zonedelete

Deletes a specified zone.

Syntax

Copy Code
dnscmd [<ServerName>] /zonedelete <ZoneName> [/dsdel] [/f]

Parameters

<ServerName>

Specifies the DNS server to manage, represented by IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

<ZoneName>

Specifies the name of the zone to be deleted.

/dsdel

Deletes the zone from AD DS.

/f

Runs the command without asking for confirmation.

Example

See Example 9: Delete a zone from a DNS server.

dnscmd /zoneexport

Creates a text file that lists the resource records of a specified zone.

Syntax

Art Image dnscmd [<ServerName>] /zoneexport <ZoneName> <ZoneExportFile>

Parameters

<ServerName>

Specifies the DNS server to manage, represented by local computer syntax, IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

<ZoneName>

Specifies the name of the zone.

<ZoneExportFile>

Specifies the name of the file to create.

Remarks

  • The zoneexport operation creates a file of resource records for an Active Directory–integrated zone for troubleshooting purposes. By default, the file that this command creates is placed in the DNS directory, which is by default the %systemroot%/System32/Dns directory.

Example

See Example 10: Export zone resource records list to a file.

dnscmd /zoneinfo

Displays settings from the section of the registry of the specified zone: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DNS\Parameters\Zones\<ZoneName>

Syntax

Copy Code
dnscmd [<ServerName>] /zoneinfo <ZoneName>  [<Setting>]

Parameters

<ServerName>

Specifies the DNS server to manage, represented by IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

<ZoneName>

Specifies the name of the zone.

<Setting>

You can individually specify any setting that the zoneinfo command returns. If you do not specify a setting, all settings are returned.

Remarks

  • The zoneinfo command displays registry settings that are at the DNS zone level at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DNS\Parameters\Zones\<ZoneName>.

  • To display server-level registry settings, use the info command.

  • To see a list of settings that you can display with this command, see the config command.

Example

See Example 11: Display RefreshInterval setting from the registry or Example 12: Display Aging setting from the registry.

dnscmd /zonepause

Pauses the specified zone, which then ignores query requests.

Syntax

Copy Code
dnscmd [<ServerName>] /zonepause <ZoneName>

Parameters

<ServerName>

Specifies the DNS server to manage, represented by IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

<ZoneName>

Specifies the name of the zone to be paused.

Remarks

  • To resume a zone and make it available after it has been paused, use the zoneresume command.

Sample usage

dnscmd dnssvr1.contoso.com /zonepause test.contoso.com

dnscmd /zoneprint

Lists the records in a zone.

Syntax

Copy Code
dnscmd [<ServerName>] /zoneprint <ZoneName>

Parameters

<ServerName>

Specifies the DNS server to manage, represented by local computer syntax, IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

<ZoneName>

Identifies the zone to be listed.

dnscmd /zonerefresh

Forces a secondary DNS zone to update from the master zone.

Syntax

Copy Code
dnscmd <ServerName> /zonerefresh <ZoneName>

Parameters

<ServerName>

Specifies the DNS server to manage, represented by IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

<ZoneName>

Specifies the name of the zone to be refreshed.

Remarks

  • The zonerefresh command forces a check of the version number in the master server’s start of authority (SOA) resource record. If the version number on the master server is higher than the secondary server's version number, a zone transfer is initiated that updates the secondary server. If the version number is the same, no zone transfer occurs.

  • The forced check occurs by default every 15 minutes. To change the default, use the dnscmd config refreshinterval command.

Sample usage

dnscmd dnssvr1.contoso.com /zonerefresh test.contoso.com

dnscmd /zonereload

Copies zone information from its source.

Syntax

Copy Code
dnscmd <ServerName> /zonereload <ZoneName>

Parameters

<ServerName>

Specifies the DNS server to manage, represented by IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

<ZoneName>

Specifies the name of the zone to be reloaded.

Remarks

  • If the zone is Active Directory–integrated, it reloads from AD DS.

  • If the zone is a standard file-backed zone, it reloads from a file.

Sample usage

dnscmd dnssvr1.contoso.com /zonereload test.contoso.com

dnscmd /zoneresetmasters

Resets the IP addresses of the master server that provides zone transfer information to a secondary zone.

Syntax

Copy Code
dnscmd <ServerName> /zoneresetmasters <ZoneName> [/local] [<IPAddress> [<IPAddress>]...]

Parameters

<ServerName>

Specifies the DNS server to manage, represented by IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

<ZoneName>

Specifies the name of the zone to be reloaded.

/local

Sets a local master list. This parameter is used for Active Directory–integrated zones.

<IPAddress>

The IP addresses of the master servers of the secondary zone.

Remarks

  • This value is originally set when the secondary zone is created. Use the zoneresetmasters command on the secondary server. This value has no effect if it is set on the master DNS server.

Sample usage

dnscmd dnssvr1.contoso.com /zoneresetmasters test.contoso.com 10.0.0.1

dnscmd dnssvr1.contoso.com /zoneresetmasters test.contoso.com /local

dnscmd /zoneresetscavengeservers

Changes the IP addresses of the servers that can scavenge the specified zone.

Syntax

Copy Code
dnscmd [<ServerName>] /zoneresetscavengeservers <ZoneName> [<IPAddress> [<IPAddress>]...]

Parameters

<ServerName>

Specifies the DNS server to manage, represented by local computer syntax, IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

<ZoneName>

Identifies the zone to scavenge.

<IPAddress>

Lists the IP addresses of the servers that can perform the scavenge. If this parameter is omitted, all servers that host this zone can scavenge it.

Remarks

  • By default, all servers that host a zone can scavenge that zone.

  • If a zone is hosted on more than one DNS server, you can use this command to reduce the number of times a zone is scavenged.

  • Scavenging must be enabled on the DNS server and zone that is affected by this command.

Sample usage

dnscmd dnssvr1.contoso.com /zoneresetscavengeservers test.contoso.com 10.0.0.1 10.0.0.2

dnscmd /zoneresetsecondaries

Specifies a list of IP addresses of secondary servers to which a master server responds when it is asked for a zone transfer.

Syntax

Copy Code
dnscmd [<ServerName>] /zoneresetsecondaries <ZoneName> {/noxfr | /nonsecure | /securens | /securelist <SecurityIPAddresses>} {/nonotify | /notify | /notifylist <NotifyIPAddresses>}

Parameters

<ServerName>

Specifies the DNS server to manage, represented by IP address, FQDN, or host name. If the is parameter is omitted, the local server is used.

<ZoneName>

Specifies the name of the zone that will have its secondary servers reset.

/noxfr | /nonsecure | /securens | /securelist <SecurityIPAddresses>

Specifies whether all or only some of the secondary servers requesting an update get an update.

/noxfr

Specifies that no zone transfers are allowed.

/nonsecure

Specifies that all zone transfer requests are granted.

/securens

Specifies that only the server that is listed in the name server (NS) resource record for the zone is granted a transfer.

/securelist

Specifies that zone transfers are granted only to the list of servers. This parameter must be followed by an IP address or addresses that the master server uses.

<SecurityIPAddresses>

Lists the IP addresses that receive zone transfers from the master server. This parameter is used only with the /securelist parameter.

/nonotify | /notify | /notifylist <NotifyIPAddresses>

Specifies that a change notification is sent only to certain secondary servers:

/nonotify

Specifies that no change notifications are sent to secondary servers.

/notify

Specifies that change notifications are sent to all secondary servers.

/notifylist

Specifies that change notifications are sent to only the list of servers. This command must be followed by an IP address or addresses that the master server uses.

<NotifyIPAddresses>

Specifies the IP address or addresses of the secondary server or servers to which change notifications are sent. This list is used only with the /notifylist parameter.

Remarks

  • Use the zoneresetsecondaries command on the master server to specify how it responds to zone transfer requests from secondary servers.

Sample usage

dnscmd dnssvr1.contoso.com /zoneresetsecondaries test.contoso.com /noxfr /nonotify

dnscmd dnssvr1.contoso.com /zoneresetsecondaries test.contoso.com /securelist 11.0.0.2

dnscmd /zoneresettype

Changes the type of the zone.

Syntax

Copy Code
dnscmd [<ServerName>] /zoneresettype <ZoneName> <ZoneType> [/overwrite_mem | /overwrite_ds]

Parameters

<ServerName>

Specifies the DNS server to manage, represented by local computer syntax, IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

<ZoneName>

Identifies the zone on which the type will be changed.

<ZoneType>

Specifies the type of zone to create. Each type has different required parameters:

/dsprimary

Creates an Active Directory–integrated zone.

/primary /file <FileName>

Creates a standard primary zone.

/secondary <MasterIPAddress> [,<MasterIPAddress>...]

Creates a standard secondary zone.

/stub <MasterIPAddress>[,<MasterIPAddress>...] /file <FileName>

Creates a file-backed stub zone.

/dsstub <MasterIPAddress>[,<MasterIPAddress>...]

Creates an Active Directory–integrated stub zone.

/forwarder <MasterIPAddress[,<MasterIPAddress>]... /file<FileName>

Specifies that the created zone forwards unresolved queries to another DNS server.

/dsforwarder

Specifies that the created Active Directory–integrated zone forwards unresolved queries to another DNS server.

/overwrite_mem | /overwrite_ds

Specifies how to overwrite existing data:

/overwrite_mem

Overwrites DNS data from data in AD DS.

/overwrite_ds

Overwrites existing data in AD DS.

Remarks

  • Setting the zone type as /dsforwarder creates a zone that performs conditional forwarding.

Sample usage

dnscmd dnssvr1.contoso.com /zoneresettype test.contoso.com /primary /file test.contoso.com.dns

dnscmd dnssvr1.contoso.com /zoneresettype second.contoso.com /secondary 10.0.0.2

dnscmd /zoneresume

Starts a specified zone that was previously paused.

Syntax

Copy Code
dnscmd <ServerName> /zoneresume <ZoneName>

Parameters

<ServerName>

Specifies the DNS server to manage, represented by IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

<ZoneName>

Specifies the name of the zone to resume.

Remarks

  • You can use this operation to reverse the zonepause operation.

Sample usage

dnscmd dnssvr1.contoso.com /zoneresume test.contoso.com

dnscmd /zoneupdatefromds

Updates the specified Active Directory–integrated zone from AD DS.

Syntax

Copy Code
dnscmd <ServerName> /zoneupdatefromds <ZoneName>

Parameters

<ServerName>

Specifies the DNS server to manage, represented by IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

<ZoneName>

Specifies the name of the zone to update.

Remarks

  • Active Directory–integrated zones perform this update by default every five minutes. To change this parameter, use the dnscmd config dspollinginterval command.

Sample usage

dnscmd dnssvr1.contoso.com /zoneupdatefromds

dnscmd /zonewriteback

Checks DNS server memory for changes that are relevant to a specified zone, and writes them to persistent storage.

Syntax

Copy Code
dnscmd <ServerName> /zonewriteback <ZoneName>

Parameters

<ServerName>

Specifies the DNS server to manage, represented by IP address, FQDN, or host name. If this parameter is omitted, the local server is used.

<ZoneName>

Specifies the name of the zone to update.

Remarks

  • This is a zone-level operation. You can update all zones on a DNS server with the writebackfiles operation.

Sample usage

dnscmd dnssvr1.contoso.com /zonewriteback test.contoso.com


Doskey

Applies To: Windows Vista,Windows Server 2008

Calls Doskey.exe (which recalls previously entered command-line commands), edits command lines, and creates macros.

For examples of how to use this command, see Examples.

Syntax

Copy Code
doskey [/reinstall] [/listsize=<Size>] [/macros:[all | <ExeName>] [/history] [/insert | /overstrike] [/exename=<ExeName>] [/macrofile=<FileName>] [<MacroName>=[<Text>]]

Parameters

Parameter | Description
/reinstall | Installs a new copy of Doskey.exe and clears the command history buffer.
/listsize=<Size> | Specifies the maximum number of commands in the history buffer.
/macros | Displays a list of all doskey macros. You can use the redirection symbol (>) with /macros to redirect the list to a file. You can abbreviate /macros to /m.
/macros:all | Displays doskey macros for all executables.
/macros:<ExeName> | Displays doskey macros for the executable specified by ExeName.
/history | Displays all commands that are stored in memory. You can use the redirection symbol (>) with /history to redirect the list to a file. You can abbreviate /history as /h.
[/insert | /overstrike] | Specifies whether to insert or overwrite text as you type. If you use /insert, new text that you type on a line is inserted into the midst of the existing text. If you use /overstrike, new text replaces existing text. The default setting is /overstrike.
/exename=<ExeName> | Specifies the program (that is, executable) in which the doskey macro runs.
/macrofile=<FileName> | Specifies a file that contains the macros that you want to install.
<MacroName>=[<Text>] | Creates a macro that carries out the commands specified by Text. MacroName specifies the name you want to assign to the macro. Text specifies the commands you want to record. If Text is left blank, MacroName is cleared of any assigned commands.
/? | Displays help at the command prompt.

Remarks

  • Using Doskey.exe

    Doskey.exe is always available for all character-based, interactive programs (such as program debuggers or file transfer programs), and it maintains a command history buffer and macros for each program that it starts. You cannot use doskey command-line options from a program. You must run doskey command-line options before you start a program. Program key assignments override doskey key assignments.

  • Recalling a command

    To recall a command, you can use any of the following keys after you start Doskey.exe. If you use Doskey.exe within a program, that program's key assignments take precedence.

    Key Description

    UP ARROW

    Recalls the command that you used before the one that is displayed.

    DOWN ARROW

    Recalls the command that you used after the one that is displayed.

    PAGE UP

    Recalls the first command that you used in the current session.

    PAGE DOWN

    Recalls the most recent command that you used in the current session.

  • Editing the command line

    With Doskey.exe, you can edit the current command line. If you use Doskey.exe within a program, that program's key assignments take precedence and some Doskey.exe editing keys might not work.

    The following table lists doskey editing keys and their functions.

    Key or key combination Description

    LEFT ARROW

    Moves the insertion point back one character.

    RIGHT ARROW

    Moves the insertion point forward one character.

    CTRL+LEFT ARROW

    Moves the insertion point back one word.

    CTRL+RIGHT ARROW

    Moves the insertion point forward one word.

    HOME

    Moves the insertion point to the beginning of the line.

    END

    Moves the insertion point to the end of the line.

    ESC

    Clears the command from the display.

    F1

    Copies one character from a column in the template to the same column in the Command Prompt window. (The template is a memory buffer that holds the last command you typed.)

    F2

    Searches forward in the template for the next key that you type after you press F2. Doskey.exe inserts the text from the template—up to, but not including, the character you specify.

    F3

    Copies the remainder of the template to the command line. Doskey.exe begins copying characters from the position in the template that corresponds to the position indicated by the insertion point on the command line.

    F4

    Deletes all characters from the current insertion point position up to, but not including, the next occurrence of the character that you type after you press F4.

    F5

    Copies the template into the current command line.

    F6

    Places an end-of-file character (CTRL+Z) at the current insertion point position.

    F7

    Displays (in a dialog box) all commands for this program that are stored in memory. Use the UP ARROW key and the DOWN ARROW key to select the command you want, and press ENTER to run the command. You can also note the sequential number in front of the command and use this number in conjunction with the F9 key.

    ALT+F7

    Deletes all commands stored in memory for the current history buffer.

    F8

    Displays all commands in the history buffer that start with the characters in the current command.

    F9

    Prompts you for a history buffer command number, and then displays the command associated with the number that you specify. Press ENTER to run the command. To display all the numbers and their associated commands, press F7.

    ALT+F10

    Deletes all macro definitions.

  • Using doskey within a program

    Certain character-based, interactive programs, such as program debuggers or file transfer programs (FTP) automatically use Doskey.exe. To use Doskey.exe, a program must be a console process and use buffered input. Program key assignments override doskey key assignments. For example, if the program uses the F7 key for a function, you cannot get a doskey command history in a pop-up window.

    With Doskey.exe, you can maintain a command history for each program that you start or repeat. You can edit previous commands at the program's prompt, and start doskey macros created for the program. If you exit and then restart a program from the same Command Prompt window, the command history from the previous program session is available.

    You must run Doskey.exe before you start a program. You cannot use doskey command-line options from a program's command prompt, even if the program has a shell command.

    If you want to customize how Doskey.exe works with a program and create doskey macros for that program, you can create a batch program that modifies Doskey.exe and starts the program.

  • Specifying a default Insert mode

    If you press the INSERT key, you can type text on the doskey command line in the midst of existing text without replacing the text. However, after you press ENTER, Doskey.exe returns your keyboard to Replace mode. You must press INSERT again to return to Insert mode.

    Use /insert to switch your keyboard to Insert mode each time you press ENTER. Your keyboard effectively remains in Insert mode until you use /overstrike. You can temporarily return to Replace mode by pressing the INSERT key, but after you press ENTER, Doskey.exe returns your keyboard to Insert mode.

    The insertion point changes shape when you use the INSERT key to change from one mode to the other.

  • Creating a macro

    You can use Doskey.exe to create macros that carry out one or more commands. The following table lists special characters that you can use to control command operations when you define a macro.

    Character Description

    $G or $g

    Redirects output. Use either of these special characters to send output to a device or a file instead of to the screen. This character is equivalent to the redirection symbol for output (>).

    $G$G or $g$g

    Appends output to the end of a file. Use either of these double characters to append output to an existing file instead of replacing the data in the file. These double characters are equivalent to the append redirection symbol for output (>>).

    $L or $l

    Redirects input. Use either of these special characters to read input from a device or a file instead of from the keyboard. This character is equivalent to the redirection symbol for input (<).

    $B or $b

    Sends macro output to a command. These special characters are equivalent to using the pipe (|) on a command line.

    $T or $t

    Separates commands. Use either of these special characters to separate commands when you create macros or type commands on the doskey command line. These special characters are equivalent to using the ampersand (&) on a command line.

    $$

    Specifies the dollar-sign character ($).

    $1 through $9

    Represent any command-line information you want to specify when you run the macro. The special characters $1 through $9 are batch parameters that enable you to use different data on the command line each time you run the macro. The $1 character in a doskey command is similar to the %1 character in a batch program.

    $*

    Represents all the command-line information that you want to specify when you type the macro name. The special character $* is a replaceable parameter that is similar to the batch parameters $1 through $9, with one important difference: everything you type on the command line after the macro name is substituted for the $* in the macro.

  • Running a doskey macro

    To run a macro, type the macro name at the command prompt, starting at the first position. If the macro was defined with $* or any of the batch parameters $1 through $9, use a space to separate the parameters. You cannot run a doskey macro from a batch program.

  • Creating a macro with the same name as a Windows Server 2003 family command

    If you always use a particular command with specific command-line options, you can create a macro that has the same name as the command. To specify whether you want to run the macro or the command, follow these guidelines:

    • To run the macro, type the macro name at the command prompt. Do not add a space before the macro name.

    • To run the command, insert one or more spaces at the command prompt, and then type the command name.

  • Deleting a macro

    To delete a macro, type:

    Copy Code
    doskey <MacroName> =

Examples

The /macros and /history command-line options are useful for creating batch programs to save macros and commands. For example, to store all current doskey macros, type:

Copy Code
doskey /macros > macinit

To use the macros stored in Macinit, type:

Copy Code
doskey /macrofile=macinit

To create a batch program named Tmp.bat that contains recently used commands, type:

Copy Code
doskey /history> tmp.bat

To define a macro with multiple commands, use $t to separate commands, as follows:

Copy Code
doskey tx=cd temp$tdir/w $*

In the preceding example, the TX macro changes the current directory to Temp and then displays a directory listing in wide display format. You can use $* at the end of the macro to append other command-line options to dir when you run TX.

The following macro uses a batch parameter for a new directory name:

Copy Code
doskey mc=md $1$tcd $1

The macro creates a new directory and then changes to the new directory from the current directory.

To use the preceding macro to create and change to a directory named Books, type:

Copy Code
mc books

To create a doskey macro for a program called Ftp.exe, include /exename as follows:

Copy Code
doskey /exename=ftp.exe go=open 172.27.1.100$tmget *.TXT c:\reports$tbye

To use the preceding macro, start FTP. At the FTP prompt, type:

Copy Code
go

FTP runs the open, mget, and bye commands.

To create a macro that quickly and unconditionally formats a disk, type:

Copy Code
doskey qf=format $1 /q /u

To quickly and unconditionally format a disk in drive A, type:

Copy Code
qf a:

To delete a macro called vlist, type:

Copy Code
doskey vlist =

Additional references

Command-Line Syntax Key


Driverquery

Applies To: Windows Server 2008,Windows Vista

Enables an administrator to display a list of installed device drivers and their properties. If used without parameters, driverquery runs on the local computer.

For examples of how to use this command, see Examples.

Syntax

Copy Code
driverquery [/s <System> [/u [<Domain>\]<Username> [/p <Password>]]] [/fo {table | list | csv}] [/nh] [/v | /si]

Parameters

Parameter | Description
/s <System> | Specifies the name or IP address of a remote computer. Do not use backslashes. The default is the local computer.
/u [<Domain>\]<Username> | Runs the command with the credentials of the user account as specified by User or Domain\User. By default, /s uses the credentials of the user who is currently logged on to the computer that is issuing the command. /u cannot be used unless /s is specified.
/p <Password> | Specifies the password of the user account that is specified in the /u parameter. /p cannot be used unless /u is specified.
/fo {table | list | csv} | Specifies the format to display the driver information. Valid values are table, list, and csv. The default format for output is table.
/nh | Omits the header row from the displayed driver information. Not valid if the /fo parameter is set to list.
/v | Displays verbose output. /v is not valid for signed drivers.
/si | Provides information about signed drivers.
/? | Displays help at the command prompt.

Examples

To display a list of installed device drivers on the local computer, type:

Copy Code
driverquery

To display the output in a comma-separated values (CSV) format, type:

Copy Code
driverquery /fo csv

To hide the header row in the output, type:

Copy Code
driverquery /nh

To use the driverquery command on a remote server named server1 using your current credentials on the local computer, type:

Copy Code
driverquery /s server1

To use the driverquery command on a remote server named server1 using the credentials for user1 on the domain maindom, type:

Copy Code
driverquery /s server1 /u maindom\user1 /p p@ssw3d

Additional references

Command-Line Syntax Key


Dsacls

Applies To: Windows Server 2003 with SP1,Windows Server 2008,Windows Server 2003 R2,Windows Server 2003

Displays and changes permissions (access control entries) in the access control list (ACL) of objects in Active Directory Domain Services (AD DS).

Dsacls is a command-line tool that is built into Windows Server 2008. It is available if you have the AD DS server role installed. To use dsacls, you must run the dsacls command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Dsacls is the command-line equivalent of the Security tab in the properties dialog box for an Active Directory object in tools such as Active Directory Users and Computers. You can use either tool to view and change permissions to an Active Directory object.

Note
The access control entries (ACEs) that you add by using dsacls must be object-specific permissions that override the default permissions that are defined in the Active Directory schema for that object type. Do not add ACEs unless you are well-informed about security for Active Directory objects.

To view an ACL, the user must have Read permissions on Active Directory objects. To change an ACL, the user must have Write permissions on the Active Directory object.

Syntax

Copy Code
dsacls "[\\<Computer>\]<ObjectDN>" [/A] [/D <PermissionStatement> [<PermissionStatement>]...] [/G <PermissionStatement> [<PermissionStatement>]...] [/I:{T | S | P}] [/N] [/P:{Y | N}] [/R {<User> | <Group>} [{<User> | <Group>}]...] [/S [/T]] [/?]

Parameters

If you specify an object without additional parameters, Dsacls displays the ACEs in the ACL.

Parameter Description

"[\\<Computer>\]<ObjectDN>"

Identifies the Active Directory object to investigate. Type the distinguished name of the object. To specify an object on a remote computer, type that computer name followed by the distinguished name. This parameter must be enclosed in quotation marks. For example:

"CN=Jeff Akers,CN=Users,DC=domain,DC=test,DC=contoso,DC=com"

or

"\\Server01\CN=Jeff Akers,CN=Users,DC=domain,DC=test,DC=contoso,DC=com"

/A

Adds ownership and auditing information to the results.

/D

Denies the permissions that you specify to the user or group.

You can deny permissions to multiple users in each /D command, for example:

/D Domain1\User1:CCDC Domain1\User2:DC;computer

For more information, see PermissionStatement[PermissionStatement]

/G

Grants the permissions that you specify to the user or group.

You can grant permissions to multiple users in each /G command, for example:

/G Domain1\User1:CCDC Domain1\User2:DC;computer

For more information, see PermissionStatement[PermissionStatement]

/I:{T | S | P}

Specifies the objects to which you are applying the permissions. This parameter determines whether the permissions are inheritable. T is the default.

  • T: The object and its child objects

  • S: The child objects only

  • P: The object and child objects down to one level only (propagate inheritable permissions to one level only)

/N

Provides that the specified ACE replaces the current ACEs in the ACL. By default, dsacls adds the ACE to the ACL.

/P:{Y | N}

Determines whether the object can inherit permissions from its parent objects. If you omit this parameter, the inheritance properties of the object do not change.

  • Y: The object is protected and cannot inherit permissions.

  • N: The object is not protected and can inherit permissions.

Note
This parameter changes a property of the object, not of an ACE. To specify whether an ACE is inheritable, use the /I parameter.

/R {<User> | <Group>} [{<User> | <Group>}].

Deletes all ACEs for the users or groups that you specify. You can specify User as User@Domain or as Domain\User. You can specify Group as Group@Domain or as Domain\Group.

You can delete ACEs for multiple users and groups in a single /R parameter, for example:

/R Domain1\User1 Domain1\User2

/S

Restores the security on the object to the default for that object class as defined in the Active Directory schema.

/T

Restores the security on the tree of objects to the default for each object class. This parameter is valid only with the /S parameter.

/?

Displays help at the command prompt.

Syntax for PermissionStatement

Copy Code
{<User> | <Group>}:<Permissions>[;{<ObjectType> | <Property>}][;<InheritedObjectType>]

Parameters

Parameter Description

{<User> | <Group>}

Specifies the user or group to whom the rights apply. You can specify User as User@Domain or Domain\User. You can specify Group as Group@Domain or Domain\Group.

<Permissions>

Specifies the type of permissions that you are applying. You can specify one or more of the following values (without spaces).

Generic permissions

  • GR: Generic Read

  • GE: Generic Execute

  • GW: Generic Write

  • GA: Generic All

Specific permissions

  • SD: Delete an object.

  • DT: Delete an object and all of its child objects.

  • RC: Read security information.

  • WD: Change security information.

  • WO: Change owner information.

  • LC: List the child objects of the object.

  • CC: Create a child object.

    If you do not specify {ObjectType | Property} to define a specific child object type, this permission applies to all types of child objects; otherwise, it applies only to the child object type that you specify.

  • DC: Delete a child object.

    If you do not specify {ObjectType | Property} to define a specific child object type, this permission applies to all types of child objects; otherwise, it applies only to the child object type that you specify.

  • WS: Write to a self object.

    This is meaningful only on group objects and when {ObjectType | Property} is a "member."

  • RP: Read a property.

    If you do not specify {ObjectType | Property} to define a specific property, this permission applies to all properties of the object; otherwise, it applies only to the property of the object that you specify.

  • WP: Write to a property.

    If you do not specify {ObjectType | Property} to define a specific property, this permission applies to all properties of the object; otherwise, it applies only to the property of the object that you specify.

  • CA: Control access.

    If you do not specify {ObjectType | Property} to define the specific extended right for control access, this permission applies to all meaningful control accesses on the object; otherwise, it applies only to the specific extended right for that object.

  • LO: List the object access.

    You can use this permission to grant list access to a specific object if List Children (LC) is not also granted to the parent object. You can also use this permission to deny access to list an object to hide an object if the user or group has LC permission on the parent object.

    Note
    AD DS does not enforce this permission by default. You must configure AD DS to check for this permission.

{<ObjectType> | <Property>}

Limits the permission to the specified object type or property. Enter the display name of the object type or the property. If you do not specify an object type or property, the permission applies to all object types and properties.

For example, the following command permits the user to create all types of child objects:

/G Domain\User:CC

In contrast, the following command permits the user to create only child computer objects:

/G Domain\User:CC;computer

<InheritedObjectType>

Limits inheritance of the permission to the specified object type. Enter the display name of the object type. If you do not specify an object type, all object types can inherit the permission. You can use this parameter only when permissions are inheritable.

For example, the following command permits all objects types to inherit the permission:

/G Domain\User:CC

In contrast, the following command permits only User objects to inherit the permission:

/G Domain\User:CC;;user

Examples

To grant the permission to delete, read security information, change security information, and change ownership permissions on a User object, type:

Copy Code
SDRCWDWO;;user

To grant permission to create child objects and delete child objects of a Group object, type:

Copy Code
CCDC;group;

To grant permissions to read property and write property values on a Telephonenumber property, type:

Copy Code
RPWP;telephonenumber;

Additional references

Command-Line Syntax Key


Dsadd

Applies To: Windows Server 2003,Windows Server 2003 R2,Windows Server 2008,Windows Server 2003 with SP1

Adds specific types of objects to the directory.

Dsadd is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) server role installed. To use dsadd, you must run the dsadd command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

Commands

Command | Description
Dsadd computer | Adds a single computer to the directory.
Dsadd contact | Adds a single contact to the directory.
Dsadd group | Adds a single group to the directory.
Dsadd ou | Adds a single organizational unit to the directory.
Dsadd user | Adds a single user to the directory.
Dsadd quota | Adds a quota specification to a directory partition.


Dsadd computer

Applies To: Windows Server 2008

Adds a single computer to the directory.

Dsadd is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) or Active Directory Lightweight Directory Services (AD LDS) server role installed. To use dsadd, you must run the dsadd command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsadd computer <ComputerDN> [-samid <SAMName>] [-desc <Description>] [-loc <Location>] [-memberof <GroupDN ...>] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-q] [{-uc | -uco | -uci}]

Parameters

Parameter Description

<ComputerDN>

Required. Specifies the distinguished name of the computer that you want to add. If you omit the distinguished name, dsadd takes the name from standard input (stdin).

-samid <SAMName>

Specifies to use the Security Accounts Manager (SAM) name as the unique SAM account name for this computer, for example, TESTPC2$. If you do not specify this parameter, then dsadd derives a SAM account name from the value of the common name attribute in ComputerDN.

-desc <Description>

Specifies the description of the computer that you want to add.

-loc <Location>

Specifies the location of the computer that you want to add.

-memberof <GroupDN>

Specifies the groups of which you want the computer to be a member.

{-s <Server> | -d <Domain>}

Connects the computer to a server or domain that you specify. By default, dsadd connects the computer to the domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, Linda@widgets.contoso.com)

-p {<Password>| *}

Specifies to use either a password or an asterisk (*) to log on to a remote server. If you type *, dsadd prompts you for a password.

-q

Suppresses all output to standard output (quiet mode).

{-uc | -uco | -uci}

Specifies that dsadd formats output or input data in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

/?

Displays help at the command prompt.

Remarks

  • If you do not supply a target object at the command prompt, dsadd obtains the target object from standard input (stdin). Dsadd can accept stdin from the keyboard, from a redirected file, or as piped output from another command. To mark the end of stdin data from the keyboard or in a redirected file, use the end-of-file character (CTRL+Z).

  • If a value that you supply contains spaces, use quotation marks around the text, for example, "CN=DC 2,OU=Domain Controllers,DC=Contoso,DC=Com".

  • If you supply multiple values for a parameter, use spaces to separate the values, for example, a list of distinguished names.

Examples

To create a computer account named client01 in the default Computers container of northwindtraders.com, type:

Copy Code
dsadd computer cn=client01,cn=computers,dc=northwindtraders,dc=com

Additional references

Command-Line Syntax Key

Dsadd

Dsadd contact

Dsadd group

Dsadd ou

Dsadd user

Dsadd quota


Dsadd contact

Applies To: Windows Server 2008

Adds a single contact to the directory.

Dsadd is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) server role installed. To use dsadd, you must run the dsadd command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsadd contact <ContactDN> [-fn <FirstName>] [-mi <Initial>] [-ln <LastName>] [-display <DisplayName>] [-desc <Description>] [-office <Office>] [-tel <PhoneNumber>] [-email <Email>] [-hometel <HomePhoneNumber>] [-pager <PagerNumber>] [-mobile <CellPhoneNumber>] [-fax <FaxNumber>] [-iptel <IPPhoneNumber>] [-title <Title>] [-dept <Department>] [-company <Company>] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-q] [{-uc | -uco | -uci}]

Parameters

Parameter Description

<ContactDN>

Required. Specifies the distinguished name of the contact that you want to add. If you omit the distinguished name, dsadd takes the name from standard input (stdin).

-fn <FirstName>

Specifies the first name of the contact that you want to add.

-mi <Initial>

Specifies the middle initial of the contact that you want to add.

-ln <LastName>

Specifies the last name of the contact that you want to add.

-display <DisplayName>

Specifies the display name of the contact that you want to add.

-desc <Description>

Specifies the description of the contact you that want to add.

-office <Office>

Specifies the office location of the contact that you want to add.

-tel <PhoneNumber>

Specifies the telephone number of the contact that you want to add.

-email <Email>

Specifies the e-mail address of the contact that you want to add.

-hometel <HomePhoneNumber>

Specifies the home telephone number of the contact that you want to add.

-pager <PagerNumber>

Specifies the pager number of the contact that you want to add.

-mobile <CellPhoneNumber>

Specifies the mobile phone number of the contact that you want to add.

-fax <FaxNumber>

Specifies the fax number of the contact that you want to add.

-iptel <IPPhoneNumber>

Specifies the IP phone number of the contact that you want to add.

-title <Title>

Specifies the title of the contact that you want to add.

-dept <Department>

Specifies the department of the contact that you want to add.

-company <Company>

Specifies the company information of the contact you want to add.

{-s <Server> | -d <Domain>}

Connects to a specified remote server or domain. By default, dsadd connects the computer to the domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, Linda@widgets.contoso.com)

-p {<Password> | *}

Specifies to use either a password or an asterisk (*) to log on to a remote server. If you type *, dsadd prompts you for a password.

-q

Suppresses all output to standard output (quiet mode).

{-uc | -uco | -uci}

Specifies that dsadd formats output or input data in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

/?

Displays help at the command prompt.

Remarks

  • If you do not supply a target object at the command prompt, dsadd obtains the target object from standard input (stdin). Dsadd can accept stdin from the keyboard, from a redirected file, or as piped output from another command. To mark the end of stdin data from the keyboard or in a redirected file, use the end-of-file character (CTRL+Z).

  • If the value that you supply contains spaces, use quotation marks around the text, for example, "CN=Mike Danseglio,CN=Users,DC=Contoso,DC=Com".

  • This command only supports a subset of commonly used object class attributes.

Examples

To create a contact named MikeDan in the default Users container of northwindtraders.com, type:

Copy Code
dsadd contact cn=MikeDan,cn=users,dc=northwindtraders,dc=com

Additional references

Command-Line Syntax Key

Dsadd

Dsadd computer

Dsadd group

Dsadd ou

Dsadd user

Dsadd quota


Dsadd group

Applies To: Windows Server 2008

Adds a single group to the directory.

Dsadd is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) server role installed. To use dsadd, you must run the dsadd command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsadd group <GroupDN> [-secgrp {yes | no}] [-scope {l | g | u}] [-samid <SAMName>] [-desc <Description>] [-memberof <Group> ...] [-members <Member> ...] [{-s Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-q] [{-uc | -uco | -uci}]

Parameters

Parameter Description

<GroupDN>

Required. Specifies the distinguished name of the group that you want to add. If you omit the distinguished name, dsadd takes the name from standard input (stdin).

-secgrp {yes | no}

Specifies whether the group that you want to add is a security group (yes) or a distribution group (no). By default, dsadd adds the group as a security group (yes).

-scope {l | g | u}

Specifies whether the scope of the group that you want to add is domain local (l), global (g), or universal (u). If the domain is in mixed-mode, then AD DS does not support the universal scope. By default, dsadd sets the scope of the group to global.

-samid <SAMName>

Specifies to use the Security Accounts Manager (SAM) name as the unique SAM account name for this group, for example, operators. If you do not specify this parameter, dsadd generates the SAM account name from the relative distinguished name.

-desc <Description>

Specifies the description of the group that you want to add.

-memberof <Group> ...

Specifies other groups of which the new group that you are adding is a member.

-members <Member> ...

Specifies the members to add to the new group.

{-s <Server> | -d Domain}

Connects to a remote server or domain that you specify. By default, dsadd connects the computer to the domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, Linda@widgets.contoso.com)

-p {<Password> | *}

Specifies to use either a password or a an asterisk (*) to log on to a remote server. If you type *, you are prompted for a password.

-q

Suppresses all output to standard output (quiet mode).

{-uc | -uco | -uci}

Specifies that dsadd formats output or input data in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

/?

Displays help at the command prompt.

Remarks

  • If you do not supply a target object at the command prompt, dsadd obtains the target object from standard input (stdin). Dsadd can accept stdin from the keyboard, from a redirected file, or as piped output from another command. To mark the end of stdin data from the keyboard or in a redirected file, use the end-of-file character (CTRL+Z).

  • If a value that you supply contains spaces, use quotation marks around the text, for example, "CN=Mike Danseglio,CN=Users,DC=Contoso,DC=Com".

  • If you supply multiple values for a parameter, use spaces to separate the values, for example, a list of distinguished names.

  • This command only supports a subset of commonly used object class attributes.

Examples

To create a group account named Sales in the default Users container of northwindtraders.com, type:

Copy Code
dsadd group cn=sales,cn=users,dc=northwindtraders,dc=com

To create a universal group named accounting in an organizational unit (OU) named Departments in a domain named northwindtraders.com, type:

Copy Code
dsadd group cn=accounting,ou=departments,dc=northwindtraders,dc=com –scope u

Additional references

Command-Line Syntax Key

Dsadd

Dsadd computer

Dsadd contact

Dsadd ou

Dsadd user

Dsadd quota

Change History

Date | Revision
09/07/2010 | A new example was to add to show how to add a universal group to an OU.


Dsadd ou

Applies To: Windows Server 2008

Adds a single organizational unit (OU) to the directory.

Dsadd is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) server role installed. To use dsadd, you must run the dsadd command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsadd ou <OrganizationalUnitDN> [-desc <Description>] [{-s <Server> | -d <Domain>}][-u <UserName>] [-p {<Password> | *}] [-q] [{-uc | -uco | -uci}]

Parameters

Parameter Description

<OrganizationalUnitDN>

Required. Specifies the distinguished name of the OU that you want to add. If you omit the distinguished name, dsadd takes the name from standard input (stdin).

-desc <Description>

Specifies the description of the OU that you want to add.

{-s <Server> | -d <Domain>}

Connects to a remote server or domain that you specify. By default, dsadd connects the computer to the domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, Linda@widgets.contoso.com)

-p {<Password> | *}

Specifies to use either a password or a asterisk (*) to log on to a remote server. If you type *, you are prompted for a password.

-q

Suppresses all output to standard output (quiet mode).

{-uc | -uco | -uci}

Specifies that dsadd formats output or input data in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

/?

Displays help at the command prompt.

Remarks

  • If you do not supply a target object at the command prompt, dsadd obtains the target object from standard input (stdin). Dsadd can accept stdin from the keyboard, from a redirected file, or as piped output from another command. To mark the end of stdin data from the keyboard or in a redirected file, use the end-of-file character (CTRL+Z).

  • If a value that you supply contains spaces, use quotation marks around the text, for example, "OU=Domain Controllers,DC=Contoso,DC=Com".

  • This command only supports a subset of commonly used object class attributes.

Examples

To create an organizational unit (OU) named Test in the northwindtraders.com, type:

Copy Code
dsadd ou ou=test,dc=northwindtraders,dc=com

Additional references

Command-Line Syntax Key

Dsadd

Dsadd computer

Dsadd contact

Dsadd group

Dsadd user

Dsadd quota


Dsadd user

Applies To: Windows Server 2008

Adds a single user to the directory.

Dsadd is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) server role installed. To use dsadd, you must run the dsadd command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsadd user <UserDN> [-samid <SAMName>] [-upn <UPN>] [-fn <FirstName>] [-mi <Initial>] [-ln <LastName>] [-display <DisplayName>] [-empid <EmployeeID>] [-pwd {<Password> | *}] [-desc <Description>] [-memberof <Group> ...] [-office <Office>] [-tel <PhoneNumber>] [-email <Email>] [-hometel <HomePhoneNumber>] [-pager <PagerNumber>] [-mobile <CellPhoneNumber>] [-fax <FaxNumber>] [-iptel <IPPhoneNumber>] [-webpg <WebPage>] [-title <Title>] [-dept <Department>] [-company <Company>] [-mgr <Manager>] [-hmdir <HomeDirectory>] [-hmdrv <DriveLetter>:][-profile <ProfilePath>] [-loscr <ScriptPath>] [-mustchpwd {yes | no}] [-canchpwd {yes | no}] [-reversiblepwd {yes | no}] [-pwdneverexpires {yes | no}] [-acctexpires <NumberOfDays>] [-disabled {yes | no}] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-q] [{-uc | -uco | -uci}]

Parameters

Parameter Description

<UserDN>

Required. Specifies the distinguished name of the user that you want to add. If you omit the distinguished name, dsadd takes the name from standard input (stdin).

-samid <SAMName>

Specifies the Security Accounts Manager (SAM) name as the unique SAM account name for this user, for example, Linda. If you do not specify the SAM name, dsadd attempts to create the SAM account name by using up to the first 20 characters from the common name (CN) value of UserDN.

-upn <UPN>

Specifies the user principal name of the user that you want to add, for example, Linda@widgets.contoso.com.

-fn <FirstName>

Specifies the first name of the user that you want to add.

-mi <Initial>

Specifies the middle initial of the user that you want to add.

-ln <LastName>

Specifies the last name of the user that you want to add.

-display <DisplayName>

Specifies the display name of the user that you want to add.

-empid <EmployeeID>

Specifies the employee ID of the user that you want to add.

-pwd {<Password>| *}

Specifies that the password for the user be set to Password or an asterisk (*). If you set the password to *, dsadd prompts you for a user password.

-desc <Description>

Specifies the description of the user that you want to add.

-memberof <GroupDN>

Specifies the distinguished names of the groups of which you want the user to be a member.

-office <Office>

Specifies the office location of the user that you want to add.

-tel <PhoneNumbe>r

Specifies the telephone number of the user that you want to add.

-email <Email>

Specifies the e-mail address of the user that you want to add.

-hometel <HomePhoneNumber>

Specifies the home telephone number of the user that you want to add.

-pager <PagerNumber>

Specifies the pager number of the user that you want to add.

-mobile <CellPhoneNumber>

Specifies the cell phone number of the user that you want to add.

-fax <FaxNumber>

Specifies the fax number of the user that you want to add.

-iptel <IPPhoneNumber>

Specifies the IP phone number of the user that you want to add.

-webpg <WebPage>

Specifies the Web page URL of the user that you want to add.

-title <Title>

Specifies the title of the user that you want to add.

-dept <Department>

Specifies the department of the user that you want to add.

-company <Company>

Specifies the company information of the user that you want to add.

-mgr <ManagerDN>

Specifies the distinguished name of the manager of the user that you want to add.

-hmdir <HomeDirectory>

Specifies the home directory location of the user that you want to add. If you specify HomeDirectory as a Universal Naming Convention (UNC) path, then you must specify a drive letter for dsadd to map to this path using the -hmdrv parameter.

-hmdrv <DriveLetter> :

Specifies the home directory drive letter (for example, E:) of the user that you want to add.

-profile <ProfilePath>

Specifies the profile path of the user that you want to add.

-loscr <ScriptPath>

Specifies the logon script path of the user that you want to add.

-mustchpwd {yes | no}

Specifies whether users must change their passwords when they next log on. The available values are yes and no. By default, users do not have to change their passwords (no).

-canchpwd {yes | no}

Specifies whether users can change their passwords. The available values are yes and no. By default, users can change their passwords (yes). The value of this parameter must be yes if the value of the -mustchpwd parameter is yes.

-reversiblepwd {yes | no}

Specifies whether to store user passwords using reversible encryption. The available values are yes and no. By default, users cannot use reversible encryption (no).

-pwdneverexpires {yes | no}

Specifies whether the user password never expires. The available values are yes and no. By default, user passwords expire (no).

-acctexpires <NumberOfDays>

Specifies the number of days from today that the user account will expire. A value of 0 sets expiration at the end of today. A positive value sets expiration in the future. A negative value sets expiration in the past. The value never sets the account to never expire. For example, a value of 0 implies that the account expires at the end of today. A value of -5 implies that the account has already expired 5 days ago and sets an expiration date in the past. A value of 5 sets the account expiration date for 5 days in the future.

-disabled {yes | no}

Specifies whether dsadd disables the user account for logon. The available values are yes or no. For example, the following command creates a Nicolettep user account in an enabled state:

Copy Code
dsadd user CN=Nicolettep,CN=Users,DC=Widgets,DC=Contoso,DC=Com -pwd Password1 -disabled no

By default, the user account is disabled for log on (yes). For example, the following command creates a Nathanp user account in a disabled state:

Copy Code
dsadd user CN=Nathanp,CN=Users,DC=Widgets,DC=Contoso,DC=Com

{-s <Server> | -d <Domain>}

Connects to a specified remote server or domain. By default, the computer is connected to the domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, Linda@widgets.contoso.com)

-p {<Password> | *}

Specifies to use either a password or a * to log on to a remote server. If you type *, you are prompted for a password.

-q

Suppresses all output to standard output (quiet mode).

{-uc | -uco | -uci}

Specifies that output or input data is formatted in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

/?

Displays help at the command prompt.

Remarks

  • If you do not supply a target object at the command prompt, dsadd obtains the target object from standard input (stdin). Dsadd can accept stdin from the keyboard, from a redirected file, or as piped output from another command. To mark the end of stdin data from the keyboard or in a redirected file, use the end-of-file character (CTRL+Z).

  • If a value that you supply contains spaces, use quotation marks around the text, for example, "CN=Mike Danseglio,CN=Users,DC=Contoso,DC=Com".

  • If you supply multiple values for a parameter, use spaces to separate the values, for example, a list of distinguished names.

  • You can use the special token $username$, which is case insensitive, to replace the SAM account name in the value of the -email, -hmdir, -profile, and -webpg parameters. For example, if a SAM account name is Denise, you can write the -hmdir parameter in either of the following formats:

    -hmdir \\users\Denise\home

    -hmdir \\users\$username$\home

  • Using strong passwords on all user accounts helps minimize security risks.

  • In order to set the Remote Desktop Services User Profile, you can use Group Policy. For more information, see Profiles (http://go.microsoft.com/fwlink/?LinkId=201495).

Examples

To create an enabled user account named MikeDan in the default Users container of northwindtraders.com, type:

Copy Code
dsadd user cn=MikeDan,cn=users,dc=northwindtraders,dc=com -disabled no

To create an enabled user account named John Smith with a password of C^h3Bdo9# that must be changed at first logon, in an organizational unit (OU) named SouthEmployees in a domain named northwindtraders.com, type:

Copy Code
dsadd user “cn=John Smith,ou=SouthEmployees,dc=northwindtraders,dc=com” -disabled no –pwd C^h3Bdo9# -mustchpwd yes

To create the same account, with a set it to never expire, and make it a member of the Janitors group in the same OU, type:

Copy Code
dsadd user “cn=John Smith,ou=SouthEmployees,dc=northwindtraders,dc=com” -disabled no –pwd C^h3Bdo9# -mustchpwd yes -memberof cn=janitors,ou=SouthEmployees,dc=northwindtraders,dc=com -acctexpires never

Additional references

Command-Line Syntax Key

Dsadd

Dsadd computer

Dsadd contact

Dsadd group

Dsadd ou

Dsadd quota

Change History

Date | Revision
09/07/2010 | New examples were added to show to set additional parameters


Dsadd quota

Applies To: Windows Server 2008

Adds a quota specification to a directory partition. A quota specification determines the maximum number of directory objects that a given security principal can own in a specified directory partition.

Dsadd is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) or Active Directory Lightweight Directory Services (AD LDS) server role installed. To use dsadd, you must run the dsadd command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsadd quota -part <PartitionDN> [-rdn <RelativeDistinguishedName>] -acct <Name> -qlimit <Value> [-desc <Description>] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-q] [{-uc | -uco | -uci}]

Parameters

Parameter Description

-part <PartitionDN>

Required. Specifies the distinguished name of the directory partition on which you want to create a quota. If you do not specify the distinguished name, dsadd takes the name from standard input (stdin).

-rdn <RelativeDistinguishedName>

Specifies the relative distinguished name of the quota specification that you want to create. If you do not specify -rdn, dsadd sets the name to Domain_AccountName by using the domain and account name of the security principal that the -acct parameter specifies.

-acct <Name>

Required. Specifies the security principal (such as a user, group, or computer object, or an InetOrgPerson object) to whom the quota specification applies. You can use any of the following forms for Name:

  • Distinguished name (also known as DN) of the security principal

  • Domain\SAMAccountName of the security principal

-qlimit <Value>

Required. Specifies the number of objects within the directory partition that the security principal can own. To specify an unlimited quota, use -1.

-desc <Description>

Specifies a description for the quota specification that you want to add.

{-s <Server> | -d <Domain>}

Connects the computer to a specified server or domain. By default, dsadd connects the computer to a domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, Linda@widgets.contoso.com)

-p {<Password>| *}

Specifies to use a specific password or an asterisk (*) to log on to a remote server. If you type *, dsadd prompts you for a password.

-q

Suppresses all output to standard output (quiet mode).

{-uc | -uco | -uci}

Specifies that dsadd formats output or input data in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

/?

Displays help at the command prompt.

Remarks

  • If you do not supply a target object at the command prompt, dsadd obtains the target object from standard input (stdin). Dsadd can accept stdin from the keyboard, from a redirected file, or as piped output from another command. To mark the end of stdin data from the keyboard or in a redirected file, use the end-of-file character (CTRL+Z).

  • If a value that you use contains spaces, use quotation marks around the text, for example, "CN=DC 2,OU=Domain Controllers,DC=Contoso,DC=Com".

Examples

To specify a quota of 1000 objects for the configuration partition for user MikeDan, type:

Copy Code
dsdd quota -part CN=configuration,dc=contoso,dc=com" -acct MikeDan -qlimit 1000

Additional references

Command-Line Syntax Key

Dsadd

Dsadd computer

Dsadd contact

Dsadd group

Dsadd ou

Dsadd user


Dsamain

Applies To: Windows Server 2008

Exposes Active Directory data that is stored in a snapshot or backup as a Lightweight Directory Access Protocol (LDAP) server.

Dsamain.exe is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) or Active Directory Lightweight Directory Services (AD LDS) server role installed. It is also available if you install the Active Directory Domain Services Tools that are part of the Remote Server Administration Tools (RSAT). For more information, see How to Administer Microsoft Windows Client and Server Computers Locally and Remotely (http://go.microsoft.com/fwlink/?LinkID=177813).

To use Dsamain, you must run the dsamain command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsamain /dbpath <filepath> [/logpath <path>] [/adlds] /ldapPort <number> [/sslPort <number>] [/gcport <number>] [/gcSslport <number>] [/allowUpgrade] [/allowNonAdminAccess]

Parameters

Parameter Description

/dbpath <filepath>

Specifies the file path to the database file. <filepath> must point to the database file, which might be on read-only media, such as a mounted snapshot; in a backup; or on another server, such as a domain controller or an AD LDS server. The database must be in a consistent state; that is, the Extensible Storage Engine (ESE) logs must be replayed. If you run the Ntdsutil snapshot subcommand or if you run Windows Server Backup on a server running Windows Server 2008, the resulting snapshot or backup will be in a consistent state.

Note
A snapshot is a shadow copy of the volumes that contain the Active Directory database and log files. A snapshot is created by the Volume Shadow Copy Service (VSS).

/logpath <path>

Specifies the path to a writable folder where the log files are created. If the path is not specified, the TEMP folder is used.

/adlds

Opens an AD LDS database. You must specify this parameter if you are exposing an AD LDS database. You must not specify this parameter if you are exposing an AD DS database or if Dsamain fails.

/ldapPort <number>

Specifies the LDAP port value. Use this same port value when you use a tool such as Ldp.exe to view that data.

Note
LDP is a graphical user interface (GUI)-based utility that you can use for displaying the results of the LDAP operations.

/sslPort <number>

Specifies the Secure Sockets Layer (SSL) port value.

/gcport <number>

Specifies the global catalog port number. This parameter applies only to an AD DS database.

/gcsslport:<number>

Specifies the global catalog SSL port number. This parameter applies only to an AD DS database.

/allowupgrade

Allows an upgrade to the database file. This is useful for opening earlier versions of databases or snapshots. The file must be on writable media.

/allowNonAdminAccess

Allows nonadministrators to access data in the directory. If this option is not specified, only Domain Admins and Enterprise Admins from the target domain can access the data. Use this parameter to expose data from a domain that no longer exists.

quit

Returns to the prior menu.

Help

Displays Help for this command.

?

Displays Help for this command.

Remarks

  • For the dbpath parameter, you must specify a mounted snapshot or a backup that you want to view along with the complete path to the Ntds.dit file, for example:

    Copy Code
    /dbpath E:\$SNAP_200704181137_VOLUMED$\WINDOWS\NTDS\ntds.dit
  • Only the LDAP port is required. If you do not specify the other ports, they use LDAP+1, LDAP+2, and LDAP+3, respectively. For example, if you specify LDAP port 41389 without specifying other port values, the LDAP-SSL port uses port 41390 by default, and so on.

  • You cannot specify ports that are currently in use. If you run the command on a domain controller, specify different ports than those that are used by the local domain controller, for example::

    Copy Code
    dsamain /dbpath <filepath> /ldapport 51389 /sslport 51636 /gcport 53268 /gcsslport 53269
  • Include a space between the name of the parameter and the value that you specify.

  • All permissions that apply to the data in the snapshot or backup are enforced when you view the data.

  • By default, Dsamain allows only members of the Domain Admins and Enterprise Admins groups to view the sensitive data that can be contained in snapshots and backups.

Examples

The following example exposes the data in a snapshot $SNAP_200704181137 as an LDAP server, using LDAP port 51389:

Copy Code
E:\$SNAP_200704181137_VOLUMED$\WINDOWS\NTDS\ntds.dit /ldapport 51389

Additional references

Command-Line Syntax Key

snapshot


Dsdbutil

Applies To: Windows Server 2008,Windows Server 2003 with SP1,Windows Server 2003 R2,Windows Server 2003

Performs database maintenance of the Active Directory Domain Services (AD DS) store, facilitates configuration of Active Directory Lightweight Directory Services (AD LDS) communication ports, and views AD LDS instances that are installed on a computer.

Dsdbutil is a command-line tool that is built into Windows Server 2008. It is available if you have the AD LDS server role installed. To use dsdbutil, you must run the dsdbutil command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For most of the Dsdbutil commands, you only need to type the first few characters of the command name instead than the entire command. For example, you can type either of the following commands to activate an AD LDS instance named instance1:

Copy Code
activate instance instance1
ac i instance1

The short form for each command is listed in the following table.

Commands

Command | Description
Activate Instance %s short form: ac i %s | Sets NTDS or a specific AD LDS instance as the active instance.
authoritative restore Short form: au r | Authoritatively restores the Active Directory database or AD LDS instance.
Change Service Account %s1 %s2 | Changes an AD DS and AD LDS service account to user name %s1 and password %s2. Use NULL for a blank password and an asterisk (*) to enter a password from the console.
files Short form: f | Manages AD DS and AD LDS database files.
ifm Short form: i | Creates installation media for writable (full) and read-only domain controllers (RODCs) and instances of AD LDS.
LDAP port %d | Configures a Lightweight Directory Access Protocol (LDAP) port for an AD LDS instance.
List instances Short form: li i | Lists all AD LDS instances that are installed on this computer.
Popups off Short form: po off | Disables popups.
Popups on Short form: po on | Enables popups.
semantic database analysis Short form: sem d a | Checks semantics.
snapshot Short form: sn | Manages snapshots.
? | Shows help at the command prompt.
Help | Shows help at the command prompt.
Quit | Quits this command.


authoritative restore

Applies To: Windows Server 2003 R2,Windows Server 2003 R2,Windows Server 2003,Windows Server 2003,Windows Server 2008,Windows Server 2008,Windows Server 2003 with SP1,Windows Server 2003 with SP1

Restores domain controllers to a specific point in time, and marks objects in Active Directory as being authoritative with respect to their replication partners.

This is a subcommand of Ntdsutil and Dsdbutil. Ntdsutil and Dsdbutil are command-line tools that are built into Windows Server 2008 and Windows Server 2008 R2. Ntdsutil is available if you have the Active Directory Domain Services (AD DS) or Active Directory Lightweight Directory Services (AD LDS) server role installed. Dsdbutil is available if you have the AD LDS server role installed. These tools are also available if you install the Active Directory Domain Services Tools that are part of the Remote Server Administration Tools (RSAT). For more information, see How to Administer Microsoft Windows Client and Server Computers Locally and Remotely (http://go.microsoft.com/fwlink/?LinkID=177813).

To use either of these tools, you must run them from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

In forests that have a functional level of Windows Server 2003, Windows Server 2003 interim, or Windows Server 2008, this subcommand also restores back-links for links that were created after the functional level was raised. For example, the member attributes of groups to which a restored user object belongs are updated. The authoritative restore subcommand creates an LDAP Data Interchange Format (LDIF) file that can be used to restore back-links for links that were created before the functional level was raised.

At the authoritative restore: prompt, type any of the parameters listed under “Syntax.”

For examples of how to use this command, see Examples.

Syntax

Copy Code
{create ldif file(s) from %s | list nc crs | restore object %s | restore object verinc %d |restore subtree %s | restore subtree %s verinc %d}

Parameters

Parameter Description

create ldif file(s) from %s

This option creates an LDIF file of link updates from the Ntdsutil-generated text file that is named in %s. This file can be used to update back-links on objects in a domain other than the domain of the restored object. For example, this file can be used to restore group membership for a user where the group belongs to a different domain than the user.

List NC CRs

Lists partitions and cross-references. You need the cross-reference of an application directory partition to restore it.

%d

A numeric value that overrides the default value of 100,000. The version number of the object or database being authoritatively restored will be increased by this value times the number of days since backup.

restore object %s

Marks object %s as being authoritative. This option also generates a text file that contains the distinguished name of the restored object and an LDIF file that can be used to restore back-links for objects that are being authoritatively restored (such as group memberships of users).

restore object %s verinc %d

Marks object %s as being authoritative and updates links as described in restore object %s; also increments the version number by %d times the number of days since backup. Use this option only to authoritatively restore over a previous, incorrect authoritative restore, such as an authoritative restore from a backup that contains the problem that you want to restore.

restore subtree %s

Marks subtree %s (and all children of the subtree) as being authoritative. This option also generates a text file that contains the distinguished names of the restored objects and an LDIF file that can be used to restore back-links for objects that are being authoritatively restored (such as group memberships of users).

restore subtree %s verinc %d

Marks subtree %s (and all children of the subtree) as being authoritative and updates links as described in restore subtree %s; also increments the version number by %d times the number of days since backup. Use this option only to authoritatively restore over a previous, incorrect authoritative restore, such as an authoritative restore from a backup that contains the problem that you want to restore.

Toggle recycled objects flag

Note
This parameter is available only if Active Directory Recycle Bin is enabled.

Sets the flag to allow undeletion or authoritative restore of recycled objects.

This is not recommended and can result in lost linked values after undeletion or authoritative restore.

%s

An alphanumeric variable, either a distinguished name for a restored object or subtree, or a file name for a text file that is used to create an LDIF file.

quit

Takes you back to the previous menu, or exits the utility.

?

Displays Help at the command prompt.

Help

Displays Help at the command prompt.

Remarks

  • Before you can run the authoritative restore subcommand, you need to set NTDS or an AD LDS instance as the active instance for Ntdsutil. For example, if the AD LDS instance that you want to restore is named instance 1, type the following command at the ntdsutil: prompt before you run the authoritative restore subcommand, and then press ENTER:

    Copy Code
    ac in instance 1
  • You need to stop the AD DS or AD LDS service before you can run the authoritative restore subcommand. To stop AD DS, click Start, click Server Manager. In the console tree, double-click Configuration, and then click Services. In the details pane, right-click Active Directory Domain Services, and then click Stop.

  • When you are restoring a domain controller by using backup and restore programs, such as Windows Server Backup or those from other providers, the default mode for the restore is nonauthoritative. This means that the restored server is brought up to date with its replicas through the normal replication mechanism. For example, if a domain controller is restored from a backup tape that is two weeks old, when you restart it, the normal replication mechanism brings it up to date with respect to its replication partners.

  • You might have to perform an authoritative restore if an administrator inadvertently deletes an organizational unit (OU) containing a large number of users. If you restore the server from tape, the normal replication process would not restore the inadvertently deleted OU. Authoritative restore allows you to mark the OU as authoritative and force the replication process to restore it to all the other domain controllers in the domain.

  • Ntdsutil does not correctly handle special characters, such as the apostrophe character ('), that you can enter at the ntdsutil: prompt at the command line. In some situations, there may be an alternative workaround. For more information, see local roles (http://go.microsoft.com/fwlink/?LinkId=157320).

Examples

To list the directory partitions on a domain controller and their cross-references, type the following command, and then press ENTER:

Copy Code
authoritative restore: list nc crs

Additional references

Command-Line Syntax Key

Dsdbutil

Ntdsutil

configurable settings

DS behavior

files

group membership evaluation

ifm

LDAP policies

local roles

metadata cleanup

partition management

roles

security account management

semantic database analysis

set DSRM password

snapshot


files

Applies To: Windows Server 2003,Windows Server 2003,Windows Server 2003 R2,Windows Server 2003 R2,Windows Server 2008,Windows Server 2008,Windows Server 2003 with SP1,Windows Server 2003 with SP1

Provides commands for managing the directory service data and log files. The data file is called Ntds.dit. At the files: prompt, type any of the parameters listed under “Syntax.”

This is a subcommand of Ntdsutil and Dsdbutil. Ntdsutil and Dsdbutil are command-line tools that are built into Windows Server 2008 and Windows Server 2008 R2. Ntdsutil is available if you have the Active Directory Domain Services (AD DS) or Active Directory Lightweight Directory Services (AD LDS) server role installed. Dsdbutil is available if you have the AD LDS server role installed. These tools are also available if you install the Active Directory Domain Services Tools that are part of the Remote Server Administration Tools (RSAT). For more information, see How to Administer Microsoft Windows Client and Server Computers Locally and Remotely (http://go.microsoft.com/fwlink/?LinkID=177813).

To use either of these tools, you must run them command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
[checkpoint] [checksum] [compact to %s] [dump page %d] [header] [info] [integrity] [logfile %s] [metadata] [move DB to %s] [move logs to %s] [recover] [set backup exclusion key] [set default folder security] [set path backup %s] [set path db %s] [set path logs %s] [set path working dir %s] [space usage]

Parameters

Parameter | Description
checkpoint | Dumps the Jet database checkpoint file (edb.chk). This option is intended for use only by support personnel.
checksum | Performs Jet database physical integrity check.
compact to %s (where %s identifies an empty target directory) | Invokes Esentutl.exe to compact the existing data file and writes the compacted file to the specified directory. The directory can be remote, that is, mapped by means of the net use command or similar means. After compaction is complete, archive the old data file and move the newly compacted file back to the original location of the data file. ESENT supports online compaction, but this compaction only rearranges pages within the data file and does not release space back to the file system. (The directory service invokes online compaction regularly.)
dump page %d | Dumps the Jet database page number specified as %d. This option is intended for use only by support personnel.
header | Writes the header of the Ntds.dit data file to the screen. This command can help support personnel analyze database problems.
info | Analyzes and reports the free space for the disks that are installed in the system, reads the registry, and then reports the sizes of the data and log files. (The directory service maintains the registry, which identifies the location of the data files, log files, and directory service working directory.)
integrity | Invokes Esentutl.exe to perform an integrity check on the data file, which can detect low-level database corruption. It reads every byte of your data file; thus it can take a long time to process large databases. Note that you should always run Recover before performing an integrity check.
logfile %s | Dumps the Jet log file %s, where %s can be the absolute path or just the log file name in the Logs folder. This option is intended for use only by support personnel.
metadata | Dumps the Jet database metadata. This option is intended for use only by support personnel.
move DB to %s (where %s identifies a target directory) | Moves the Ntds.dit data file to the new directory specified by %s and updates the registry so that, upon service restart, the directory service uses the new location.
move logs to %s (where %s identifies a target directory) | Moves the directory service log files to the new directory specified by %s, and updates the registry so that, upon service restart, the directory service uses the new location.
recover | Invokes Esentutl.exe to perform a soft recovery of the database. Soft recovery scans the log files and ensures all committed transactions therein are also reflected in the data file. Logs are used to ensure committed transactions are not lost if your system fails or if you have unexpected power loss. In essence, transaction data is written first to a log file and then to the data file. When you restart after failure, you can rerun the log to reproduce the transactions that were committed but hadn't made it to the data file.
set backup exclusion key | Sets the backup exclusion key for the AD DS or AD LDS instance. This option is intended for use only by support personnel.
set default folder security | Resets security on the NTDS folder to default values.
set path backup %s (where %s identifies a target directory) | Sets the disk-to-disk backup target to the directory specified by %s. The directory service can be configured to perform an online, disk-to-disk backup at scheduled intervals.
set path db %s (where %s identifies a target directory) | Updates the part of the registry that identifies the location and file name of the data file. Use this command only to rebuild a domain controller that has lost its data file and that is not being restored by means of normal restoration procedures.
set path logs %s (where %s identifies a target directory) | Updates the part of the registry that identifies the location of the log files. Use this command only if you are rebuilding a domain controller that has lost its log files and is not being restored by means of normal restoration procedures.
set path working dir %s (where %s identifies a target directory) | Sets the part of the registry that identifies the directory service's working directory to the directory specified by %s.
%s | An alphanumeric variable, such as a domain or domain controller name.
space usage | Dumps the Jet database space usage.
quit | Takes you back to the previous menu or exits the utility.
? | Displays Help at the command prompt.
Help | Displays Help at the command prompt.

Remarks

  • Before you can run the files subcommand, set NTDS or an AD LDS instance as the active instance for Ntdsutil. For example, if the AD LDS instance that you want to restore is named instance 1, type the following command at the ntdsutil: prompt before you run the authoritative restore subcommand, and then press ENTER:

    Copy Code
    ac in instance 1
  • You must stop the AD DS or AD LDS service before you can run the files subcommand. To stop AD DS, click Start, click Server Manager. In the console tree, double-click Configuration, and then click Services. In the details pane, right-click Active Directory Domain Services, and then click Stop.

  • AD DS is implemented on top of an indexed sequential access method (ISAM) table manager. This is the same table manager used by Microsoft Exchange Server, File Replication Service (FRS), the security configuration editor, Active Directory Certificate Services (AD CS), Windows Internet Name Service (WINS), and other Windows components. The version of the database that Windows 2000, Windows Server 2003, and Windows Server 2008 use is called the extensible storage engine (ESENT).

    ESENT is a transacted database system that uses log files to support rollback semantics to ensure that transactions are committed to the database. Ideally, the database and log files should be located on separate drives to improve performance and support recovery of the data if a disk fails.

  • ESENT provides its own tool for certain database file management functions, called Esentutl.exe, which is also installed in the systemroot\System32 folder. Several of the Ntdsutil file management commands invoke Esentutl, reducing the need to learn the tool's command-line arguments. In the cases where Ntdsutil invokes Esentutl, it brings up a separate window configured with a large history so that you can scroll back to see all of the Esentutl progress indicators.

  • Ntdsutil does not correctly handle special characters, such as the apostrophe character ('), that you can enter at the ntdsutil: prompt at the command line. In some situations, there may be an alternative workaround. For more information, see local roles (http://go.microsoft.com/fwlink/?LinkId=157320).

Examples

To perform a Jet database physical integrity check, type the following command, and then press ENTER:

Copy Code
file maintenance: checksum

To compact the Active Directory database and write the compacted file to a folder named C:\Windows\NTDS_Old, type the following command, and then press ENTER:

Copy Code
file maintenance: compact to C:\Windows\NTDS_Old

Additional references

Command-Line Syntax Key

Dsdbutil

Ntdsutil

authoritative restore

configurable settings

DS behavior

group membership evaluation

ifm

LDAP policies

local roles

metadata cleanup

partition management

roles

security account management

semantic database analysis

set DSRM password

snapshot


ifm

Applies To: Windows Server 2008,Windows Server 2008

Creates installation media for writable (full) domain controllers, read-only domain controllers (RODCs), and instances of Active Directory Lightweight Directory Services (AD LDS).

This is a subcommand of Ntdsutil and Dsdbutil. Ntdsutil and Dsdbutil are command-line tools that are built into Windows Server 2008 and Windows Server 2008 R2. Ntdsutil is available if you have the Active Directory Domain Services (AD DS) or AD LDS server role installed. Dsdbutil is available if you have the AD LDS server role installed. These tools are also available if you install the Active Directory Domain Services Tools that are part of the Remote Server Administration Tools (RSAT). For more information, see How to Administer Microsoft Windows Client and Server Computers Locally and Remotely (http://go.microsoft.com/fwlink/?LinkID=177813).

To use either of these tools, you must run them from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

Before you run ifm, you must set an active instance of a directory that Ntdsutil is to use. You can either specify "ntds" to set AD DS as the active instance or you can specify the name of an AD LDS instance. For more information about how to set an active instance, see Ntdsutil.

For more information, see Installing AD DS from Media (http://go.microsoft.com/fwlink/?LinkID=132630).

For examples of how to use this command, see Examples.

Syntax

Copy Code
ifm {create full %s | create rodc %s | create sysvol full %s | create sysvol rodc %s} [quit]

Parameters

Parameter | Description
create full %s | Creates installation media for a writable Active Directory domain controller or an AD LDS instance in the %s folder. You can specify only this parameter for an AD LDS instance.
create rodc %s | Creates installation media for an RODC in the %s folder. You can use this command only with AD DS.
Create Sysvol Full %s In order for the additional domain controller to use the SYSVOL folder on the IFM media as a replication source during the installation, you must run this command on a domain controller that runs Windows Server 2008 with SP2 or later or Windows Server 2008 R2. | Creates installation media for a writable domain controller with SYSVOL in the %s folder.
Create Sysvol RODC %s In order for the additional domain controller to use the SYSVOL folder on the IFM media as a replication source during the installation, you must run this command on a domain controller that runs Windows Server 2008 with SP2 or later or Windows Server 2008 R2. | Creates installation media for an RODC with SYSVOL in the %s folder.
quit | Returns to the prior menu.
Help | Displays Help for this command.
? | Displays Help for this command.

Remarks

  • For more about generating installation media and using it to install an additional domain controller, see Installing an Additional Domain Controller by Using IFM (http://go.microsoft.com/fwlink/?LinkId=185231).

  • You can run the ifm subcommand on a writable domain controller to create installation media for an RODC. Ntdsutil removes any cached secrets, such as passwords, from RODC installation media. You can also create installation media for an RODC by running the ifm subcommand on another RODC in that domain. However, to generate installation media for a writable domain controller, you must use another writable domain controller as the source of the installation media.

  • You cannot run the ifm subcommand on a domain controller that runs Windows Server 2003. You cannot use a domain controller that runs Windows Server 2003 to create installation media for a domain controller that runs Windows Server 2008, or the reverse.

  • You can use a 32-bit domain controller that runs Windows Server 2008 to generate installation media for a 64-bit domain controller that runs Windows Server 2008, and the reverse.

  • If the folder name contains spaces, enclose the path to the folder within quotation marks.

  • The full AD DS installation media includes the registry.

  • The AD LDS installation media includes only the Adamntds.dit file in the specified folder.

  • When you create installation media for a domain controller, the ifm subcommand stores the installation media in a subfolder named Active Directory after the subcommand completes. You must specify this same subfolder name when you install AD DS on another domain controller.

  • The IFM process creates a temp database in the %TMP% folder. You need at least 110% of the size of the AD DS or AD LDS database free on the drive where the %TMP% folder is in order for the operation to succeed. You can redirect the %TMP% folder to another disk on the server in order to use more space.

  • Ntdsutil does not correctly handle special characters, such as the apostrophe character ('), that you can enter at the ntdsutil: prompt at the command line. In some situations, there may be an alternative workaround. For more information, see local roles (http://go.microsoft.com/fwlink/?LinkId=157320).

Examples

The following example creates RODC installation in a folder named Installation Media on drive C:

Copy Code
create rodc "C:\Installation Media"

The following example creates writable domain controller installation media in a folder named InstallationMedia on drive C:

Copy Code
create full C:\InstallationMedia

Additional references

Command-Line Syntax Key

Dsdbutil

Ntdsutil

authoritative restore

configurable settings

DS behavior

files

group membership evaluation

LDAP policies

local roles

metadata cleanup

partition management

roles

security account management

semantic database analysis

set DSRM password

snapshot


semantic database analysis

Applies To: Windows Server 2003 R2,Windows Server 2003 R2,Windows Server 2003,Windows Server 2003,Windows Server 2008,Windows Server 2008,Windows Server 2003 with SP1,Windows Server 2003 with SP1

Verifies the integrity of Active Directory Domain Services (AD DS) or Active Directory Lightweight Directory Services (AD LDS) database files with respect to Active Directory semantics. At the semantic checker: prompt, type any of the parameters that are listed under “Syntax.”

This is a subcommand of Ntdsutil and Dsdbutil. Ntdsutil and Dsdbutil are command-line tools that are built into Windows Server 2008 and Windows Server 2008 R2. Ntdsutil is available if you have the AD DS or AD LDS server role installed. Dsdbutil is available if you have the AD LDS server role installed. These tools are also available if you install the Active Directory Domain Services Tools that are part of the Remote Server Administration Tools (RSAT). For more information, see How to Administer Microsoft Windows Client and Server Computers Locally and Remotely (http://go.microsoft.com/fwlink/?LinkID=177813).

To use either of these tools, you must run them from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
[get %d] [{go | go fixup}] [verbose %s] [{check quota | rebuild quota}]

Parameters

Parameter | Description
check quota | Integrity-checks the quota-tracking table (object owner quotas). This command checks whether the quota table is correct by trying to open the quota-tracking table and getting column information for each predefined column name.
get %d | Retrieves record number %d from the Ntds.dit.
go | Starts the semantic analysis of the Ntds.dit or AD LDS instance with no fixup. A report is generated and written to a file named Dsdit.dmp.n, in the current directory, where n is an integer that is incremented each time that you carry out the command.
go fixup | Starts the semantic checker with fixup.
verbose %s | Toggles verbose mode on or off.
rebuild quota | Forces asynchronous rebuild of the quota-tracking table.
%d | A numeric variable, such as replication delay time periods.
quit | Takes you back to the previous menu, or exits the utility.
? | Displays Help at the command prompt.
Help | Displays Help at the command prompt.

Remarks

  • Unlike the file management commands described earlier, which test the integrity of the database with respect to the ESENT database semantics, the semantic analysis analyzes the data with respect to Active Directory semantics. It generates reports on the number of records present, including deleted and phantom records.

    Note
    End users should not use this command except when Microsoft requests them to use it as an aid to fault diagnosis.

  • Before you can run the semantic database analysis subcommand, you need to set NTDS or an AD LDS instance as the active instance for Ntdsutil. For example, if the AD LDS instance that you want to restore is named instance1, type the following command at the ntdsutil: prompt before you run the authoritative restore subcommand:

    Copy Code
    ac in instance1
  • You have to stop the AD DS or AD LDS service before you can run the semantic database analysis subcommand. To stop AD DS, click Start, click Server Manager. In the console tree, double-click Configuration, and then click Services. In the details pane, right-click Active Directory Domain Services, and then click Stop.

  • Ntdsutil does not correctly handle special characters, such as the apostrophe character ('), that you can enter at the ntdsutil: prompt at the command line. In some situations, there may be an alternative workaround. For more information, see local roles (http://go.microsoft.com/fwlink/?LinkId=157320).

Examples

To turn on verbose mode logging, type the following command, and then press ENTER:

Copy Code
semantic checker: verbose on

To start the semantic analysis of the Ntds.dit with no fixup, type the following command, and then press ENTER:

Copy Code
semantic checker: go

Additional references

Command-Line Syntax Key

Dsdbutil

Ntdsutil

authoritative restore

configurable settings

DS behavior

files

group membership evaluation

ifm

LDAP policies

local roles

metadata cleanup

partition management

roles

security account management

set DSRM password

snapshot


snapshot

Applies To: Windows Server 2008,Windows Server 2008

Manages snapshots of the volumes that contain the Active Directory database and log files, which you can view on a domain controller without starting in Directory Services Restore Mode (DSRM). You can also run the snapshot subcommand on an Active Directory Lightweight Directory Services (AD LDS) server.

In the command-line tool Ntdsutil.exe, you can use the snapshot subcommand to manage the snapshots, but you must use Dsamain.exe to expose the snapshot as a Lightweight Directory Access Protocol (LDAP) server. For more information about using Dsamain, see Dsamain.

This is a subcommand of Ntdsutil and Dsdbutil. Ntdsutil and Dsdbutil are command-line tools that are built into Windows Server 2008 and Windows Server 2008 R2. Ntdsutil is available if you have the Active Directory Domain Services (AD DS) or AD LDS server role installed. Dsdbutil is available if you have the AD LDS server role installed. These tools are also available if you install the Active Directory Domain Services Tools that are part of the Remote Server Administration Tools (RSAT). For more information, see How to Administer Microsoft Windows Client and Server Computers Locally and Remotely (http://go.microsoft.com/fwlink/?LinkID=177813).

To use either of these tools, you must run them from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
activate instance %s [create] [delete %s] [unmount %s] [list all] [list mounted ] [mount %s] [quit]

Parameters

Parameter | Description
activate instance %s | Sets an active instance for the command. You can either specify "ntds" to set AD DS as the active instance or you can specify the name of an AD LDS instance.
create | Creates a snapshot.
delete %s | Deletes a snapshot with globally unique identifier (GUID) %s. Use * to delete all snapshots.
list all | Lists all mounted snapshots. You can run this command to obtain an index number for a mounted snapshot. You can then use the index number, instead of a GUID, to mount or unmount a snapshot.
list mounted | Lists mounted snapshots. You can run this command to obtain an index number for a mounted snapshot. You can then use the index number instead of a GUID to mount or unmount a snapshot.
mount %s | Mounts a snapshot with GUID %s. You can refer to an index number of any mounted snapshot instead of its GUID.
unmount %s | Unmounts a snapshot with GUID %s. Use * to unmount all mounted snapshots.
quit | Returns to the prior menu.
Help | Displays Help for this command.
? | Displays Help for this command.

Remarks

  • Before you can run the snapshot subcommand, you must run the activate instance subcommand in Ntdsutil to set an active instance. For examples of how to set an active instance, see Examples.

  • You are not required to run the snapshot subcommand to use Dsamain.exe. Instead, you can use a backup of the AD DS or AD LDS database or another domain controller or AD LDS server. Running the snapshot subcommand simply provides convenient data input for Dsamain.exe.

  • You should protect snapshots in a manner that is similar to how you protect domain controller backups. For example, use encryption or other data security precautions with AD DS snapshots to help mitigate the chance of unauthorized access to them.

  • When you use Dsamain.exe to expose the data that is contained in a snapshot:

    • All permissions that apply to the data in the snapshot are enforced.

    • By default, only members of the Domain Admins group and the Enterprise Admins group are allowed to view a snapshot because it can contain sensitive AD DS data.

  • Ntdsutil does not correctly handle special characters, such as the apostrophe character ('), that you can enter at the ntdsutil: prompt at the command line. In some situations, there may be an alternative workaround. For more information, see local roles (http://go.microsoft.com/fwlink/?LinkId=157320).

Examples

The following example sets NTDS as the active instance:

Copy Code
ntdsutil: activate instance ntds

The following example is another way to set NTDS as the active instance:

Copy Code
ntdsutil: ac in ntds

The following example mounts a snapshot that has the GUID 8ec8ff74-c0d7-435a-b6b1-54ef185926be:

Copy Code
snapshot: mount {8ec8ff74-c0d7-435a-b6b1-54ef185926be}

The following example unmounts the same snapshot:

Copy Code
snapshot: unmount {8ec8ff74-c0d7-435a-b6b1-54ef185926be}

The following example lists the mounted snapshots:

Copy Code
snapshot: list mounted

Additional references

Command-Line Syntax Key

Dsamain

Dsdbutil

Ntdsutil

authoritative restore

configurable settings

DS behavior

files

group membership evaluation

ifm

LDAP policies

local roles

metadata cleanup

partition management

roles

security account management

semantic database analysis

set DSRM password


Dsget

Applies To: Windows Server 2003,Windows Server 2003 R2,Windows Server 2003 with SP1,Windows Server 2008

Displays the selected properties of a specific object in the directory.

Dsget is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) server role installed. To use dsget, you must run the dsget command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

Commands

Command | Description
Dsget computer | Displays the properties of a computer in the directory. There are two variations of this command. The first variation allows you to view the properties of multiple computers. The second variation allows you to view the membership information of a single computer.
Dsget contact | Displays the various properties of a contact in the directory.
Dsget group | Displays the various properties of a group including the members of a group in the directory. There are two variations of this command. The first variation allows you to view the properties of multiple groups. The second variation allows you to view the group membership information of a single group.
Dsget ou | Displays the various properties of an organizational unit in the directory.
Dsget server | Displays the various properties of a domain controller defined in the directory. There are three variations of this command. The first variation displays the general properties of a domain controller that you specify. The second variation displays a list of the security principals who own the largest number of directory objects on the domain controller that you specify. The third variation displays the distinguished names of the directory partitions on the server that you specify.
Dsget user | Displays the properties of a user in the directory. There are two variations of this command. The first variation allows you to view the properties of multiple users. The second variation allows you to view the group membership information of a single user.
Dsget subnet | Displays the properties of a subnet that is defined in the directory.
Dsget site | Displays the properties of a site that is defined in the directory.
Dsget quota | Displays the properties of a quota specification that is defined in the directory. A quota specification determines the maximum number of directory objects that a given security principal can own in a specific directory partition.
Dsget partition | Displays the properties of a directory partition.


Dsget computer

Applies To: Windows Server 2008

Displays the properties of a computer in the directory. There are two variations of this command. The first variation displays the properties of multiple computers. The second variation displays the membership information of a single computer.

Dsget is a command-line tool that is built into Windows Server 2008. It is available if you have the AD DS server role installed. To use dsget, you must run the dsget command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsget computer <ComputerDN> [-dn] [-samid] [-sid] [-desc] [-loc] [-disabled] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-c] [-q] [-l] [{-uc | -uco | -uci}] [-part <PartitionDN> [-qlimit] [-qused]]
dsget computer <ComputerDN> [-memberof [-expand]] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-c] [-q] [-l] [{-uc | -uco | -uci}]

Parameters

Parameter Description

<ComputerDN> (first variation)

Required. Specifies the distinguished names of the computer object list that you want to view. If values are omitted, they are obtained through standard input (stdin) to support piping of output from another command to input of this command. Compare this parameter with ComputerDN in the second variation.

-dn

Displays the distinguished names of the computers.

-samid

Displays the Security Account Manager (SAM) account names of the computers that you specify.

-sid

Displays the computer security IDs (SIDs).

-desc

Displays the descriptions of the computers.

-loc

Displays the locations of the computers.

-disabled

Displays the status of the computer accounts. Yes indicates that the account is disabled and no indicates that the account is enabled.

<ComputerDN> (second variation)

Required. Specifies the distinguished name of the single computer you want to view.

-memberof

Displays the immediate list of groups of which the computer is a member. This takes a single target object only as input parameter (the second variation of the dsget computer command).

-expand

Displays the recursively expanded list of groups of which the computer is a member. This option takes the immediate group membership list of the computer, as returned by the -memberof parameter, and then recursively expands each group in this list to determine its group memberships as well to arrive at a complete closure set of the groups.

{-s <Server>| -d <Domain>}

Connects the computer to a remote server or domain that you specify. By default, dsget connects the computer to the domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, Linda@widgets.contoso.com)

-p {<Password> | *}

Specifies to use either a password or an asterisk (*) to log on to a remote server. If you type *, dsget prompts you for a password.

-c

Reports errors, but continues with the next object in the argument list when you specify multiple target objects (continuous operation mode). If you do not supply this parameter, dsget exits when the first error occurs.

-q

Suppresses all output to standard output (quiet mode).

-l

Displays entries in a list format. By default, dsget displays entries in a table format.

{-uc | -uco | -uci}

Specifies that dsget formats output or input data in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

-part <PartitionDN>

Connects to the directory partition with the distinguished name of PartitionDN.

-qlimit

Displays the effective quota of the computer in the directory partition that you specify for the -part parameter.

-qused

Displays how much of its quota a computer has used in the directory partition that you specify for the -part parameter.

/?

Displays help at the command prompt.

Remarks

  • If you do not supply a target object at the command prompt, dsget obtains the target object from standard input (stdin). Dsget can accept stdin from the keyboard, from a redirected file, or as piped output from another command. To mark the end of stdin data from the keyboard or in a redirected file, use the end-of-file character (CTRL+Z).

  • Use dsget to view the properties of a specific object in the directory.

  • As a result of dsquery searches, you can pipe returned objects to dsget and obtain object properties.

  • If a value that you supply contains spaces, use quotation marks around the text, for example, "CN=DC2,OU=Domain Controllers,DC=Contoso,DC=Com".

  • If you supply multiple values for a parameter, use spaces to separate the values, for example, a list of distinguished names.

Examples

To display the descriptions of all computers in an organizational unit (OU) named Test whose name starts with "tst", type:

Copy Code
dsquery computer OU=Test,DC=Contoso,DC=Com -name tst* | dsget computer -desc

To display the list of groups, recursively expanded, to which the MyDBServer computer belongs, type:

Copy Code
dsget computer CN=MyDBServer,CN=computers,DC=Contoso,DC=Com -memberof -expand

Additional references

Command-Line Syntax Key

Dsget

Dsget contact

Dsget group

Dsget ou

Dsget server

Dsget user

Dsget subnet

Dsget site

Dsget quota

Dsget partition


Dsget contact

Applies To: Windows Server 2008

Displays the properties of a contact in the directory.

Dsget is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) server role installed. To use dsget, you must run the dsget command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsget contact <ContactDN> [-dn] [-fn] [-mi] [-ln] [-display] [-desc] [-office] [-tel] [-email] [-hometel] [-pager] [-mobile] [-fax] [-iptel] [-title] [-dept] [-company] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-c] [-q] [-l] [{-uc | -uco | -uci}]

Parameters

Parameter Description

<ContactDN>

Required. Specifies the distinguished names of the contact objects that you want to view. If this parameter is omitted, its value is taken from standard input (stdin) to support piping of output from another command to input of this command.

-dn

Displays the distinguished names of the contacts.

-fn

Displays the first names of the contacts.

-mi

Displays the middle initials of the contacts.

-ln

Displays the last names of the contacts.

-display

Displays the display names of the contacts.

-desc

Displays the descriptions of the contacts.

-office

Displays the office locations of the contacts.

-tel

Displays the telephone numbers of the contacts.

-email

Displays the e-mail addresses of the contacts.

-hometel

Displays the home telephone numbers of the contacts.

-pager

Displays the pager numbers of the contacts.

-mobile

Displays the mobile phone numbers of the contacts.

-fax

Displays the fax numbers of the contacts.

-iptel

Displays the IP phone number of the contact.

-title

Displays the titles of the contacts.

-dept

Displays the departments of the contacts.

-company

Displays the company information of the contacts.

{-s <Server>| -d <Domain>}

Connects to a remote server or domain that you specify. By default, dsget connects the computer to the domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, Linda@widgets.contoso.com)

-p {<Password> | *}

Specifies to use either a password or an asterisk (*) to log on to a remote server. If you type *, dsget prompts you for a password.

-c

Reports errors, but continues with the next object in the argument list when you specify multiple target objects (continuous operation mode). If you do not specify this parameter, dsget contact exits when the first error occurs.

-q

Suppresses all output to standard output (quiet mode).

-l

Displays entries in a list. By default, dsget displays entries in a table.

{-uc| -uco| -uci}

Specifies that dsget formats output or input data in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

/?

Displays help at the command prompt.

Remarks

  • If you do not supply a target object at the command prompt, dsget obtains the target object from standard input (stdin). Dsget can accept stdin from the keyboard, from a redirected file, or as piped output from another command. To mark the end of stdin data from the keyboard or in a redirected file, use the end-of-file character (CTRL+Z).

  • Use dsget to view the properties of a specific object in the directory.

  • As a result of dsquery searches, you can pipe returned objects to dsget and obtain object properties.

  • If a value that you supply contains spaces, use quotation marks around the text, for example, "CN=Mike Danseglio,OU=Contacts,DC=Contoso,DC=Com".

  • If you supply multiple values for a parameter, use spaces to separate the values, for example, a list of distinguished names.

Examples

To display the description and phone numbers for contacts Mike Danseglio and Don Funk, type:

Copy Code
dsget contact "CN=Mike Danseglio,OU=Contacts,DC=Contoso,DC=Com" "CN=Don Funk,OU=Contacts,DC=Contoso,DC=Com" -desc -tel

Additional references

Command-Line Syntax Key

Dsget

Dsget computer

Dsget group

Dsget ou

Dsget server

Dsget user

Dsget subnet

Dsget site

Dsget quota

Dsget partition


Dsget group

Applies To: Windows Server 2008

Displays the properties of a group in the directory, including its members. There are two variations of this command. The first variation allows you to view the properties of multiple groups. The second variation displays the group membership information of a single group.

Dsget is a command-line tool that is built into Windows Server 2008. It is available if you have the AD DS server role installed. To use dsget, you must run the dsget command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsget group <GroupDN> [-dn] [-samid] [-sid] [-desc] [-secgrp] [-scope] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-c] [-q] [-l] [{-uc | -uco | -uci}] [-part <PartitionDN> [-qlimit] [-qused]]
dsget group <GroupDN> [{-memberof | -members}] [-expand] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-c] [-q] [-l] [{-uc | -uco | -uci}]

Parameters

Parameter Description

<GroupDN> (first variation)

Required. Specifies the distinguished names of the group objects that you want to view. If values are omitted, they are obtained through standard input (stdin) to support piping of output from another command to input of this command. Compare this parameter with GroupDN in the second variation.

-dn

Displays that distinguished names of the groups.

-samid

Displays the Security Account Manager (SAM) account names of the groups.

-sid

Displays the group security IDs (SIDs).

-desc

Displays the descriptions of the groups.

-secgrp

Displays whether groups are security groups (yes) or distribution groups (no).

-scope

Displays information about whether group scopes are local, global, or universal.

<GroupDN> (second variation)

Required. Specifies the distinguished name of the group that you want to view.

{-memberof | -members}

Displays the immediate list of groups of which the group is a member (-memberof) or displays the immediate list of members of the group (-members).

-expand

For the -memberof parameter, displays the recursively expanded list of groups in which the group is a member. This option takes the immediate membership list of the group, and then also recursively expands each group in this list to determine its group memberships to arrive at a complete closure set of the groups.

For the -members parameter, displays the recursively expanded list of members of the group. This parameter takes the immediate list of members of the group and then also recursively expands each group in this list to determine its group memberships to arrive at a complete closure set of the members.

{-s <Server>| -d <Domain>}

Connects to a remote server or domain that you specify. By default, dsget connects the computer to the domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, Linda@widgets.contoso.com)

-p {<Password> | *}

Specifies to use either a password or an asterisk (*) to log on to a remote server. If you type *, dsget prompts you for a password.

-c

Reports errors, but continues with the next object in the argument list when you specify multiple target objects (continuous operation mode). If you do not supply this parameter, dsget group exits when the first error occurs.

-q

Suppresses all output to standard output (quiet mode).

-l

Displays entries in a list. By default, dsget display entries in a table.

{-uc| -uco| -uci}

Specifies that dsget formats output or input data in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

-part <PartitionDN>

Connects a computer to the directory partition with the distinguished name of PartitionDN.

-qlimit

Displays the effective quota of the group within the directory partition that you specify for the -part parameter.

-qused

Displays how much of its quota a group has used in the directory partition that you specify for the -part parameter.

/?

Displays help at the command prompt.

Remarks

  • If you do not supply a target object at the command prompt, dsget obtains the target object from standard input (stdin). Dsget can accept stdin from the keyboard, from a redirected file, or as piped output from another command. To mark the end of stdin data from the keyboard or in a redirected file, use the end-of-file character (CTRL+Z)..

  • Use dsget to view the properties of a specific object in the directory.

  • As a result of dsquery searches, you can pipe returned objects to dsget and obtain object properties.

  • If a value that you supply contains spaces, use quotation marks around the text, for example, "CN=USA Sales,OU=Distribution Lists,DC=Contoso,DC=Com".

  • If you supply multiple values for a parameter, use spaces to separate the values, for example, a list of distinguished names.

Examples

To display the descriptions of all groups in an organizational unit (OU) named Test whose names start with "adm," type:

Copy Code
dsquery group OU=Test,DC=Contoso,DC=Com -name adm* | dsget group -desc

To display the list of members, recursively expanded, of the Backup Operators group, type:

Copy Code
dsget group "CN=Backup Operators,OU=Test,DC=Contoso,DC=Com" -members -expand

Additional references

Command-Line Syntax Key

Dsget

Dsget computer

Dsget contact

Dsget ou

Dsget server

Dsget user

Dsget subnet

Dsget site

Dsget quota

Dsget partition


Dsget ou

Applies To: Windows Server 2008

Displays the properties of an organizational unit (OU) in the directory.

Dsget is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) server role installed. To use dsget, you must run the dsget command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsget ou <OrganizationalUnitDN> ...[-dn] [-desc] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-c] [-q] [-l] [{-uc | -uco | -uci}]

Parameters

Parameter Description

<OrganizationalUnitDN>

Required. Specifies the distinguished names of the organizational units that you want to view. If values are omitted, they are obtained through standard input (stdin) to support piping of output from another command to input of this command.

-dn

Displays the distinguished names of the OUs.

-desc

Displays the descriptions of the OUs.

{-s <Server>| -d <Domain>}

Connects to a remote server or domain that you specify. By default, dsget connects the computer to the domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, Linda@widgets.contoso.com)

-p{<Password> | *}

Specifies to use either a password or an asterisk (*) to log on to a remote server. If you type *, dsget prompts you for a password.

-c

Reports errors, but continues with the next object in the argument list when you specify multiple target objects (continuous operation mode). If you do not supply this parameter, dsget exits when the first error occurs.

-q

Suppresses all output to standard output (quiet mode).

-l

Displays entries in a list. By default, dsget displays entries in a table.

{-uc | -uco| -uci}

Specifies that dsget formats output or input data in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

/?

Displays help at the command prompt.

Remarks

  • If you do not supply a target object at the command prompt, dsget obtains the target object from standard input (stdin). Dsget can accept stdin from the keyboard, from a redirected file, or as piped output from another command. To mark the end of stdin data from the keyboard or in a redirected file, use the end-of-file character (CTRL+Z).

  • Use dsget to view the properties of a specific object in the directory.

  • As a result of dsquery searches, you can pipe returned objects to dsget and obtain object properties.

  • If a value that you supply contains spaces, use quotation marks around the text, for example, "OU=Domain Controllers,DC=Contoso,DC=Com".

  • If you supply multiple values for a parameter, use spaces to separate the values, for example, a list of distinguished names.

Examples

To display the descriptions of all OUs in the current domain, type:

Copy Code
dsquery ou domainroot | dsget ou -desc

Additional references

Command-Line Syntax Key

Dsget

Dsget computer

Dsget contact

Dsget group

Dsget server

Dsget user

Dsget subnet

Dsget site

Dsget quota

Dsget partition


Dsget server

Applies To: Windows Server 2008

Displays the properties of a domain controller defined in the directory. There are three variations of this command. The first variation displays the general properties of a domain controller that you specify. The second variation displays a list of the security principals that own the largest number of directory objects on the domain controller that you specify. The third variation displays the distinguished names of the directory partitions on the server that you specify.

Dsget is a command-line tool that is built into Windows Server 2008. It is available if you have the AD DS server role installed. To use dsget, you must run the dsget command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsget server <ServerDN> [-dn] [-desc] [-dnsname] [-site] [-isgc] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-c] [-q] [-l] [{-uc | -uco | -uci}]
dsget server <ServerDN> [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-c] [-q] [-l] [{-uc | -uco | -uci}] [-topobjowner <Display>]
dsget server <ServerDN> [{-s <Server> | -d <Domain>}][-u <UserName>] [-p {<Password> | *}] [-c] [-q] [-l] [{-uc | -uco | -uci}][-part <PartitionDN>]

Parameters

Parameter Description

<ServerDN>

Required. Specifies the list of server object distinguished names to view. If values are omitted, they are obtained through standard input (stdin) to support piping of output from another command to input of this command.

-dn

Displays the distinguished names of the servers.

-desc

Displays the descriptions of the servers.

-dnsname

Displays the Domain Name System (DNS) host names of the servers.

-site

Displays the site name to which the server belongs.

-isgc

Displays whether a server is a global catalog server (yes) or not (no).

{-s <Server>| -d <Domain>}

Connects a computer to a remote server or domain that you specify. By default, dsget connects the computer to the domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, Linda@widgets.contoso.com)

-p {<Password> | *}

Specifies to use either a password or an asterisk (*) to log on to a remote server. If you type *, dsget prompts you for a password.

-c

Reports errors, but continues with the next object in the argument list when you specify multiple target objects (continuous operation mode). If you do not supply this parameter, dsget exits when the first error occurs.

-q

Suppresses all output to standard output (quiet mode).

-l

Displays entries in a list. By default, dsget displays entries in a table.

{-uc| -uco| -uci}

Specifies that dsget formats output or input data in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

-part <PartitionDN>

Connects to the directory partition with the distinguished name of PartitionDN.

-topobjowner <Display>

Displays a sorted list of the security principals (such as users, computers, security groups, and inetOrgPersons) that own the largest number of directory objects across all directory partitions on the server and the number of directory objects that they own. The number of accounts to display in the list is specified by Display. To display all object owners, use 0 as the value of this parameter. If you do not specify Display, the number of principals that this parameter lists is 10 by default.

/?

Displays help at the command prompt.

Remarks

  • If you do not supply a target object at the command prompt, dsget obtains the target object from standard input (stdin). Dsget can accept stdin from the keyboard, from a redirected file, or as piped output from another command. To mark the end of stdin data from the keyboard or in a redirected file, use the end-of-file character (CTRL+Z).

  • Use dsget to view the properties of a specific object in the directory.

  • As a result of dsquery searches, you can pipe returned objects to dsget and obtain object properties.

  • If a value that you supply contains spaces, use quotation marks around the text, for example, "CN=My Server,CN=Servers,CN=Site10,CN=Sites,CN=Configuration,DC=Contoso,DC=Com".

  • If you supply multiple values for a parameter, use spaces to separate the values, for example, a list of distinguished names.

  • If either -part or -topobjowner is specified, they override any other specified parameters, so that only the results of the -part or -topobjowner parameter are shown.

Examples

To find all domain controllers for domain widgets.contoso.com and then display their DNS host names and site names, type:

Copy Code
dsquery server -domain widgets.contoso.com | dsget server -dnsname -site

To see if a domain controller named DC1 is also a global catalog server, type:

Copy Code
dsget server CN=DC1,CN=Servers,CN=Site10,CN=Sites,CN=Configuration,DC=Contoso,DC=Com -isgc

To show the distinguished names of the directory partitions on a domain controller named DC1, type:

Copy Code
dsget server CN=DC1,CN=Servers,CN=Site10,CN=Sites,CN=Configuration,DC=Contoso,DC=Com -part

To show the top five security principals that own the most objects on the domain controller DC1.widgets.contoso.com, type:

Copy Code
dsget server CN=DC1,CN=widgets,DC=Contoso,DC=com -topobjowner 5

Additional references

Command-Line Syntax Key

Dsget

Dsget computer

Dsget contact

Dsget group

Dsget ou

Dsget user

Dsget subnet

Dsget site

Dsget quota

Dsget partition


Dsget user

Applies To: Windows Server 2008

Displays the properties of a user in the directory. There are two variations of this command. The first variation displays the properties of multiple users. The second variation displays the group membership information of a single user.

Dsget is a command-line tool that is built into Windows Server 2008. It is available if you have the AD DS server role installed. To use dsget, you must run the dsget command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsget user <UserDN> [-dn] [-samid] [-sid] [-upn] [-fn] [-mi] [-ln] [-display] [-empid] [-desc] [-office] [-tel] [-email] [-hometel] [-pager] [-mobile] [-fax] [-iptel] [-webpg] [-title] [-dept] [-company] [-mgr] [-hmdir] [-hmdrv] [-profile] [-loscr] [-mustchpwd] [-canchpwd] [-pwdneverexpires] [-disabled] [-acctexpires] [-reversiblepwd] [{-uc | -uco | -uci}] [-part <PartitionDN> [-qlimit] [-qused]]
dsget user <UserDN> [-memberof] [-expand][{-uc | -uco | -uci}]

Parameters

Parameter Description

<UserDN> (first variation)

Required. Displays the distinguished names of the user objects that you want to view. If values are omitted, they are obtained through standard input (stdin) to support piping of output from another command to input of this command. Compare this parameter with UserDN in the second variation.

-dn

Displays the distinguished names of the users.

-samid

Displays the Security Account Manager (SAM) account names of the users.

-sid

Displays the user security identifiers (SIDs).

-upn

Displays the user principal names (UPNs) of the users.

-fn

Displays the first names of the users.

-mi

Displays the middle initials of the users.

-ln

Displays the last names of the users.

-display

Displays the display names of the users.

-empid

Displays the employee IDs of the users.

-desc

Displays the descriptions of the users.

-full

Displays the full names of the users.

-office

Displays the office locations of the users.

-tel

Displays the telephone numbers of the users.

-email

Displays the e-mail addresses of the users.

-hometel

Displays the home telephone numbers of the users.

-pager

Displays the pager numbers of the users.

-mobile

Displays the mobile phone numbers of the users.

-fax

Displays the fax numbers of the users.

-iptel

Displays the user IP phone numbers.

-webpg

Displays the user Web page URLs.

-title

Displays the titles of the users.

-dept

Displays the departments of the users.

-company

Displays the company information of the users.

-mgr

Displays the managers of the users.

-hmdir

Displays the drive letter to which the home directory of the user is mapped to if the home directory path is a UNC path.

-hmdrv

Displays the user's home drive letter if home directory is a UNC path.

-profile

Displays the user profile paths.

-loscr

Displays the user logon script paths.

-mustchpwd

Displays whether users must change their passwords at the time of next logon (yes) or not (no).

-canchpwd

Displays whether users can change their password (yes) or not (no).

-pwdneverexpires

Displays whether the user passwords never expires (yes) or not (no).

-disabled

Displays whether user accounts are disabled for logon (yes) or not (no).

-acctexpires

Displays the dates when user accounts expire. If the accounts never expire, this command returns never.

-reversiblepwd

Displays whether the user passwords are allowed to be stored using reversible encryption (yes) or not (no).

<UserDN> (second variation)

Required. Displays the distinguished name of the user whose group membership you want to view.

-memberof

Displays the immediate list of groups of which the user is a member.

-expand

Displays the recursively expanded list of groups of which the user is a member. This option takes the immediate group membership list of the user, and then recursively expands each group in this list to determine its group memberships as well to arrive at a complete closure set of the groups.

{-uc| -uco| -uci}

Specifies that dsget formats output or input data in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

-part <PartitionDN>

Connects a computer to the directory partition with the distinguished name of PartitionDN.

-qlimit

Displays the effective quota of the user within the directory partition that you specify with the -part parameter.

-qused

Displays how much of the quota the user has used within the specified directory partition that you specify with the -part parameter.

/?

Displays help at the command prompt.

Remarks

  • If you do not supply a target object at the command prompt, dsget obtains the target object from standard input (stdin). Dsget can accept stdin from the keyboard, from a redirected file, or as piped output from another command. To mark the end of stdin data from the keyboard or in a redirected file, use the end-of-file character (CTRL+Z).

  • Use dsget to view the properties of a specific object in the directory.

  • As a result of dsquery searches, you can pipe returned objects to dsget and obtain object properties.

  • The -canchpwd parameter estimates whether a user can change his password based on the way that it interprets the access control lists (ACLs) on the user object. To know for certain whether a user can change a password, that user must try to change it. This non-authoritative answer is not specific to dsget user. It is also inherent in the User Properties dialog box in Active Directory Users and Computers in Microsoft Management Console (MMC).

  • If you do not specify property parameters for dsget user, the default user properties that appear are distinguished name, SAM account name, and description.

  • If you specify the -memberof parameter, it overrides all other parameters and only the membership list for the user appears.

  • To find users whose passwords are set to never expire, you can use Windows PowerShell. For more information, see Finding Users Whose Passwords Never Expire (http://go.microsoft.com/fwlink/?LinkID=200044).

Examples

To find all users in an organizational unit (OU) named Test whose name starts with "jon" and to show their descriptions, type:

Copy Code
dsquery user OU=Test,dc=ms,dc=tld -name jon* | dsget user -desc

To show the list of groups, recursively expanded, to which the user Mike Danseglio belongs, type:

Copy Code
dsget user "CN=Mike Danseglio,CN=users,dc=ms,dc=tld" -memberof -expand

Additional references

Command-Line Syntax Key

Dsget

Dsget computer

Dsget contact

Dsget group

Dsget ou

Dsget server

Dsget subnet

Dsget site

Dsget quota

Dsget partition

Change History

Date | Revision
August 19, 2010 | Added a link to more information about how to use Windows PowerShell to find users who have passwords set to never expire.


Dsget subnet

Applies To: Windows Server 2008

Displays the properties of a subnet in the directory.

Dsget is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) server role installed. To use dsget, you must run the dsget command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsget subnet <SubnetDN> [-dn] [-desc] [-loc] [-site] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-c] [-q] [-l] [{-uc | -uco | -uci}]

Parameters

Parameter Description

<SubnetDN>

Required. Specifies the common names of one or more subnets that you want to view.

-dn

Displays the distinguished names of the subnets. If values are omitted, they are obtained through standard input (stdin) to support piping of output from another command to input of this command.

-desc

Displays the descriptions of the subnets.

-loc

Displays the subnet locations.

-site

Displays the site names associated with the subnets.

{-s <Server>| -d <Domain>}

Connects to a remote server or domain that you specify. By default, dsget connects the computer to the domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, Linda@widgets.contoso.com)

-p{<Password> | *}

Specifies to use either a password or an asterisk (*) to log on to a remote server. If you type *, dsget prompts you for a password.

-c

Reports errors, but continues with the next object in the argument list when you specify multiple target objects (continuous operation mode). If you do not specify this parameter, dsget exits when the first error occurs.

-q

Suppresses all output to standard output (quiet mode).

-l

Displays entries in a list. By default, dsget displays entries in a table.

{-uc| -uco| -uci}

Specifies that dsget formats output or input data in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

/?

Displays help at the command prompt.

Remarks

  • If you do not supply a target object at the command prompt, dsget obtains the target object from standard input (stdin). Dsget can accept stdin from the keyboard, from a redirected file, or as piped output from another command. To mark the end of stdin data from the keyboard or in a redirected file, use the end-of-file character (CTRL+Z).

  • Use dsget to view the properties of a specific object in the directory.

  • As a result of dsquery searches, you can pipe returned objects to dsget and obtain object properties.

  • If you supply multiple values for a parameter, use spaces to separate the values, for example, a list of subnet common names.

Examples

To display all properties for the subnets 206.73.118.0/24 and 207.209.68.0/24, type:

Copy Code
dsget subnet "206.73.118.0/24" "207.209.68.0/24"

Additional references

Command-Line Syntax Key

Dsget

Dsget computer

Dsget contact

Dsget group

Dsget ou

Dsget server

Dsget user

Dsget site

Dsget quota

Dsget partition


Dsget site

Applies To: Windows Server 2008

Displays the properties of a site in the directory.

Dsget is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) server role installed. To use dsget, you must run the dsget command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsget site <SiteCN> [-dn] [-desc] [-autotopology] [-cachegroups] [-prefGCsite] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-c] [-q] [-l] [{-uc | -uco | -uci}]

Parameters

Parameter Description

<SiteCN>

Required. Specifies the common name of one or more sites that you want to view. If values are omitted, they are obtained through standard input (stdin) to support piping of output from another command to input of this command.

-dn

Displays the distinguished names of the sites.

-desc

Displays the descriptions of the sites.

-autotopology

Displays whether automatic intersite topology generation is enabled (yes) or disabled (no) for specified sites.

-cachegroups

Displays whether caching of universal group memberships for this site is enabled (yes) or disabled (no) to support logons that do not check the global catalog.

-prefGCsite

Displays the name of the preferred global catalog site used to refresh universal group membership caching for the domain controllers of this site, if universal group membership caching has been enabled.

{-s <Server>| -d <Domain>}

Connects a computer to a remote server or domain that you specify. By default, dsget connects the computer to the domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, Linda@widgets.contoso.com)

-p{<Password> | *}

Specifies to use either a password or an asterisk (*) to log on to a remote server. If you type *, dsget prompts you for a password.

-c

Reports errors, but continues with the next object in the argument list when you specify multiple target objects (continuous operation mode). If you do not supply this parameter, dsget exits when the first error occurs.

-q

Suppresses all output to standard output (quiet mode).

-l

Displays entries in a list. By default, dsget displays entries in a table.

{-uc| -uco| -uci}

Specifies that dsget formats output or input data in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

/?

Displays help at the command prompt.

Remarks

  • If you do not supply a target object at the command prompt, dsget obtains the target object from standard input (stdin). Dsget can accept stdin from the keyboard, from a redirected file, or as piped output from another command. To mark the end of stdin data from the keyboard or in a redirected file, use the end-of-file character (CTRL+Z).

  • Use dsget to view the properties of a specific object in the directory.

  • As a result of dsquery searches, you can pipe returned objects to dsget and obtain object properties.

  • If a value that you supply contains spaces, use quotation marks around the text, for example, "CN=Site 10,CN=Configuration,DC=Contoso,DC=Com".

  • If you supply multiple values for a parameter, use spaces to separate the values, for example, a list of distinguished names.

Examples

To find all sites in the forest and display their descriptions, type:

Copy Code
dsquery site | dsget site -dn -desc

Additional references

Command-Line Syntax Key

Dsget

Dsget computer

Dsget contact

Dsget group

Dsget ou

Dsget server

Dsget user

Dsget subnet

Dsget quota

Dsget partition


Dsget quota

Applies To: Windows Server 2008

Displays the properties of a quota specification defined in the directory. A quota specification determines the maximum number of directory objects that a security principal can own in a directory partition that you specify.

Dsget is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) server role installed. To use dsget, you must run the dsget command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsget quota <ObjectDN> [-dn] [-acct] [-qlimit] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-c] [-q] [-l] [{-uc | -uco | -uci}]

Parameters

Parameter Description

<ObjectDN>.

Required. Specifies the distinguished names of the quota objects to view. If values are omitted, they are obtained through standard input (stdin) to support piping of output from another command to input of this command.

-dn

Displays the distinguished names of the quota objects.

-acct

Displays the distinguished names of the accounts to which the quotas are assigned.

-qlimit

Displays the quota limits for the specified quotas. An unlimited quota appears as "-1".

{-s <Server>| -d <Domain>}

Connects a computer to a remote server or domain that you specify. By default, dsget connects the computer to the domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, Linda@widgets.contoso.com)

-p{<Password> | *}

Specifies to use either a password or an asterisk (*) to log on to a remote server. If you type *, dsget prompts you for a password.

-c

Reports errors, but continues with the next object in the argument list when you specify multiple target objects (continuous operation mode). If you do not supply this parameter, dsget exits when the first error occurs.

-q

Suppresses all output to standard output (quiet mode).

-l

Displays entries in a list. By default, dsget displays entries in a table.

{-uc| -uco| -uci}

Specifies that dsget formats output or input data in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

/?

Displays help at the command prompt.

Remarks

  • If you do not supply a target object at the command prompt, dsget obtains the target object from standard input (stdin). Dsget can accept stdin from the keyboard, from a redirected file, or as piped output from another command. To mark the end of stdin data from the keyboard or in a redirected file, use the end-of-file character (CTRL+Z).

  • If you do not specify any of the optional parameters, dsget displays the distinguished names of the quota specifications, the accounts to which the quotas are assigned, and the quota limits.

  • Use dsget to view the properties of a specific object in the directory.

  • As a result of dsquery searches, you can pipe returned objects to dsget and obtain object properties.

  • If a value that you use contains spaces, use quotation marks around the text, for example, "quota 1,dc=marketing,dc=northwindtraders,dc=com ".

  • If you use multiple values for a parameter, use spaces to separate the values, for example, a list of distinguished names.

Examples

To display the account to which the quota is assigned, and the quota limit for the quota specification "CN=quota 1,dc=marketing,dc=northwindtraders,dc=com", type:

Copy Code
dsget quota "CN=quota 1,dc=marketing,dc=northwindtraders,dc=com" -acct -qlimit

Additional references

Command-Line Syntax Key

Dsget

Dsget computer

Dsget contact

Dsget group

Dsget ou

Dsget server

Dsget user

Dsget subnet

Dsget site

Dsget partition


Dsget partition

Applies To: Windows Server 2008

Displays the properties of a directory partition.

Dsget is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) server role installed. To use dsget, you must run the dsget command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsget partition <ObjectDN> ... [-dn] [-qdefault] [-qtmbstnwt] [-topobjowner <Display>] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-c] [-q] [-l] [{-uc | -uco | -uci}]

Parameters

Parameter Description

<ObjectDN>

Required. Specifies the distinguished names of the partition objects to view. If values are omitted, they are obtained through standard input (stdin) to support piping of output from another command to input of this command.

-dn

Displays the distinguished names of the directory partition objects.

-qdefault

Displays the default quota that applies to any security principal (for example, user, group, computer, or iNetOrg person) If no specific quota specification governs that security principal, dsget partition creates an object in the directory partition. An unlimited quota appears as "-1".

-qtmbstnwt

Displays the percent by which the tombstone object count should be reduced when calculating quota usage.

-topobjowner <Display>

Displays a sorted list of the security principals that own the most objects in the specified directory partition This parameter also displays the number of directory objects that those security principals own. Display specifies the number of accounts to display in the list. To display all object owners, use 0 as the value of this parameter. If you do not specify Display, the number of principals that this parameter list defaults to 10.

{-s <Server>| -d <Domain>}

Connects a computer to a remote server or domain that you specify. By default, dsget connects the computer to the domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, Linda@widgets.contoso.com)

-p{ <Password> | *}

Specifies to use either a password or an asterisk (*) to log on to a remote server. If you type *, dsget prompts you for a password.

-c

Reports errors, but continues with the next object in the argument list when you specify multiple target objects (continuous operation mode). If you do not supply this parameter, dsget exits when the first error occurs.

-q

Suppresses all output to standard output (quiet mode).

-l

Displays entries in a list. By default, dsget displays entries in a table.

{-uc| -uco| -uci}

Specifies that dsget formats output or input data in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

/?

Displays help at the command prompt.

Remarks

  • If you do not supply a target object at the command prompt, dsget obtains the target object from standard input (stdin). Dsget can accept stdin from the keyboard, from a redirected file, or as piped output from another command. To mark the end of stdin data from the keyboard or in a redirected file, use the end-of-file character (CTRL+Z).

  • When none of the optional parameters is specified, the distinguished name of the directory partition object is displayed.

  • If you specify -topobjowner, that parameter overrides any other parameters that you specify. Consequently, dsget displays only the results of -topobjowner.

  • Use dsget to view the properties of a specific object in the directory.

  • As a result of dsquery searches, you can pipe returned objects to dsget and obtain object properties.

  • If a value that you use contains spaces, use quotation marks around the text.

  • If you use multiple values for a parameter, use spaces to separate the values, for example, a list of distinguished names.

Examples

To display all directory partitions in the forest northwindtraders.com that begin with "application", and to display the top three object owners from each partition, type:

Copy Code
dsquery server -forest -part application* | dsget server -part | dsget partition -topjobowner 3

Additional references

Command-Line Syntax Key

Dsget

Dsget computer

Dsget contact

Dsget group

Dsget ou

Dsget server

Dsget user

Dsget subnet

Dsget site

Dsget quota


Dsmgmt

Applies To: Windows Server 2008,Windows Server 2003 with SP1,Windows Server 2003 R2,Windows Server 2003

Facilitates managing Active Directory Lightweight Directory Services (AD LDS) application partitions, managing and controlling flexible single master operations (FSMO), and cleaning up metadata that is left behind by abandoned Active Directory domain controllers and AD LDS instances. (Abandoned domain controllers and AD LDS instances are those that are removed from the network without being uninstalled.)

Dsmgmt is a command-line tool that is built into Windows Server 2008. It is available if you have the AD LDS server role installed. To use dsmgmt, you must run the dsmgmt command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For most of the dsmgmt commands, you only need to type the first few characters of the command name instead than the entire command. For example, you can type either of the following commands to manage configurable settings:

Copy Code
configurable settings
co s

The short form for each command is listed in the following table.

Commands

Command | Description
configurable settings Short form: co s | Manages configurable settings.
DS behavior Short form: ds b | Views and modifies AD DS and AD LDS behavior.
group membership evaluation Short form: g m e | Evaluates SIDs in a token for a specified user or group.
LDAP policies | Manages LDAP protocol policies.
local roles Short form: lo r | Manages local administrative roles on a read-only domain controller (RODC).
metadata cleanup Short form: m c | Cleans up objects of decommissioned servers.
partition management Short form: pa m | Manages directory partitions.
Popups off Short form: po off | Disables popups.
Popups on Short form: po on | Enables popups.
roles Short form: r | Manages operations master roles.
security account management Short form: sec a m | Manages Security Account Database and duplicate SID cleanup.
set DSRM password Short form: set d p | Resets the Directory Services Restore Mode (DSRM) administrator password.
? | Displays help at the command prompt.
Help | Displays help at the command prompt.
Quit | Quits dsmgmt.


configurable settings

Applies To: Windows Server 2008,Windows Server 2008,Windows Server 2003 with SP1,Windows Server 2003 with SP1,Windows Server 2003,Windows Server 2003,Windows Server 2003 R2,Windows Server 2003 R2

Aids in modifying the time to live (TTL) of dynamic data that is stored in Active Directory Domain Services (AD DS). At the configurable setting: prompt, type any of the parameters listed under Syntax.

This is a subcommand of Ntdsutil and Dsmgmt. Ntdsutil and Dsmgmt are command-line tools that are built into Windows Server 2008 and Windows Server 2008 R2. Ntdsutil is available if you have the AD DS or Active Directory Lightweight Directory Services (AD LDS) server role installed. Dsmgmt is available if you have the AD LDS server role installed. These tools are also available if you install the Active Directory Domain Services Tools that are part of the Remote Server Administration Tools (RSAT). For more information, see How to Administer Microsoft Windows Client and Server Computers Locally and Remotely (http://go.microsoft.com/fwlink/?LinkID=177813).

To use either of these tools, you must run them from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
connections
{cancel changes | commit changes} {list | set %s1 to %s2 | show values}

Parameters

Parameter | Description
cancel changes | Cancels the changes that are made but not yet committed.
commit changes | Commits the changes made to the server.
connections | Invokes the server connections submenu. See “Remarks” later in this topic for more information.
list | Lists the names of the supported configurable settings.
set %s1 to %s2 | Sets the configurable settings %s1 to the value %s2.
show values | Displays values of configurable settings.
%sN | An alphanumeric variable, such as a domain or domain controller name.
quit | Takes you back to the previous menu, or exits the utility.
? | Displays Help at the command prompt.
Help | Displays Help at the command prompt.

Remarks

  • Before you can run other configurable settings subcommand parameters, you need to connect to a specific AD DS or AD LDS instance by using the connections parameter.

  • Ntdsutil does not correctly handle special characters, such as the apostrophe character ('), that you can enter at the ntdsutil: prompt at the command line. In some situations, there may be an alternative workaround. For more information, see local roles (http://go.microsoft.com/fwlink/?LinkId=157320).

Examples

To change the value of a configurable setting named DynamicObjectDefaultTTL to 172800 seconds (two days), type the following command, and then press ENTER:

Copy Code
Configurable setting: set DynamicObjectDefaultTTL to 172800

To show the current values of configurable settings, type the following command, and then press ENTER:

Copy Code
Configurable setting: show values

Additional references

Command-Line Syntax Key

Dsmgmt

Ntdsutil

authoritative restore

DS behavior

files

group membership evaluation

ifm

LDAP policies

local roles

metadata cleanup

partition management

roles

security account management

semantic database analysis

set DSRM password

snapshot


DS behavior

Applies To: Windows Server 2003,Windows Server 2003,Windows Server 2003 R2,Windows Server 2003 R2,Windows Server 2008,Windows Server 2008,Windows Server 2003 with SP1,Windows Server 2003 with SP1

Manages password operations over unsecured connections. You can allow or deny password operations over unsecured connections and list the current setting.

As a best security practice, you should not disable strong encryption in a production environment. Strong encryption ensures that passwords are transmitted only across secure channels. For test environments only, you can disable strong encryption.

This is a subcommand of Ntdsutil and Dsmgmt. Ntdsutil and Dsmgmt are command-line tools that are built into Windows Server 2008 and Windows Server 2008 R2. Ntdsutil is available if you have the Active Directory Domain Services (AD DS) or Active Directory Lightweight Directory Services (AD LDS) server role installed. Dsmgmt is available if you have the AD LDS server role installed. These tools are also available if you install the Active Directory Domain Services Tools that are part of the Remote Server Administration Tools (RSAT). For more information, see How to Administer Microsoft Windows Client and Server Computers Locally and Remotely (http://go.microsoft.com/fwlink/?LinkID=177813).

To use either of these tools, you must run them from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
connections
[{allow passwd op on unsecured connection | deny passwd op on unsecured connection | list current ds-behavior}]

Parameters

Parameter | Description
allow passwd op on unsecured connection | Modifies AD DS or AD LDS behavior to allow password operations over an unsecured connection.
connections | Invokes the server connections submenu.
deny passwd op on unsecured connection | Modifies AD DS or AD LDS behavior to deny password operations over an unsecured connection.
list current ds-behavior | Lists current behavior for the AD DS or AD LDS instance.
quit | Takes you back to the previous menu, or exits the utility.
? | Displays Help at the command prompt.
Help | Displays Help at the command prompt.

Remarks

  • Before you can run the DS behavior subcommand, you need to connect to a specific AD Ds or AD LDS instance by using the connections parameter.

  • By default, password operations over unsecured connections are denied. You should change the default setting only after performing an appropriate risk analysis.

  • Ntdsutil does not correctly handle special characters, such as the apostrophe character ('), that you can enter at the ntdsutil: prompt at the command line. In some situations, there may be an alternative workaround. For more information, see local roles (http://go.microsoft.com/fwlink/?LinkId=157320).

Examples

To allow password operations over unsecured connections, type the following command, and then press ENTER:

Copy Code
AD DS/LDS behavior: allow passwd op on unsecured connection

Additional references

Command-Line Syntax Key

Ntdsutil

Dsmgmt

authoritative restore

configurable settings

files

group membership evaluation

ifm

LDAP policies

local roles

metadata cleanup

partition management

roles

security account management

semantic database analysis

set DSRM password

snapshot


group membership evaluation

Applies To: Windows Server 2003,Windows Server 2003,Windows Server 2003 R2,Windows Server 2003 R2,Windows Server 2008,Windows Server 2008,Windows Server 2003 with SP1,Windows Server 2003 with SP1

Generates a report with information about group memberships for a user. Active Directory environments that contain complex group structures can encounter problems with access token limitation during authentication. This problem can result in the inability of a user to log on or access resources. By analyzing the results of the report, you can identify the source of the problem.

For detailed information about the access token limitation issue and how to use the group membership evaluation option in Ntdsutil or Dsmgmt to resolve related problems, see Addressing Problems Due to Access Token Limitation (http://go.microsoft.com/fwlink/?LinkId=62237).

This is a subcommand of Ntdsutil and Dsmgmt. Ntdsutil and Dsmgmt are command-line tools that are built into Windows Server 2008 and Windows Server 2008 R2. Ntdsutil is available if you have the Active Directory Domain Services (AD DS) or Active Directory Lightweight Directory Services (AD LDS) server role installed. Dsmgmt is available if you have the AD LDS server role installed. These tools are also available if you install the Active Directory Domain Services Tools that are part of the Remote Server Administration Tools (RSAT). For more information, see How to Administer Microsoft Windows Client and Server Computers Locally and Remotely (http://go.microsoft.com/fwlink/?LinkID=177813).

To use either of these tools, you must run them from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
[clear credentials] [run %s1 %s2] [set account dc %s] [set credentials %s1 %s2 %s3] [set global catalog %s] [set resource dc %s] [verbose %s]

Parameters

Parameter | Description
clear credentials | Clears credentials that were used for a prior connection.
run %s1 %s2 | Runs token evaluation for the principal %s2 in domain %s1.
set account dc %s | Specifies the domain controller used in the account domain. The account domain is the domain that includes the user account. If you do not specify a domain controller, the tool automatically locates one.
set credentials %s1 %s2 %s3 | Sets connection credentials as domain %s1, user %s2, and password %s3.
set global catalog %s | Specifies which global catalog server to use. If you do not specify a global catalog, ntdsutil.exe automatically locates one.
set resource dc %s | Specifies the domain controller used in the resource domain. Use this parameter only if the user and computer on which the logon is being attempted are in different domains. If the user and computer belong to different domains, the resource groups of the computer must also be enumerated.
verbose %s | Turns verbose mode on or off.
quit | Takes you back to the previous menu, or exits the utility.
? | Displays Help at the command prompt.
Help | Displays Help at the command prompt.

Remarks

  • If the variable has spaces in it, enclose it in parentheses, instead of quotation marks: connect to server (xxx yyy).

  • Ntdsutil does not correctly handle special characters, such as the apostrophe character ('), that you can enter at the ntdsutil: prompt at the command line. In some situations, there may be an alternative workaround. For more information, see local roles (http://go.microsoft.com/fwlink/?LinkId=157320).

Examples

If you want to evaluate the group memberships for a user with SAM Account Name ToniPoe in a domain named corp.cpandl.com, using Ntdsutil you can do the following:

  1. At the ntdsutil: prompt, type group membership evaluation, and then press ENTER.

  2. Type set account dc <dcname>, where <dcname> is the actual name of a domain controller in your domain that you want to use to obtain the accounts global group memberships, and then press ENTER.

  3. Type set globcal catalog <gcname>, where <gcname> is the actual name of a domain controller in your domain acting as a global catalog server that you want to use to obtain the accounts universal group memberships, and then press ENTER.

  4. Type set resource dc <dcname>, where <dcname> is the actual name of a domain controller in your domain that you want to use to obtain the accounts local group memberships, and then press ENTER.

  5. Type run corp.cpandl.com tonipoe, and then press ENTER.

  6. Ntdsutil outputs a tab-separated-value file (.tsv) with a specific name. That file is located in the folder from which you started Ntdsutil. The file name is reported by Ntdsutil. To access the file, type quit, and then press ENTER twice.

  7. Type dir *.tsv to see a list of the tab-separated-value files in the current folder.

  8. You can open the file in a spreadsheet program or a text file viewer. For example, to open a file named tonipoe-20090514203117.tsv in Notepad, type notepad tonipoe-20090514203117.tsv, and then press ENTER.

Additional references

Command-Line Syntax Key

Ntdsutil

Dsmgmt

authoritative restore

configurable settings

DS behavior

files

ifm

LDAP policies

local roles

metadata cleanup

partition management

roles

security account management

semantic database analysis

set DSRM password

snapshot


LDAP policies

Applies To: Windows Server 2003,Windows Server 2003,Windows Server 2003 R2,Windows Server 2003 R2,Windows Server 2008,Windows Server 2008,Windows Server 2003 with SP1,Windows Server 2003 with SP1

Sets the Lightweight Directory Access Protocol (LDAP) administration limits for the Default-Query Policy object. At the LDAP policies: prompt, type any of the parameters listed under Syntax.

This is a subcommand of Ntdsutil and Dsmgmt. Ntdsutil and Dsmgmt are command-line tools that are built into Windows Server 2008 and Windows Server 2008 R2. Ntdsutil is available if you have the Active Directory Domain Services (AD DS) or Active Directory Lightweight Directory Services (AD LDS) server role installed. Dsmgmt is available if you have the AD LDS server role installed. These tools are also available if you install the Active Directory Domain Services Tools that are part of the Remote Server Administration Tools (RSAT). For more information, see How to Administer Microsoft Windows Client and Server Computers Locally and Remotely (http://go.microsoft.com/fwlink/?LinkID=177813).

To use either of these tools, you must run them from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
connections
{cancel changes | commit changes} {list | set %s1 to %s2 | show values}

Parameters

Parameter | Description
cancel changes | Cancels any uncommitted modifications of the LDAP administration limits to the default query policy.
commit changes | Commits all modifications of the LDAP administration limits to the default query policy.
connections | Invokes the Server connections submenu.
list | Lists all supported LDAP administration limits for the domain controller.
set %s1 to %s2 | Sets the value of the LDAP administration limit %s1 to the value %s2.
show values | Shows the current and proposed values for the LDAP administration limits.
%s | An alphanumeric variable, such as a domain or domain controller name.
quit | Takes you back to the previous menu, or exits the utility.
? | Displays Help at the command prompt.
Help | Displays Help at the command prompt.

Remarks

  • The following table lists and describes the LDAP administration limits, with default values noted in parentheses.

    Value Description

    InitRecvTimeout

    Initial receive time-out (120 seconds)

    MaxConnections

    Maximum number of open connections (5000)

    MaxConnIdleTime

    Maximum amount of time a connection can be idle (900 seconds)

    MaxNotificationPerConnection

    Maximum number of notifications that a client can request for a given connection (5)

    MaxPageSize

    Maximum page size supported for LDAP responses (1000 records)

    MaxQueryDuration

    Maximum length of time the domain controller can execute a query (120 seconds)

    MaxTempTableSize

    Maximum size of temporary storage allocated to execute queries (10,000 records)

    MaxResultSetSize

    Maximum size of the LDAP Result Set (262144 bytes)

    MaxPoolThreads

    Maximum number of threads created by the domain controller for query execution (4 per processor)

    MaxDatagramRecv

    Maximum number of datagrams that can be processed by the domain controller simultaneously (1024)

    MaxReceiveBuffer

    The maximum size, in bytes, of a request that the server will accept (10,485,760 bytes)

    MaxValRange

    The maximum number of values that can be retrieved from a multivalued attribute in a single search request (1500 values). This policy is available only in Windows Server 2003 and Windows Server 2008.
  • To ensure that domain controllers can support service-level guarantees, you can specify operational limits for a number of LDAP operations. These limits prevent specific operations from adversely impacting the performance of the server and also make the server resilient to denial-of-service attacks.

    LDAP policies are implemented by using objects of the class queryPolicy. Query Policy objects can be created in the container Query Policies, which is a child of the Directory Service container in the configuration directory partition, for example, CN=Query-Policies,CN=Directory Service,CN=Windows NT,CN=Services (configuration directory partition).

    A domain controller uses the following three mechanisms to apply LDAP policies:

    • A domain controller might refer to a specific LDAP policy. The NTDS Settings object includes an optional attribute queryPolicyObject, which contains the distinguished name of a Query Policy.

    • In the absence of a specific query policy being applied to a domain controller, the domain controller applies the Query Policy that has been assigned to the domain controller's site. The ntDSSiteSettings object includes an optional attribute queryPolicyObject, which contains the distinguished name of a Query Policy.

    • In the absence of a specific domain controller or site Query Policy, a domain controller uses the default query policy named Default-Query Policy.

      A Query Policy object includes the multivalued attributes LDAPIPDenyList and LDAPAdminLimits. Ntdsutil allows the administrator to set the LDAP administration limits and IP Deny list for the Default-Query Policy object.

    • Ntdsutil does not correctly handle special characters, such as the apostrophe character ('), that you can enter at the ntdsutil: prompt at the command line. In some situations, there may be an alternative workaround. For more information, see local roles (http://go.microsoft.com/fwlink/?LinkId=157320).

Examples

To show the current ldap policy values, type the following command, and then press ENTER:

Copy Code
ldap policy: show values

Additional references

Command-Line Syntax Key

Dsmgmt

Ntdsutil

authoritative restore

configurable settings

DS behavior

files

group membership evaluation

ifm

LDAP policies

local roles

metadata cleanup

partition management

roles

security account management

semantic database analysis

set DSRM password

snapshot


local roles

Applies To: Windows Server 2008,Windows Server 2008,Windows Server 2003 with SP1,Windows Server 2003 with SP1,Windows Server 2003 R2,Windows Server 2003 R2,Windows Server 2003,Windows Server 2003

Manages Administrator Role Separation for a read-only domain controller (RODC). Administrator role separation provides a nonadministrative user with the permissions to install and administer an RODC, without granting that user permissions to do any other type of domain administration.

This command is a subcommand of Ntdsutil and Dsmgmt. Ntdsutil and Dsmgmt are command-line tools that are built into Windows Server 2008 and Windows Server 2008 R2. Ntdsutil is available if you have the Active Directory Domain Services (AD DS) or Active Directory Lightweight Directory Services (AD LDS) server role installed. Dsmgmt is available if you have the Active Directory Lightweight Directory Services (AD LDS) server role installed. These tools are also available if you install the Active Directory Domain Services Tools that are part of the Remote Server Administration Tools (RSAT). For more information, see How to Administer Microsoft Windows Client and Server Computers Locally and Remotely (http://go.microsoft.com/fwlink/?LinkID=177813).

To use either of these tools, you must run them from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

Note
You can use this subcommand only with the AD DS server role because AD LDS does not include RODCs.

Ntdsutil.exe does not handle certain characters in roles names correctly for local roles management. For example, on a French version of Windows, the following command fails:

Copy Code
show role "opérateurs d’impression"

The command fails because the apostrophe character within the role name is not handled correctly by the command-line input. As a workaround, you can manage the RODC local roles mapping directly by using the following registry entry on the RODC:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\RODCROLES

Each value corresponds to one local role (the name of the built-in group). The value is the relative ID (RID) (the right-most part of the security identifier (SID)) of the group. You can find the SID value of the group by using the Active Directory Users and Computers snap-in. Right-click the name of the built-in group, click Properties, click the Attribute Editor tab, and look for the objectSid attribute of the group.

To add user accounts to a specific local role

  1. Open Registry Editor and navigate to the RODCROLES subkey.

  2. Right-click the RODCROLES subkey, click New, and then click Multi-String Value.

  3. Type the RID value of the local role. For example, type 548 for the Account Operators group.

  4. Right-click the new value, and then click Modify. Type the SID of the user account that you want to add to that local role. To add multiple user accounts, type each SID on a separate line:

    S-1-5-21-2784665212-3940052439-2066015977-1600

    S-1-5-21-2784665212-3940052439-2066015977-1601

    Note
    To obtain the SID of a user account, type the following command at an elevated command prompt:

    Dsget user <distinguished name of the user account> -sid

  5. Click OK.

To verify the membership of a given user, log on to the RODC as that user, open an elevated command prompt and type whoami /groups.

This issue affects input of all special characters in the ntdsutil: prompt because it does not handle these special characters correctly. As a result, this issue affects all subcommands of Ntdsutil that require special character input.

For examples of how to use this command, see Examples.

Syntax

Copy Code
connections
{add %s1 %s2 | remove %s1 %s2} [list roles] [show roles]

Parameters

Parameter | Description
add %s1 %s2 | Adds an account %s1 to the local role %s2.
connections | Invokes the server connections submenu.
list roles | List defined local roles. These roles correspond to the various Built-in groups, such as Administrators, Backup Operators, Server Operators, and so on. Each RODC stores in its Registry a list of accounts that should be considered members of those groups (roles) on that RODC. This list of accounts supplements any members of those groups stored in the directory. For example, suppose the BUILTIN\Administrators group stored in the directory contains a single member, the Domain Admins group. Suppose also that on a particular RODC, fabrikam\MikeDan is listed in the Administrators local role. Then on that RODC, both MikeDan and anyone in the Domain Admins group are considered to be Administrators.
remove %s1 %s2 | Removes an account %s1 to the local role %s2.
show roles | Shows local role members
quit | Takes you back to the previous menu or exits the tool.
? | Displays help at the command prompt.
Help | Displays help at the command prompt.

Remarks

  • To initially configure Administrator Role Separation for an RODC, you must be a member of the Domain Admins group.

  • By default, no local administrator role is defined on the RODC after AD DS installation.

  • By default, the local roles subcommand is performed on the RODC where you run the command. If you need to connect to a different RODC, use the connections parameter.

Examples

To add a user account named MikeDan from the Contoso domain to the administrators local role on an RODC, type:

Copy Code
add CONTOSO\MikeDan administrators

Additional references

Command-Line Syntax Key

Dsmgmt

Ntdsutil

authoritative restore

configurable settings

DS behavior

files

group membership evaluation

ifm

LDAP policies

metadata cleanup

partition management

roles

security account management

semantic database analysis

set DSRM password

snapshot


metadata cleanup

Applies To: Windows Server 2003,Windows Server 2003,Windows Server 2003 R2,Windows Server 2003 R2,Windows Server 2008,Windows Server 2008,Windows Server 2003 with SP1,Windows Server 2003 with SP1

Cleans up metadata for failed domain controllers.

In Windows Server 2008 and Windows Server 2008 R2, you can use Active Directory Users and Computers or Active Directory Sites and Services. For more information, see Clean Up Server Metadata (http://go.microsoft.com/fwlink/?LinkId=185232).

When a failed domain controller stores the only copy of one or more domains or application directory partitions (also called "naming contexts"), metadata cleanup can also be used to clean up metadata for selected domains or application directory partitions. In this version of Ntdsutil.exe, metadata cleanup also removes File Replication Service (FRS) connections and attempts to transfer or seize any operations master roles (also known as flexible single master operations or FSMO roles) that the retired domain controller holds.

At the metadata cleanup: prompt, type any of the parameters listed under “Syntax.”

This is a subcommand of Ntdsutil and Dsmgmt. Ntdsutil and Dsmgmt are command-line tools that are built into Windows Server 2008 and Windows Server 2008 R2. Ntdsutil is available if you have the Active Directory Domain Services (AD DS) or Active Directory Lightweight Directory Services (AD LDS) server role installed. Dsmgmt is available if you have the AD LDS server role installed. These tools are also available if you install the Active Directory Domain Services Tools that are part of the Remote Server Administration Tools (RSAT). For more information, see How to Administer Microsoft Windows Client and Server Computers Locally and Remotely (http://go.microsoft.com/fwlink/?LinkID=177813).

To use either of these tools, you must run them from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
connections
[select operation target] {remove selected domain | remove selected naming context |remove selected server | remove selected server %s | remove selected server %s1 on %s2}

Parameters

Note
With this version of Ntdsutil.exe, you can remove server metadata by using the remove selected server %s or remove selected server %s on %2 commands without first using the Server connections and Select operation target submenus.

Parameter | Description
connections | Invokes the Server connections submenu.
remove selected domain | Removes the metadata associated with the domain that is selected in the Select operation target submenu.
remove selected naming context | Removes the metadata associated with the Naming Context that is selected in the Select operation target submenu.
remove selected server | Removes the metadata associated with the domain controller that is selected in the Select operation target submenu. This parameter also removes FRS metadata and tries to transfer or seize operations master roles.
remove selected server %s | Removes directory and FRS metadata for the disabled server %s from the directory on localhost, and attempts to transfer or seize any operations master roles that are held by server %s to localhost. This parameter also removes FRS metadata and tries to transfer or seize operations master roles.
remove selected server %s1 on %s2 | Connects to server %s2, removes directory and FRS metadata for server %s1 from the directory on server %s2, and attempts to transfer or seize any operations master roles held by server %s1 to server %s2. This parameter also removes FRS metadata and tries to transfer or seize operations master roles.
select operation target | Invokes the Select operation target submenu.
quit | Takes you back to the previous menu, or exits the utility.
? | Displays Help at the command prompt.
Help | Displays Help at the command prompt.

Remarks

  • The directory service maintains various metadata for each domain and server known to the forest. Normally, domains and domain controllers are created by means of promotion using the Active Directory Installation Wizard and are removed by means of demotion using the same tool. You can invoke the Active Directory Installation Wizard by typing dcpromo at the command prompt.

    Promotion and demotion are designed to correctly clean up the appropriate metadata. In the directory, however, you might have domain controllers that were decommissioned incorrectly. In this case, their metadata is not cleaned up. For example, you might have forcefully removed AD DS by using dcpromo /forceremoval, or you might have a domain controller that has failed, and rather than attempting to restore it, you decide to retire the server. This leaves some information about the retired domain controller in the directory. The general model of operation is to connect to a server known to have a copy of the offending metadata, select an operation target, and then delete the metadata of the selected target. This version of Ntdsutil.exe can automatically connect to a specified server and remove metadata for a specified target in the same step.

    Note
    Do not delete the metadata of existing domains and domain controllers.

  • Ntdsutil does not correctly handle special characters, such as the apostrophe character ('), that you can enter at the ntdsutil: prompt at the command line. In some situations, there may be an alternative workaround. For more information, see local roles (http://go.microsoft.com/fwlink/?LinkId=157320).

Examples

To remove metadata for a server named RODC1, type the following command, and then press ENTER:

Copy Code
metadata cleanup: remove selected server RODC1

Additional references

Command-Line Syntax Key

Dsmgmt

Ntdsutil

authoritative restore

configurable settings

DS behavior

files

group membership evaluation

ifm

LDAP policies

local roles

partition management

roles

security account management

semantic database analysis

set DSRM password

snapshot


partition management

Applies To: Windows Server 2003 R2,Windows Server 2003 R2,Windows Server 2003,Windows Server 2003,Windows Server 2003 with SP1,Windows Server 2003 with SP1,Windows Server 2008,Windows Server 2008

Manages directory partitions for Active Directory Domain Services (AD DS) or Active Directory Lightweight Directory Services (AD LDS).

This is a subcommand of Ntdsutil and Dsmgmt. Ntdsutil and Dsmgmt are command-line tools that are built into Windows Server 2008 and Windows Server 2008 R2. Ntdsutil is available if you have the AD DS or AD LDS server role installed. Dsmgmt is available if you have the AD LDS server role installed. These tools are also available if you install the Active Directory Domain Services Tools that are part of the Remote Server Administration Tools (RSAT). For more information, see How to Administer Microsoft Windows Client and Server Computers Locally and Remotely (http://go.microsoft.com/fwlink/?LinkID=177813).

To use either of these tools, you must run them from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
connections
[select operation target] [add nc replica %s1 %s2] [create nc %s1 %s2] [create nc %s1 %s2 %s3] [delete nc %s] [list] [list nc information %s] [list nc replicas %s] [precreate %s1 %s2] [remove nc replica %s1 %s2] [set nc reference domain %s1 %s2] [set nc replication notification delay %s %d1 %d2]

Parameters

Parameter Description

add nc replica %s1 %s2

Adds the Active Directory domain controller or AD LDS instance with full Domain Name System (DNS) name %s2 to the replica set for the application directory partition with distinguished name %s1. If you specify "NULL" for %s2, then this command uses the currently connected Active Directory domain controller or AD LDS instance.

connections

Invokes the server connections submenu. See “Remarks” later in this topic for more information.

create nc %s1 %s2

Creates the application directory partition with distinguished name %s1, on the Active Directory domain controller or AD LDS instance with full DNS name %s2. If you specify "NULL" for %s2, this command uses the currently connected Active Directory domain controller.

Use this command only with AD DS. For AD LDS, use create nc %s1 %s2 %s3.

create nc %s1 %s2 %s3

Creates the AD LDS application directory partition with distinguished name %s1 of object class %s2 on a computer named %s3. You should annotate the %s3 value with the Lightweight Directory Access Protocol (LDAP) port number. For example, type adam1.fabrikam.com:389.

If you specify "NULL" for %s3, this command uses the currently connected AD LDS instance.

delete nc %s

Completely removes the application directory partition or precreated cross-reference with distinguished name %s from AD DS or AD LDS.

list

Lists known naming contexts.

list nc information %s

Shows the reference domain and replication delays for the application directory partition with distinguished name %s.

list nc replicas %s

Shows the list of Active Directory domain controllers or AD LDS instances in the replica set for the application directory partition with distinguished name %s.

precreate %s1 %s2

Precreates a cross-reference object for the domain or application directory partition with distinguished name %s1, allowing a server with DNS name %s2 to be promoted as an Active Directory domain controller for the domain or create the application directory partition.

This can also be used to precreate cross-reference objects for application directory partitions for AD LDS. For AD LDS, %2 should be hostname:ldapPort:ldapSslPort, such as adam1.fabrikam.com:389:636.

remove nc replica %s1 %s2

Deletes the AD DS or AD LDS instance with DNS name %s2 from the replica set of the application directory partition with distinguished name %s1. If you specify "NULL" for %s2, this command uses the currently connected Active Directory domain controller or AD LDS instance.

select operation target

Invokes the Select operation target submenu.

set nc reference domain %s1 %s2

Sets the reference domain of application directory partition with distinguished name %s1 to domain with distinguished name %s2.

set nc replication notification delay %s %d1 %d2

Sets the notification delays of directory partition with distinguished name %s to %d1 and %d2 seconds, where %d1 is the delay between notifying the first Active Directory domain controller or AD LDS instance of changes and %d2 is the delay of notifying subsequent Active Directory domain controllers or AD LDS instances of changes. If you specify -1 in either #d1 or %d2, this command will not modify the corresponding delay (in case you are trying to modify only one delay). If you specify any other negative number, the command will delete the delay. Delays are always set on the naming master.

quit

Takes you back to the previous menu, or exits the utility.

?

Displays Help at the command prompt.

Help

Displays Help at the command prompt.

Remarks

  • Before you can run the DS behavior subcommand, connect to a specific AD Ds or AD LDS instance by using the connections parameter.

  • Ntdsutil does not correctly handle special characters, such as the apostrophe character ('), that you can enter at the ntdsutil: prompt at the command line. In some situations, there may be an alternative workaround. For more information, see local roles (http://go.microsoft.com/fwlink/?LinkId=157320).

Examples

To create an application directory partition named AppPartition in the contoso.com domain, complete the following steps:

  1. To open an elevated Command Prompt window, click Start, point to All Programs, click Accessories, right-click Command Prompt, and then click Run as administrator.

  2. Type:

    Copy Code
    ntdsutil
  3. Type:

    Copy Code
    Ac in ntds
  4. Type:

    Copy Code
    partition management
  5. Type:

    Copy Code
    connections
  6. Type:

    Copy Code
    Connect to server DC_Name
  7. Type:

    Copy Code
    quit
  8. Type:

    Copy Code
    list
    The following partitions will be listed:

    0 CN=Configuration,DC=Contoso,DC=com

    1 DC=Contoso,DC=com

    2 CN=Schema,CN=Configuration,DC=Contoso,DC=com

    3 DC=DomainDnsZones,DC=Contoso,DC=com

    4 DC=ForestDnsZones,DC=Contoso,DC=com

  9. At the partition management prompt, type:

    Copy Code
    create nc dc=AppPartition,dc=contoso,dc=com ConDc1.contoso.com
  10. Run the list command again to refresh the list of partitions.

Additional references

Command-Line Syntax Key

Dsmgmt

Ntdsutil

authoritative restore

configurable settings

DS behavior

files

group membership evaluation

ifm

LDAP policies

local roles

metadata cleanup

roles

security account management

semantic database analysis

set DSRM password

snapshot


roles

Applies To: Windows Server 2008,Windows Server 2008,Windows Server 2003 with SP1,Windows Server 2003 with SP1,Windows Server 2003,Windows Server 2003,Windows Server 2003 R2,Windows Server 2003 R2

Seizes and transfers operations master roles (also known as flexible single master operations or FSMO roles). At the roles: prompt, type any of the parameters listed under “Syntax.”

This is a subcommand of Ntdsutil and Dsmgmt. Ntdsutil and Dsmgmt are command-line tools that are built into Windows Server 2008 and Windows Server 2008 R2. Ntdsutil is available if you have the Active Directory Domain Services (AD DS) or Active Directory Lightweight Directory Services (AD LDS server role installed. Dsmgmt is available if you have the AD LDS server role installed. These tools are also available if you install the Active Directory Domain Services Tools that are part of the Remote Server Administration Tools (RSAT). For more information, see How to Administer Microsoft Windows Client and Server Computers Locally and Remotely (http://go.microsoft.com/fwlink/?LinkID=177813).

To use either of these tools, you must run them from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
connections
[select operation target] [{seize naming master | seize infrastructure master | seize PDC | seize RID master | seize schema master}] [{transfer naming master | transfer infrastructure master | transfer PDC | transfer RID master | transfer schema master}]

Parameters

Parameter | Description
connections | Invokes the Server connections submenu.
seize naming master | Forces the domain controller to which you are connected to claim ownership of the domain naming master operations master role without regard to the data associated with the role. Use only for recovery purposes.
seize infrastructure master | Forces the domain controller to which you are connected to claim ownership of the infrastructure operations master role without regard to the data associated with the role. Use only for recovery purposes.
seize PDC | Forces the domain controller to which you are connected to claim ownership of the primary domain controller (PDC) emulator operations master role without regard to the data associated with the role. Use only for recovery purposes.
seize RID master | Forces the domain controller to which you are connected to claim ownership of the relative ID (RID) operations master role without regard to the data associated with the role. Use only for recovery purposes.
seize schema master | Forces the domain controller to which you are connected to claim ownership of the schema operations master role without regard to the data associated with the role. Use only for recovery purposes.
select operation target | Invokes the Select operation target submenu.
transfer naming master | Instructs the domain controller to which you are connected to obtain the domain naming master role by means of controlled transfer.
transfer infrastructure master | Instructs the domain controller to which you are connected to obtain the infrastructure operations master role by means of controlled transfer.
transfer PDC | Instructs the domain controller to which you are connected to obtain the PDC emulator operations master role by means of controlled transfer.
transfer RID master | Instructs the domain controller to which you are connected to obtain the RID operations master role by means of controlled transfer.
transfer schema master | Instructs the domain controller to which you are connected to obtain the schema operations master role by means of controlled transfer.
quit | Takes you back to the previous menu, or exits the utility.
? | Displays Help at the command prompt.
Help | Displays Help at the command prompt.

Remarks

  • Although AD DS is based on a multimaster administration model, some operations support only a single master. For multimaster operations, conflict resolution ensures that after the system finishes replicating, all replicas agree on the value for a given property on a given object. However, some data, for which adequate conflict resolution is not possible, is key to the operation of the system as a whole. This data is controlled by individual domain controllers called operations masters. These domain controllers are referred to as holding a particular operations master role.

    The following are the five operations master roles; some are enterprise-wide and some are per domain:

    • Schema master. There is a single schema operations master role for the entire enterprise. This role allows the operations master server to accept schema updates. There are other restrictions on schema updates.

    • RID master. There is one RID master per domain. Each domain controller in a domain has the ability to create security principals. Each security principal is assigned a RID. Each domain controller is allocated a small set of RIDs out of a domain-wide RID pool. The RID operations master role makes it possible for the domain controller to allocate new subpools out of the domain-wide RID pool.

    • Domain naming master. There is a single domain naming operations master role for the entire enterprise. The domain naming operations master role allows the owner to define new cross-reference objects representing domains in the Partitions container.

    • PDC emulator master. There is one PDC emulator operations master role per domain. The owner of the PDC emulator operations master role identifies which domain controller in a domain performs Windows NT 4.0 PDC activities in support of Windows NT 4.0 backup domain controllers and client computers that use earlier versions of Windows.

    • Infrastructure master. There is one infrastructure master operations role per domain. The owner of this role ensures the referential integrity of objects with attributes that contain distinguished names of other objects that might exist in other domains. Because AD DS allows objects to be moved or renamed, the infrastructure master periodically checks for object modifications and maintains the referential integrity of these objects.

  • An operations master role can be moved only by administrative involvement; it is not moved automatically. In addition, moving a role is controlled by standard access controls. Therefore, an organization should tightly control the location and movement of operations master roles. For example, an organization with a strong information technology (IT) presence might place the schema master operations role on a server computer in the IT group and configure its access control list (ACL) so that it cannot be moved at all.

    Operations master roles require two forms of management: controlled transfer and seizure.

    Use controlled transfer when you want to move a role from one server to another, perhaps to track a policy change with respect to role location or in anticipation of a server being shut down, moved, or decommissioned.

    Seizure is required when a server that is holding a role fails and you do not intend to restore it. Even in the case of a server that is recovered from a backup, the server does not assume that it owns a role (even if the backup tape says so), because the server cannot determine if the role was legitimately transferred to another server in the time period between when the backup was made and the server failed and was recovered. The restored server assumes role ownership only if a quorum of existing servers is available during recovery and they all agree that the restored server is still the owner.

    The Roles submenu in Ntdsutil is used to perform controlled transfer and recovery of operations master roles. Controlled transfer is simple and safe. Because the source server and destination server are running, the system software guarantees that the operations master role token and its associated data are transferred atomically. Operations master role seizure is equally simple but not as safe: you simply tell a particular domain controller that it is now the owner of a particular role.

    Caution
    Do not make a server an operations master role owner by means of seizure commands if the real role holder exists on the network. Doing this can create irreconcilable conflicts for key system data. If an operations master role owner is temporarily unavailable, do not make another domain controller the role owner. This can result in a situation in which two computers function as the role owner, which might cause irreconcilable conflicts for key system data.

  • Ntdsutil does not correctly handle special characters, such as the apostrophe character ('), that you can enter at the ntdsutil: prompt at the command line. In some situations, there may be an alternative workaround. For more information, see local roles (http://go.microsoft.com/fwlink/?LinkId=157320).

Examples

To transfer the PDC emulator master role to the domain controller that you are currently connected to, type the following command, and then press ENTER:

Copy Code
fsmo maintenance: transfer PDC

Additional references

Command-Line Syntax Key

Dsmgmt

Ntdsutil

authoritative restore

configurable settings

DS behavior

files

group membership evaluation

ifm

LDAP policies

local roles

metadata cleanup

partition management

security account management

semantic database analysis

set DSRM password

snapshot


security account management

Applies To: Windows Server 2008,Windows Server 2008,Windows Server 2003 with SP1,Windows Server 2003 with SP1,Windows Server 2003,Windows Server 2003,Windows Server 2003 R2,Windows Server 2003 R2

Manages security identifiers (SIDs). At the security account maintenance: prompt, type any of the parameters listed under “Syntax.”

This is a subcommand of Ntdsutil and Dsmgmt. Ntdsutil and Dsmgmt are command-line tools that are built into Windows Server 2008 and Windows Server 2008 R2. Ntdsutil is available if you have the Active Directory Domain Services (AD DS) or Active Directory Lightweight Directory Services (AD LDS) server role installed. Dsmgmt is available if you have the AD LDS server role installed. These tools are also available if you install the Active Directory Domain Services Tools that are part of the Remote Server Administration Tools (RSAT). For more information, see How to Administer Microsoft Windows Client and Server Computers Locally and Remotely (http://go.microsoft.com/fwlink/?LinkID=177813).

To use either of these tools, you must run them from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
[{check duplicate SID | cleanup duplicate SID}] [connect to server %s] [log file %s]

Parameters

Parameter | Description
check duplicate SID | Checks the Security Accounts Manager (SAM) database for any objects that have duplicate SIDs but does not delete any of the duplicates.
cleanup duplicate SID | Deletes all objects that have duplicate SIDs and logs these entries into the log file.
connect to server %s | Connects to the server, NetBIOS name, or Domain Name System (DNS) host name. You must connect to a specific domain controller before you can check for or clean up duplicate SIDs.
log file %s | Sets the log file name to %s. If you do not explicitly set a log file name, the default log file name is dupsid.log.
quit | Takes you back to the previous menu, or exits the utility.
? | Displays Help at the command prompt.
Help | Displays Help at the command prompt.

Remarks

  • Each security account (users, groups, and computers) is identified by a unique SID. Use a SID to uniquely identify a security account and to perform access checks against resources, such as files, file directories, printers, Exchange mailboxes, Microsoft SQL Server databases, objects that stored in AD DS, or any data that is protected by the Windows Server 2003 security model.

    A SID is made up of header information and a set of relative identifiers (RIDs) that identify the domain and the security account. Within a domain, each domain controller is capable of creating accounts and issuing each account a unique security identifier. Each domain controller maintains a pool of relative IDs that is used in the creation of security identifiers. When 80 percent of the RID pool is consumed, the domain controller requests a new pool of RIDs from the RID operations master. This ensures that the same pool of RIDs is never allocated to different domain controllers and prevents the allocation of duplicate SIDs. However, because it is possible (but rare) for a duplicate RID pool to be allocated, you have to identify those accounts that have been issued duplicate SIDs so that you prevent undesirable application of security.

    One cause of duplicate RID pools is an administrator seizing the RID master role while the original RID master is operational but temporarily disconnected from the network. In normal practice, after one replication cycle, the RID master role is assumed by just one domain controller. However, it is possible that before the role ownership is resolved, two different domain controllers might each request a new RID pool and be allocated the same RID pool.

  • Ntdsutil does not correctly handle special characters, such as the apostrophe character ('), that you can enter at the ntdsutil: prompt at the command line. In some situations, there may be an alternative workaround. For more information, see local roles (http://go.microsoft.com/fwlink/?LinkId=157320).

Examples

To connect to a domain controller named DC1, type the following command, and then press ENTER:

Copy Code
semantic account maintenance: connect to DC1

To check for duplicate SIDs on a domain controller named DC1, type the following command, and then press ENTER:

Copy Code
semantic account maintenance: check duplicate SID

Additional references

Command-Line Syntax Key

Dsmgmt

Ntdsutil

authoritative restore

configurable settings

DS behavior

files

group membership evaluation

ifm

LDAP policies

local roles

metadata cleanup

partition management

roles

semantic database analysis

set DSRM password

snapshot


set DSRM password

Applies To: Windows Server 2008,Windows Server 2008,Windows Server 2003 with SP1,Windows Server 2003 with SP1,Windows Server 2003 R2,Windows Server 2003 R2,Windows Server 2003,Windows Server 2003

Resets the Directory Services Restore Mode (DSRM) password on a domain controller. At the Reset DSRM Administrator Password: prompt, type any of the parameters listed under “Syntax.”

This is a subcommand of Ntdsutil and Dsmgmt. Ntdsutil and Dsmgmt are command-line tools that are built into Windows Server 2008 and Windows Server 2008 R2. Ntdsutil is available if you have the Active Directory Domain Services (AD DS) or Active Directory Lightweight Directory Services (AD LDS) server role installed. Dsmgmt is available if you have the AD LDS server role installed. These tools are also available if you install the Active Directory Domain Services Tools that are part of the Remote Server Administration Tools (RSAT). For more information, see How to Administer Microsoft Windows Client and Server Computers Locally and Remotely (http://go.microsoft.com/fwlink/?LinkID=177813).

To use either of these tools, you must run them from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
Reset Password on server %s

Parameters

Parameter Description

Reset Password on server %s

Prompts for a new DSRM password for a domain controller. Use NULL as the domain controller name to reset the DSRM password on the current server. After you enter this parameter, the Please type password for DS Restore Mode Administrator Account: prompt appears. At this prompt, type the desired new DSRM password.

Sync from domain account %s

Note
This parameter is available on domain controllers that run Windows Server 2008 R2 or Windows Server 2008 with Service Pack 3 or later or have installed hotfix 961320 (http://go.microsoft.com/fwlink/?LinkId=197407).

Perform one-time password synchronization from the specified user name %s from this Active Directory domain to the DSRM administrator account on the local computer. For a link to more information, see Remarks section.

%s

An alphanumeric variable, such as a domain or domain controller name.

quit

Takes you back to the previous menu, or exits the utility.

?

Displays Help at the command prompt.

Help

Displays Help at the command prompt.

Remarks

  • The DSRM password on a domain controller is initially set when the Active Directory Installation Wizard (Dcpromo) is run on a server to promote it to a domain controller.

  • If the domain controller is in DSRM, you cannot reset the DSRM password on a domain controller using Ntdsutil.

  • For more information about how to synchronize the DSRM account password on a local domain controller with the password of a domain user account, see DS Restore Mode Password Maintenance (http://go.microsoft.com/fwlink/?LinkId=197408).

  • Ntdsutil does not correctly handle special characters, such as the apostrophe character ('), that you can enter at the ntdsutil: prompt at the command line. In some situations, there may be an alternative workaround. For more information, see local roles (http://go.microsoft.com/fwlink/?LinkId=157320).

Examples

To rest the DSRM password on a domain controller named DC2, type the following command, and then press ENTER:

Copy Code
Reset DSRM Administrator Password: reset password on server DC2

Additional references

Command-Line Syntax Key

Dsmgmt

Ntdsutil

authoritative restore

configurable settings

DS behavior

files

group membership evaluation

ifm

LDAP policies

local roles

metadata cleanup

partition management

roles

security account management

semantic database analysis

snapshot


Dsmod

Applies To: Windows Server 2003,Windows Server 2003 R2,Windows Server 2003 with SP1,Windows Server 2008

Modifies an existing object of a specific type in the directory.

Dsmod is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) server role installed. To use dsmod, you must run the dsmod command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

Commands

Command | Description
Dsmod computer | Modifies attributes of one or more existing computers in the directory.
Dsmod contact | Modifies attributes of one or more existing contacts in the directory.
Dsmod group | Modifies attributes of one or more existing groups in the directory.
Dsmod ou | Modifies attributes of one or more existing organizational units (OUs) in the directory.
Dsmod server | Modifies properties of a domain controller.
Dsmod user | Modifies attributes of one or more existing users in the directory.
Dsmod quota | Modifies attributes of one or more existing quota specifications in the directory.
Dsmod partition | Modifies attributes of one or more existing partitions in the directory.


Dsmod computer

Applies To: Windows Server 2008

Modifies attributes of one or more existing computers in the directory.

Dsmod is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) server role installed. To use dsmod, you must run the dsmod command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsmod computer <ComputerDN> ... [-desc <Description>] [-loc <Location>] [-disabled {yes | no}] [-reset] [{-s Server> | -d Domain>}] [-u <UserName>] [-p {<Password> | *}] [-c] [-q] [{-uc | -uco | -uci}]

Parameters

Parameter Description

<ComputerDN>

Required. Specifies the distinguished names of one or more computers that you want to modify. If values are omitted, they are obtained through standard input (stdin) to support piping of output from another command to input of this command.

-desc <Description>

Specifies the description of the computer object that you want to modify.

-loc <Location>

Specifies the location of the computer object you want to modify.

-disabled {yes | no}

Specifies if the computer account is disabled for logon (yes) or not (no).

-reset

Resets computer accounts.

{-s <Server> | -d <Domain>}

Connects a computer to a remote server or domain that you specify. By default, dsmod connects the computer to the domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, Linda@widgets.contoso.com)

-p {<Password> | *}

Specifies to use either a password or an asterisk (*) to log on to a remote server. If you type *, dsmod prompts you for a password.

-c

Reports errors, but continues with the next object in the argument list when you specify multiple target objects (continuous operation mode). If you do not supply this parameter, dsmod exits when the first error occurs.

-q

Suppresses all output to standard output (quiet mode).

{-uc | -uco | -uci}

Specifies that dsmod formats output or input data in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

/?

Displays help at the command prompt.

Remarks

  • This command supports only a subset of commonly used object class attributes.

  • If a value that you supply contains spaces, use quotation marks around the text, for example, "CN=DC2,OU=Domain Controllers,DC=Contoso,DC=Com".

  • If you supply multiple values for a parameter, use spaces to separate the values, for example, a list of distinguished names.

  • Dsmod does not support the addition of security principals in one forest to groups that are located in another forest when a forest trust exists between both forests. You can use Active Directory Users and Computers to add security principals across a forest trust.

Examples

To disable multiple computer accounts, type:

Copy Code
dsmod computer CN=MemberServer1,CN=Computers,DC=Microsoft,DC=Com  CN=MemberServer2,CN=Computers,DC=Microsoft,DC=Com -disabled yes

To reset multiple computer accounts, type:

Copy Code
dsmod computer CN=MemberServer1,CN=Computers,DC=Microsoft,DC=Com  CN=MemberServer2,CN=Computers,DC=Microsoft,DC=Com -reset

Additional references

Command-Line Syntax Key

Dsmod

Dsmod contact

Dsmod group

Dsmod ou

Dsmod server

Dsmod user

Dsmod quota

Dsmod partition


Dsmod contact

Applies To: Windows Server 2008

Modifies attributes of one or more existing contacts in the directory.

Dsmod is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) server role installed. To use dsmod, you must run the dsmod command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsmod contact <ContactDN> ... [-fn <FirstName>] [-mi <Initial>] [-ln <LastName>] [-display <DisplayName>] [-desc <Description>] [-office <Office>] [-tel <PhoneNumber>] [-email <Email>] [-hometel <HomePhoneNumber>] [-pager <PagerNumber>] [-mobile <CellPhoneNumber>] [-fax <FaxNumber>] [-iptel <IPPhoneNumber>] [-title <Title>] [-dept <Department>] [-company <Company>] [{-s <Server> | -d <Domain>}] [-u <UserName>][-p {<Password> | *}] [-c] [-q] [{-uc | -uco | -uci}]

Parameters

Parameter Description

<ContactDN>

Required. Specifies the distinguished names of the contacts that you want to modify. If values are omitted, they are obtained through standard input (stdin) to support piping of output from another command to input of this command.

-fn <FirstName>

Specifies the first name of the contact that you want to modify.

-mi <Initial>

Specifies the middle initial of the contact that you want to modify.

-ln <LastName>

Specifies the last name of the contact that you want to modify.

-display <DisplayName>

Specifies the display name of the contact that you want to modify.

-desc <Description>

Specifies the description of the contact that you want to modify.

-office <Office>

Specifies the office location of the contact that you want to modify.

-tel <PhoneNumber>

Specifies the telephone number of the contact that you want to modify.

-email <Email>

Specifies the e-mail address of the contact that you want to modify.

-hometel <HomePhoneNumber>

Specifies the home telephone number of the contact that you want to modify.

-pager <PagerNumber>

Specifies the pager number of the contact that you want to modify.

-mobile <CellPhoneNumber>

Specifies the mobile number of the contact that you want to modify.

-fax <FaxNumber>

Specifies the fax number of the contact that you want to modify.

-iptel <IPPhoneNumber>

Specifies the IP phone number of the contact that you want to modify.

-title <Title>

Specifies the title of the contact that you want to modify.

-dept <Department>

Specifies the department of the contact that you want to modify.

-company <Company>

Specifies the company information of the contact that you want to modify.

{-s <Server> | -d <Domain>}

Connects a computer to a remote server or domain that you specify. By default, dsmod connects the computer to the domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, Linda@widgets.contoso.com)

-p {<Password> | *}

Specifies to use either a password or an asterisk (*) to log on to a remote server. If you type *, dsmod prompts you for a password.

-c

Reports errors, but continues with the next object in the argument list when you specify multiple target objects (continuous operation mode). If you do not supply this parameter, dsmod exits when the first error occurs.

-q

Suppresses all output to standard output (quiet mode).

{-uc | -uco | -uci}

Specifies that dsmod formats output or input data in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

/?

Displays help at the command prompt.

Remarks

  • If a value that you supply contains spaces, use quotation marks around the text, for example, "CN=Mike Danseglio,OU=Contacts,DC=Contoso,DC=Com".

  • If you supply multiple values for a parameter, use spaces to separate the values, for example, a list of distinguished names.

  • Dsmod does not support the addition of security principals in one forest to groups that are located in another forest when a forest trust is between both forests. You can use Active Directory Users and Computers to add security principals across a forest trust.

Examples

To set the company information of multiple contacts, type:

Copy Code
dsmod contact "CN=Mike Danseglio,OU=Contacts,DC=Contoso,DC=Com" "CN=Denise Smith,OU=Contacts,DC=Contoso,DC=Com" -company Contoso

Additional references

Command-Line Syntax Key

Dsmod

Dsmod computer

Dsmod group

Dsmod ou

Dsmod server

Dsmod user

Dsmod quota

Dsmod partition


Dsmod group

Applies To: Windows Server 2008

Modifies attributes of one or more existing groups in the directory.

Dsmod is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) server role installed. To use dsmod, you must run the dsmod command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsmod group <GroupDN> ... [-samid <SAMName>] [-desc <Description>] [-secgrp {yes | no}] [-scope {l | g | u}] [{-addmbr | -rmmbr | -chmbr} <MemberDN> ...] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-c] [-q] [{-uc | -uco | -uci}]

Parameters

Parameter Description

<GroupDN>

Required. Specifies the distinguished names of the groups you want to modify. If values are omitted, they are obtained through standard input (stdin) to support piping of output from another command to input of this command. If you use GroupDN and MemberDN together, then only one parameter can be taken from standard input, and you must specify at least one parameter at the command line.

-samid <SAMName>

Specifies the Security Account Manager (SAM) account names of the groups that you want to modify.

-desc <Description>

Specifies the descriptions of the groups that you want to modify.

-secgrp {yes | no}

Sets the group types to security group (yes) or distribution group (no).

-scope {l | g | u}

Sets the scope of the groups that you want to modify to local, global, or universal. If the domain is in mixed mode, then AD DS does not support universal scope. Also, it is not possible to convert a domain local group to a global group, or vice versa.

{-addmbr | -rmmbr | -chmbr} <MemberDN>

Specifies to add members to, remove them from, or replace them in a group. MemberDN specifies the members that the operation affects. You can specify only one of these parameters in any command invocation.

MemberDN specifies the distinguished names of one or more members for AD DS to add to, delete from, or replace in the group that GroupDN specifies. You must give each member a distinguished name, for example, CN=Mike Danseglio,OU=Users,DC=Contoso,DC=Com. The list of members must follow the -addmbr, -rmmbr, and -chmbr parameters. If values are omitted, they are obtained through standard input (stdin) to support piping of output from another command to input of this command. If you use GroupDN and MemberDN together, then dsmod takes only one parameter from stdin, which requires you to specify at least one parameter at the command prompt.

{-s <Server> | -d <Domain>}

Connects a computer to a remote server or domain that you specify. By default, dsmod connects the computer to the domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, Linda@widgets.contoso.com)

-p {<Password> | *}

Specifies to use either a password or an asterisk (*) to log on to a remote server. If you type *, dsmod prompts you for a password.

-c

Reports errors, but continues with the next object in the argument list when you specify multiple target objects (continuous operation mode). If you do not supply this parameter, dsmod exits when the first error occurs.

-q

Suppresses all output to standard output (quiet mode).

{-uc | -uco | -uci}

Specifies that dsmod formats output or input data in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

/?

Displays help at the command prompt.

Remarks

  • If a value that you supply contains spaces, use quotation marks around the text, for example, "CN=USA Sales,OU=DistributionLists,DC=Contoso,DC=Com".

  • If you supply multiple values for a parameter, use spaces to separate the values, for example, a list of distinguished names.

  • Dsmod does not support the addition of security principals in one forest to groups that are located in another forest when a forest trust joins both forests. You can use Active Directory Users and Computers to add security principals across a forest trust.

Examples

To add the user Mike Danseglio to all administrator distribution list groups, type:

Copy Code
dsquery group "OU=Distribution Lists,DC=contoso,DC=com" -name  adm* | dsmod group -addmbr  "CN=Mike Danseglio,CN=Users,DC=contoso,DC=com"

To add all members of the US Info group to the Canada Info group, type:

Copy Code
dsget group  "CN=US INFO,OU=Distribution Lists,DC=contoso,DC=com"  -members | dsmod group  "CN=CANADA INFO,OU=Distribution Lists,DC= contoso,DC=com"  -addmbr

To convert the group type of several groups from security to nonsecurity, type:

Copy Code
dsmod group  "CN=US Info,OU=Distribution Lists,DC=Contoso,DC=Com"  "CN=Canada Info,OU=Distribution Lists,DC=Contoso,DC=Com"  "CN=Mexico Info,OU=Distribution Lists,DC=Contoso,DC=Com"  -secgrp no

To add two new members to the group "CN=US Info,OU=Distribution Lists,DC=Contoso,DC=Com", type:

Copy Code
dsmod group  "CN=US Info,OU=Distribution Lists,DC=Contoso,DC=Com"  -addmbr "CN=Mike Danseglio,CN=Users,DC=Contoso,DC=Com"  "CN=Legal,OU=Distribution Lists,DC=Contoso,DC=Com"  "CN=Denise Smith,CN=Users,DC=Contoso,DC=Com"

To add all users from the Marketing organizational unit (OU) to the existing group Marketing Staff, type:

Copy Code
dsquery user OU=Marketing,DC=Contoso,DC=Com | dsmod group "CN=Marketing Staff,OU=Marketing,DC=Contoso,DC=Com" -addmbr

To remove users in the Marketing organizational unit (OU) from the existing group Marketing Staff, type:

Copy Code
dsquery user OU=Marketing,DC=Contoso,DC=Com | dsmod group "CN=Marketing Staff,OU=Marketing,DC=Contoso,DC=Com" -rmmbr

To delete two members from the existing group "CN=US Info,OU=Distribution Lists,DC=Contoso,DC=Com", type:

Copy Code
dsmod group  "CN=US Info,OU=Distribution Lists,DC=Contoso,DC=Com"  -rmmbr "CN=Mike Danseglio,CN=Users,DC=Contoso,DC=Com"  "CN=Legal,OU=Distribution Lists,DC=Contoso,DC=Com"

Additional references

Command-Line Syntax Key

Dsmod

Dsmod computer

Dsmod contact

Dsmod ou

Dsmod server

Dsmod user

Dsmod quota

Dsmod partition


Dsmod ou

Applies To: Windows Server 2008

Modifies attributes of one or more existing organizational units (OUs) in the directory.

Dsmod is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) server role installed. To use dsmod, you must run the dsmod command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsmod ou <OrganizationalUnitDN> [-desc <Description>] [{-s <Server> | -d Domain>}] [-u <UserName>] [-p {<Password> | *}] [-c] [-q] [{-uc | -uco | -uci}]

Parameters

Parameter Description

<OrganizationalUnitDN>

Required. Specifies the distinguished names of the OUs that you want to modify. If values are omitted, they are obtained through standard input (stdin) to support piping of output from another command to input of this command.

-desc <Description>

Specifies the description of the OU that you want to modify.

{-s <Server> | -d<Domain>}

Connects a computer to a remote server or domain that you specify. By default, dsmod connects the computer to the domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, Linda@widgets.contoso.com)

-p {<Password> | *}

Specifies to use either a password or an asterisk (*) to log on to a remote server. If you type *, dsmod prompts you for a password.

-c

Reports errors, but continues with the next object in the argument list when you supply multiple target objects (continuous operation mode). If you do not supply this parameter, dsmod exits when the first error occurs.

-q

Suppresses all output to standard output (quiet mode).

{-uc | -uco | -uci}

Specifies that dsmod formats output or input data in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

/?

Displays help at the command prompt.

Remarks

  • If a value that you supply contains spaces, use quotation marks around the text, for example, "OU=Domain Controllers,DC=Contoso,DC=Com".

  • If you supply multiple values for a parameter, use spaces to separate the values, for example, a list of distinguished names.

  • Dsmod does not support the addition of security principals in one forest to groups that are located in another forest when a forest trust joins both forests. You can use Active Directory Users and Computers to add security principals across a forest trust.

Examples

To change the description of several OUs at the same time, type:

Copy Code
dsmod ou "OU=Domain Controllers,DC=Contoso,DC=Com" "OU=Resources,DC=Contoso,DC=Com" "OU=Troubleshooting,DC=Contoso,DC=Com" -desc "This is a test OU"

Additional references

Command-Line Syntax Key

Dsmod

Dsmod computer

Dsmod contact

Dsmod group

Dsmod server

Dsmod user

Dsmod quota

Dsmod partition


Dsmod server

Applies To: Windows Server 2008

Modifies properties of a domain controller.

Dsmod is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) server role installed. To use dsmod, you must run the dsmod command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsmod server <ServerDN> ... [-desc <Description>] [-isgc {yes | no}] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-c] [-q] [{-uc | -uco | -uci}]

Parameters

Parameter Description

<ServerDN>

Required. Specifies the distinguished names of one or more servers that you want to modify. If values are omitted, they are obtained through standard input (stdin) to support piping of output from another command to input of this command.

-desc <Description>

Specifies the description of the server that you want to modify.

-isgc {yes | no}

Adds the global catalog to (yes) or removes it from (no) a domain controller.

{-s <Server> | -d <Domain>}

Connects a computer to a remote server or domain that you specify. By default, dsmod connects the computer to the domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, Linda@widgets.contoso.com)

-p {<Password> | *}

Specifies to use either a password or an asterisk (*) to log on to a remote server. If you type *, dsmod prompts you for a password.

-c

Reports errors, but continues with the next object in the argument list when you specify multiple target objects (continuous operation mode). If you do not supply this parameter, dsmod exits when the first error occurs.

-q

Suppresses all output to standard output (quiet mode).

{-uc | -uco | -uci}

Specifies that output or input data is formatted in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

/?

Displays help at the command prompt.

Remarks

  • If a value that you supply contains spaces, use quotation marks around the text, for example, "CN=My Server,CN=Servers,CN=Site10,CN=Sites,CN=Configuration,DC=Contoso,DC=Com".

  • If you supply multiple values for a parameter, use spaces to separate the values, for example, a list of distinguished names.

  • Dsmod does not support the addition of security principals in one forest to groups that are located in another forest when a forest trust joins both forests. You can use Active Directory Users and Computers to add security principals across a forest trust.

Examples

To enable the domain controllers CORPDC1 and CORPDC9 to become global catalog servers, type:

Copy Code
dsmod server "CN=CORPDC1,CN=Servers,CN=Site1,CN=Sites,CN=Configuration,DC=Microsoft,DC=Com" "CN=CORPDC9,CN=Servers,CN=Site2,CN=Sites,CN=Configuration,DC=Microsoft,DC=Com" -isgc yes

Additional references

Command-Line Syntax Key

Dsmod

Dsmod computer

Dsmod contact

Dsmod group

Dsmod ou

Dsmod user

Dsmod quota

Dsmod partition


Dsmod user

Applies To: Windows Server 2008

Modifies attributes of one or more existing users in the directory.

Dsmod is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) server role installed. To use dsmod, you must run the dsmod command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsmod user <UserDN> ... [-upn <UPN>] [-fn <FirstName>] [-mi <Initial>] [-ln <LastName>] [-display <DisplayName>] [-empid <EmployeeID>] [-pwd (<Password> | *)] [-desc <Description>] [-office <Office>] [-tel <PhoneNumber>] [-email <E-mailAddress>] [-hometel <HomePhoneNumber>] [-pager <PagerNumber>] [-mobile <CellPhoneNumber>] [-fax <FaxNumber>] [-iptel <IPPhoneNumber>] [-webpg <WebPage>] [-title <Title>] [-dept <Department>] [-company <Company>] [-mgr <Manager>] [-hmdir <HomeDirectory>] [-hmdrv <DriveLetter>:] [-profile <ProfilePath>] [-loscr <ScriptPath>] [-mustchpwd {yes | no}] [-canchpwd {yes | no}] [-reversiblepwd {yes | no}] [-pwdneverexpires {yes | no}] [-acctexpires <NumberOfDays>] [-disabled {yes | no}] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}][-c] [-q] [{-uc | -uco | -uci}]

Parameters

Parameter Description

<UserDN>

Required. Specifies the distinguished names of the users that you want to modify. If values are omitted, they are obtained through standard input (stdin) to support piping of output from another command to input of this command.

-upn <UPN>

Specifies the user principal names (UPNs) of the users that you want to modify, for example, Linda@widgets.contoso.com.

-fn <FirstName>

Specifies the first names of the user objects you want to modify.

-mi <Initial>

Specifies the middle initials of the user objects you want to modify.

-ln <LastName>

Specifies the last names of the user objects you want to modify.

-display <DisplayName>

Specifies the display names of the user objects you want to modify.

-empid <EmployeeID>

Specifies the employee IDs of the user objects you want to modify.

-pwd {<Password> | *}

Resets the passwords for the users that you want to modify as Password or an asterisk (*). If you type *, AD DS prompts you for a user password.

-desc <Description>

Specifies the descriptions of the user objects you want to modify.

-office <Office>

Specifies the office locations of the user objects you want to modify.

-tel <PhoneNumber>

Specifies the telephone numbers of the user objects you want to modify.

-email <E-mailAddress>

Specifies the e-mail addresses of the user objects you want to modify.

-hometel <HomePhoneNumber>

Specifies the home telephone numbers of the user objects you want to modify.

-pager <PagerNumber>

Specifies the pager numbers of the user objects you want to modify.

-mobile <CellPhoneNumber>

Specifies the cell numbers of the user objects you want to modify.

-fax <FaxNumber>

Specifies the fax numbers of the user objects you want to modify.

-iptel <IPPhoneNumber>

Specifies the IP phone numbers of the user objects you want to modify.

-webpg <WebPage>

Specifies the Web page URLs of the user objects you want to modify.

-title <Title>

Specifies the titles of the user objects you want to modify.

-dept <Department>

Specifies the departments of the user objects you want to modify.

-company <Company>

Specifies the company information of the user objects you want to modify.

-mgr <Manager>

Specifies the distinguished names of the managers of the user objects you want to modify.

You can only use the distinguished name format to specify the manager.

-hmdir <HomeDirectory>

Specifies the home directory locations of the user objects you want to modify. If HomeDirectory is given as a UNC name, you must specify a mapped drive to this path by using the -hmdrv parameter.

-hmdrv <DriveLetter> :

Specifies the home directory drive letters (for example, E:) of the user objects you want to modify.

-profile <ProfilePath>

Specifies the profile paths of the user objects you want to modify.

-loscr <ScriptPath>

Specifies the logon script paths of the user objects you want to modify.

-mustchpwd{ yes| no}

Specifies whether users must change their passwords when they next log on. The available values are yes and no. Yes indicates that users must change their passwords and no indicates that they do not have to change their passwords.

-canchpwd {yes | no}

Specifies whether users can change their passwords. The available values are yes and no. Yes indicates that users can change their passwords and no indicates that they cannot change their passwords. The value of this parameter must be yes if the value of the -mustchpwd parameter is yes.

-reversiblepwd {yes | no}

Specifies whether AD DS stores user passwords by using reversible encryption. The available values are yes and no. Yes indicates that AD DS stores user passwords by using reversible encryption and no indicates that AD DS does not store user passwords by using reversible encryption.

-pwdneverexpires {yes | no}

Specifies whether user accounts never expire. The available values are yes and no. Yes indicates that user passwords never expire and no indicates that user passwords do expire.

-acctexpires <NumberOfDays>

Specifies the number of days from today that the user accounts expire. A value of 0 sets expiration at the end of today. A positive value sets expiration in the future. A negative value sets expiration in the past. The value of never sets the account to never expire. For example, a value of 0 specifies that the account expires at the end of today. A value of -5 specifies that the account expires 5 days in the past. A value of 5 specifies that the account expires 5 days in the future.

-disabled {yes | no}

Specifies whether AD DS disables user accounts for logon. The available values are yes and no. Yes indicates that AD DS disables user accounts for logon and no indicates that AD DS does not disable user accounts for logon.

{-s <Server> | -d <Domain>}

Connects a computer to a remote server or domain that you specify. By default, dsmod connects the computer to the domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, Linda@widgets.contoso.com)

-p {<Password> | *}

Specifies to use either a password or an asterisk (*) to log on to a remote server. If you type *, dsmod prompts you for a password.

-c

Reports errors, but continues with the next object in the argument list when you specify multiple target objects (continuous operation mode). If you do not supply this parameter, dsmod exits when the first error occurs.

-q

Suppresses all output to standard output (quiet mode).

{-uc | -uco | -uci}

Specifies that output or input data is formatted in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

/?

Displays help at the command prompt.

Remarks

  • If a value that you supply contains spaces, use quotation marks around the text, for example, "CN=Mike Danseglio,CN=Users,DC=Contoso,DC=Com".

  • If you supply multiple values for a parameter, use spaces to separate the values, for example, a list of distinguished names.

  • You can use the token $username$ (case insensitive) to replace the Security Accounts Manager (SAM) account name in the value of the -webpg, -profile, -hmdir, and -email parameters. For example, if a SAM account name is Denise, you can use either of the following formats for the -hmdir location parameter:

    -hmdir \users\Denise\home

    -hmdir \users\$username$\home

  • This command supports only a subset of commonly used object class attributes.

  • Dsmod does not support the addition of security principals in one forest to groups that are located in another forest when a forest trust joins both forests. You can use Active Directory Users and Computers to add security principals across a forest trust.

Examples

To reset the password for Don Funk and force him to change his password when he next logs on to the network, type:

Copy Code
dsmod user "CN=Don Funk,CN=Users,DC=Contoso,DC=Com" -pwd A1b2C3d4 -mustchpwd yes

To reset multiple user passwords to a common password and force users to change their passwords when they next log on to the network, type:

Copy Code
dsmod user "CN=Don Funk,CN=Users,DC=Contoso,DC=Com" "CN=Denise Smith,CN=Users,DC=Contoso,DC=Com" -pwd A1b2C3d4 -mustchpwd yes

To disable multiple user accounts at the same time, type:

Copy Code
dsmod user "CN=Don Funk,CN=Users,DC=Contoso,DC=Com" "CN=Denise Smith,CN=Users,DC=Contoso,DC=Com" -disabled yes

To modify the profile path of multiple users to a common path using the $username$ token, type:

Copy Code
dsmod user "CN=Don Funk,CN=Users,DC=Contoso,DC=Com" "CN=Denise Smith,CN=Users,DC=Contoso,DC=Com" -profile \users\$username$\profile

Additional references

Command-Line Syntax Key

Dsmod

Dsmod computer

Dsmod contact

Dsmod group

Dsmod ou

Dsmod server

Dsmod quota

Dsmod partition


Dsmod quota

Applies To: Windows Server 2008

Modifies attributes of one or more existing quota specifications in the directory.

Dsmod is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) server role installed. To use dsmod, you must run the dsmod command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsmod quota <QuotaDN> ... [-qlimit <Value>] [-desc <Description>] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-c] [-q] [{-uc | -uco | -uci}]

Parameters

Parameter Description

<QuotaDN>

Required. Specifies the distinguished names of one or more quota specifications that you want to modify. If values are omitted, they are obtained through standard input (stdin) to support piping of output from another command to input of this command.

-qlimit <Value>

Specifies the number of objects in the directory partition that can be owned by the security principal to which the quota object is assigned. To specify an unlimited quota, use a value of -1.

-desc <Description>

Specifies the description of the quota specification that you want to modify.

{-s <Server> | -d <Domain>}

Connects a computer to a remote server or domain that you specify. By default, dsmod connects the computer to a domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, Linda@widgets.contoso.com)

-p {<Password> | *}

Specifies to use either a password or an asterisk (*) to log on to a remote server. If you type *, dsmod prompts you for a password.

-c

Reports errors, but continues with the next object in the argument list when you specify multiple target objects (continuous operation mode). If you do not supply this parameter, dsmod quits after the first error occurs.

-q

Suppresses all output to standard output (quiet mode).

{-uc | -uco | -uci}

Specifies that output or input data is formatted in Unicode. The following list explains format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

/?

Displays help at the command prompt.

Remarks

  • Dsmod quota supports only a subset of commonly used object class attributes.

  • If a value that you use contains spaces, use quotation marks around the text, for example, "CN=DC2,OU=Domain Controllers,DC=Contoso,DC=Com".

  • If you use multiple values for an option, use spaces to separate the values, for example, a list of distinguished names.

  • Dsmod quota does not support the addition of security principals in one forest to groups that are located in another forest when a forest trust joins both forests. You can use Active Directory Users and Computers to add security principals across a forest trust.

Examples

To change the quota limit for a quota named DN1 to a value of 100, type:

Copy Code
dsmod quota DN1 -qlimit 100

Additional references

Command-Line Syntax Key

Dsmod

Dsmod computer

Dsmod contact

Dsmod group

Dsmod ou

Dsmod server

Dsmod user

Dsmod partition


Dsmod partition

Applies To: Windows Server 2008

Modifies attributes of one or more existing partitions in the directory.

Dsmod is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) server role installed. To use dsmod, you must run the dsmod command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsmod partition <PartitionDN> ... [-qdefault <Value>] [-qtmbstnwt <Percent>] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-c] [-q] [{-uc | -uco | -uci}]

Parameters

Term Definition

<PartitionDN>

Specifies the distinguished names of one or more directory partitions that you want to modify. If values are omitted, they are obtained through standard input (STDIN) to support piping of output from another command to input of this command.

-qdefault <Value>

Specifies that the default quota for the directory partition be set to Value. The default quota applies to any security principal (user, group, computer or inetOrgPerson) who owns an object in the directory partition, if no quota specification exists that governs the security principal. To specify an unlimited quota, use a value of -1.

-qtmbstnwt <Percent>

Required. Sets the percentage by which tombstone object count should be reduced when calculating quota usage. You must specify a value between 0 and 100 for Percent. For example, a value of 25 means that a tombstone object counts as 25% of a normal object when AD DS calculates quota use. If you assign a quota of 100 to a user, that user can own a maximum of 100 normal objects or 400 tombstone objects in AD DS.

{-s <Server> | -d <Domain>}

Connects a computer to a remote server or domain that you specify. By default, dsmod connects the computer to a domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, Linda@widgets.contoso.com)

-p {<Password> | *}

Specifies to use either a password or an asterisk (*) to log on to a remote server. If you type *, dsmod prompts you for a password.

-c

Reports errors, but continues with the next object in the argument list when you specify multiple target objects specified (continuous operation mode). If you do not supply this parameter, dsmod exits when the first error occurs.

-q

Suppresses all output to standard output (quiet mode).

{-uc | -uco | -uci}

Specifies that output or input data is formatted in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

/?

Displays help at the command prompt.

Remarks

  • This command supports only a subset of commonly used object class attributes.

  • If a value that you use contains spaces, use quotation marks around the text, for example, "CN=DC2,OU=Domain Controllers,DC=Contoso,DC=Com".

  • The default quota applies to any security principal (for example, user, group, computer, or InetOrgPerson) that creates an object in the directory partition when no quota specification exists that governs the security principal.

  • The default quota for a specified directory partition is an attribute (that is, ms-DS-Default-Quota) of a special container of class ms-DS-Quota-Container, as specified by CN=NTDS Quotas,<DirectoryPartitionRootDN>.

  • The tombstone quota weight for a given directory partition (set with the -qtmbstnwt option) is an attribute (that is, ms-DS-Tombstone-Quota-Factor) of a special container of class (that is, ms-DS-Quota-Container), specified by CN=NTDS Quotas,<DirectoryPartitionRootDN>.

  • Dsmod does not support the addition of security principals in one forest to groups that are located in another forest when a forest trust joins both forests. You can use Active Directory Users and Computers to add security principals across a forest trust.

Examples

To change the default quota limit for a directory partition named NC1 to a value of 1000, type:

Copy Code
dsmod partition NC1 -qdefault 1000

Additional references

Command-Line Syntax Key

Dsmod

Dsmod computer

Dsmod contact

Dsmod group

Dsmod ou

Dsmod server

Dsmod user

Dsmod quota


Dsmove

Applies To: Windows Server 2008,Windows Server 2003 with SP1,Windows Server 2003 R2,Windows Server 2003

Moves a single object, within a domain, from its current location in the directory to a new location, or renames a single object without moving it in the directory tree.

Dsmove is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) or Active Directory Lightweight Directory Services (AD LDS) server role installed. To use dsmove, you must run the dsmove command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsmove <ObjectDN> [-newname <NewRDN>] [-newparent <ParentDN>] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-q] [{-uc | -uco | -uci}]

Parameters

Parameter Description

<ObjectDN>

Required. Specifies the distinguished name of the object that you want to move or rename. If the value is omitted, it is obtained through standard input (stdin) to support piping of output from another command to input of this command.

-newname <NewRDN>

Renames the object that you specify with a new relative distinguished name.

-newparent <ParentDN>

Specifies a new location for the object that you want to move. To specify the new location, you supply the distinguished name of the object's new parent.

{-s <Server> | -d <Domain>}

Connects a computer to a remote server or domain that you specify. By default, dsmove connects the computer to the domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, Linda@widgets.contoso.com)

-p {<Password> | *}

Specifies to use a password or an asterisk (*) to log on to a remote server. If you type *, dsmove prompts you for a password.

-q

Suppresses all output to standard output (quiet mode).

{-uc | -uco | -uci}

Specifies that dsmove formats output or input data in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

/?

Displays help at the command prompt.

Remarks

  • If a value that you supply contains spaces, use quotation marks around the text, for example, "CN=Mike Danseglio,CN=Users,DC=Contoso,DC=Com".

  • If you supply multiple values for a parameter, use spaces to separate the values, for example, a list of distinguished names.

Examples

To rename a user object from Kim Akers to Kim Ralls, type:

Copy Code
dsmove "CN=Kim Akers,OU=Sales,DC=Contoso,DC=Com" -newname "Kim Ralls"

To move the user object for Kim Akers from the Sales organization to the Marketing organization, type:

Copy Code
dsmove "CN=Kim Akers,OU=Sales,DC=Contoso,DC=Com" -newparent OU=Marketing,DC=Contoso,DC=Com

To combine the rename and move operations, type:

Copy Code
dsmove "CN=Kim Akers,OU=Sales,DC=Contoso,DC=Com" -newparent OU=Marketing,DC=Contoso,DC=Com -newname "Kim Ralls"

Additional references

Command-Line Syntax Key


Dsquery

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Server 2003 with SP1,Windows Server 2003,Windows Server 2003 R2

Queries the directory by using search criteria that you specify. Each of the dsquery commands finds objects of a specific object type, with the exception of dsquery *, which can query for any type of object

Dsquery is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) server role installed. To use dsquery, you must run the dsquery command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

Commands

Command | Description
Dsquery computer | Finds computers in the directory that match search criteria that you specify.
Dsquery contact | Finds contacts in the directory that match search criteria that you specify.
Dsquery group | Finds groups in the directory that match search criteria that you specify. If the predefined search criteria in this command are insufficient, use the general version of the query command, dsquery *.
Dsquery ou | Finds organizational units (OUs) in the directory that match search criteria that you specify. If the predefined search criteria in this command are insufficient, use the more general version of the query command, dsquery *.
Dsquery site | Finds sites in the directory that match search criteria that you specify. If the predefined search criteria in this command are insufficient, use the more general version of the query command, dsquery *.
Dsquery server | Finds domain controllers according to specified search criteria. If the predefined search criteria in this command are insufficient, use the more general version of the query command, dsquery *.
Dsquery user | Finds users in the directory that match search criteria that you specify. If the predefined search criteria in this command are insufficient, use the more general version of the query command, dsquery *.
Dsquery quota | Finds quota specifications in the directory that match search criteria that you specify. A quota specification determines the maximum number of directory objects a specified security principal can own in a given directory partition. If the predefined search criteria in this command are insufficient, use the more general version of the query command, dsquery *.
Dsquery partition | Finds partition objects in the directory that match search criteria that you specify. If the predefined search criteria in this command are insufficient, use the more general version of the query command, dsquery *.
Dsquery * | Finds any objects in the directory according to criteria using an LDAP query.


Dsquery computer

Applies To: Windows Server 2008 R2,Windows Server 2008

Finds computers in the directory that match search criteria that you specify.

Dsquery is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) server role installed. To use dsquery, you must run the dsquery command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsquery computer [{<StartNode> | forestroot | domainroot}] [-o {dn | rdn | samid}] [-scope {subtree | onelevel | base}] [-name <Name>] [-desc <Description>] [-samid <SAMName>] [-inactive <NumberOfWeeks>] [-stalepwd <NumberOfDays>] [-disabled] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-q] [-r] [-gc] [-limit <NumberOfObjects>] [{-uc | -uco | -uci}]

Parameters

Parameter Description

{<StartNode> | forestroot | domainroot}

Specifies the node in the console tree where the search starts. You can specify the forest root (forestroot), domain root (domainroot), or distinguished name of a node as the start node (<StartNode>). If you specify forestroot, dsquery searches by using the global catalog. The default value is domainroot.

-o {dn | rdn | samid}

Specifies the format that dsquery uses to display the search results. A dn value displays the distinguished name of each entry. An rdn value displays the relative distinguished name of each entry. A samid value displays the Security Accounts Manager (SAM) account name of each entry. The default value is dn.

-scope {subtree | onelevel | base}

Specifies the scope of the search. A subtree value specifies a subtree that is rooted at the start node in the console tree. A onelevel value specifies the immediate children of the start node only. A base value specifies the single object that the start node represents. If you specify forestroot as the start node (<StartNode>), subtree is the only valid scope. The default value is subtree.

-name <Name>

Searches for computers whose name attributes (value of CN attribute) matches <Name>. For example, "jon*" or "*ith" or "j*th".

-desc <Description>

Searches for computers whose description attributes match <Description>. For example, "jon*", "*ith", or "j*th".

-samid <SAMName>

Searches for computers whose SAM account names match <SAMName>.

-inactive <NumberOfWeeks>

Searches for computers that have been inactive (stale) for the number of weeks that you specify.

-stalepwd <NumberOfDays>

Searches for computers whose passwords have not changed for the number of days that you specify.

-disabled

Searches for all computers whose accounts are disabled.

{-s <Server> | -d <Domain>}

Connects a computer to a remote server or domain that you specify. By default, dsquery connects the computer to the domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, Linda@widgets.contoso.com)

-p {<Password> | *}

Specifies to use either a password or an asterisk (*) to log on to a remote server. If you type *, dsquery prompts you for a password.

-q

Suppresses all output to standard output (quiet mode).

-r

Specifies that the search use recursion or follow referrals during search. By default, the search will not follow referrals.

-gc

Specifies that the search use the Active Directory global catalog.

-limit <NumberOfObjects>

Specifies the number of objects to return that matches the criteria that you specify. If you specify a value of 0 for <NumberOfObjects>, this parameter returns all matching objects. If you do not specify this parameter, dsquery displays the first 100 results by default.

{-uc | -uco | -uci}

Specifies that dsquery formats output or input data in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

/?

Displays help at the command prompt.

Remarks

  • AD DS can pipe the results from a dsquery search as input to one of the other command-line tools for the directory service, such as Dsget, Dsmod, Dsmove, or Dsrm.

  • If a value that you supply contains spaces, use quotation marks around the text, for example, "CN=Mike Danseglio,CN=Users,DC=Contoso,DC=Com".

  • If you supply multiple values for a parameter, use spaces to separate the values, for example, a list of distinguished names.

Examples

To find all computers in the current domain whose names start with "ms" and whose descriptions start with "desktop", and then display their distinguished names, type:

Copy Code
dsquery computer domainroot -name ms* -desc desktop*

To find all computers in the organizational unit (OU) that you specify in OU=Sales,dc=contoso,DC=Com, and then display their distinguished names, type:

Copy Code
dsquery computer OU=Sales,DC=Contoso,DC=Com

Additional references

Command-Line Syntax Key

Dsquery

Dsquery contact

Dsquery group

Dsquery ou

Dsquery site

Dsquery server

Dsquery user

Dsquery quota

Dsquery partition

Dsquery *


Dsquery contact

Applies To: Windows Server 2008,Windows Server 2008 R2

Finds contacts in the directory that match search criteria that you specify.

Dsquery is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) server role installed. To use dsquery, you must run the dsquery command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsquery contact [{<StartNode> | forestroot | domainroot}] [-o {dn | rdn}] [-scope {subtree | onelevel | base}] [-name <Name>] [-desc <Description>] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-q] [-r] [-gc] [-limit <NumberOfObjects>] [{-uc | -uco | -uci}]

Parameters

Parameter Description

{<StartNode> | forestroot | domainroot}

Specifies the node in the console tree where the search starts. You can specify the forest root (forestroot), domain root (domainroot), or distinguished name of a node as the start node (<StartNode>). If you specify forestroot, dsquery searches by using the global catalog. The default value is domainroot.

-o {dn | rdn}

Specifies the format that dsquery uses to display the search results. A dn value displays the distinguished name of each entry. An rdn value displays the relative distinguished name of each entry.

-scope {subtree | onelevel | base}

Specifies the scope of the search. A subtree value specifies a subtree that is rooted at the start node in the console tree. A onelevel value specifies the immediate children of the start node only. A base value specifies the single object that the start node represents. If you specify forestroot as the start node (<StartNode>), subtree is the only valid scope. The default value is subtree.

-name <Name>

Searches for contacts whose name attributes (value of CN attribute) matches <Name>. For example, "jon*" or "*ith" or "j*th".

-desc <Description>

Searches for contacts whose description attributes match <Description>. For example, "jon*", "*ith", or "j*th".

{-s <Server> | -d <Domain>}

Connects a computer to a remote server or domain that you specify. By default, dsquery connects the computer to the domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (such as, Linda)

  • domain\user name (such as, widgets\Linda)

  • user principal name (UPN) (such as, Linda@widgets.contoso.com)

-p {<Password> | *}

Specifies to use either a password or an asterisk (*) to log on to a remote server. If you type *, dsquery prompts you for a password.

-q

Suppresses all output to standard output (quiet mode).

-r

Specifies to use recursion or follow referrals during the search. By default, the search will not follow referrals during search.

-gc

Specifies to use the Active Directory global catalog during the search.

-limit <NumberOfObjects>

Specifies the number of objects to return that matches the criteria that you specify. If you specify a value of 0 for <NumberOfObjects>, this parameter returns all matching objects. If you do not specify this parameter, dsquery displays the first 100 results by default.

{-uc | -uco | -uci}

Specifies that dsquery formats output or input data in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

/?

Displays help at the command prompt.

Remarks

  • The results from a dsquery search can be piped as input to one of the other directory service command-line tools, such as Dsget, Dsmod, Dsmove, or Dsrm.

  • If a value that you supply contains spaces, use quotation marks around the text, for example, "CN=Mike Danseglio,CN=Users,DC=Contoso,DC=Com".

  • If you supply multiple values for a parameter, use spaces to separate the values, for example, a list of distinguished names.

Examples

To find all contacts in the current domain whose names start with "te", and then display their distinguished names, type:

Copy Code
dsquery contact domainroot -name te*

To find all contacts in the organizational unit (OU) that you specify in OU=Sales,DC=contoso,DC=Com, and then display their distinguished names, type:

Copy Code
dsquery contact OU=Sales,DC=Contoso,DC=Com

Additional references

Command-Line Syntax Key

Dsquery

Dsquery computer

Dsquery group

Dsquery ou

Dsquery site

Dsquery server

Dsquery user

Dsquery quota

Dsquery partition

Dsquery *


Dsquery group

Applies To: Windows Server 2008 R2,Windows Server 2008

Finds groups in the directory that match the search criteria that you specify. If the predefined search criteria in this command are insufficient, use the more general version of the query command, dsquery *.

Dsquery is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) server role installed. To use dsquery, you must run the dsquery command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsquery group [{<StartNode> | forestroot | domainroot}] [-o {dn | rdn | samid}] [-scope {subtree | onelevel | base}] [-name <Filter>] [-desc <Filter>] [-samid <Filter>] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-q] [-r] [-gc] [-limit <NumberOfObjects>] [{-uc | -uco | -uci}]

Parameters

Parameter Description

[{<StartNode> | forestroot | domainroot}

Specifies the node in the console tree where the search starts. You can specify the forest root (forestroot), domain root (domainroot), or distinguished name of a node as the start node (<StartNode>). If you specify forestroot, dsquery searches by using the global catalog. The default value is domainroot.

-o {dn | rdn | samid}

Specifies the format that dsquery uses to display the search results. A dn value displays the distinguished name of each entry. An rdn value displays the relative distinguished name of each entry. A samid value displays the Security Accounts Manager (SAM) account name of each entry. The default value is dn.

-scope {subtree | onelevel | base}

Specifies the scope of the search. A subtree value specifies a subtree that is rooted at the start node in the console tree. A onelevel value specifies the immediate children of the start node only. A base value specifies the single object that the start node represents. If you specify forestroot as the start node (<StartNode>), subtree is the only valid scope. The default value is subtree.

-name <Name>

Searches for groups whose name attributes (value of CN attribute) matches <Name>. For example, "jon*", "*ith", or "j*th".

-desc <Description>

Searches for groups whose description attributes match <Description>. For example, "jon*", "*ith", or "j*th".

-samid <SAMName>

Searches for groups whose SAM account name matches <SAMName>.

{-s <Server> | -d <Domain>}

Connects a computer to a remote server or domain that you specify. By default, dsquery connects the computer to the domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, Linda@widgets.contoso.com)

-p {<Password> | *}

Specifies to use either a password or an asterisk (*) to log on to a remote server. If you type *, dsquery prompts you for a password.

-q

Suppresses all output to standard output (quiet mode).

-r

Specifies that the search use recursion or follow referrals during search. By default, the search will not follow referrals during search.

-gc

Specifies that the search use the Active Directory global catalog.

-limit <NumberOfObjects>

Specifies the number of objects to return that matches the criteria that you specify. If you specify a value of 0 for <NumberOfObjects>, this parameter returns all matching objects. If you do not specify this parameter, dsquery displays the first 100 results by default.

{-uc | -uco | -uci}

Specifies that dsquery formats output or input data in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

/?

Displays help at the command prompt.

Remarks

  • The results from a dsquery search can be piped as input to one of the other directory service command-line tools, such as Dsget, Dsmod, Dsmove, or Dsrm.

  • If a value that you supply contains spaces, use quotation marks around the text, for example, "CN=Mike Danseglio,CN=Users,DC=Contoso,DC=Com".

  • If you supply multiple values for a parameter, use spaces to separate the values, for example, a list of distinguished names.

Examples

To find all groups in the current domain whose names start with "ms" and whose descriptions start with "admin", and then display their distinguished names, type:

Copy Code
dsquery group domainroot -name ms* -desc admin*

To find all groups in the domain DC=Contoso,DC=Com, and then display their distinguished names, type:

Copy Code
dsquery group DC=Contoso,DC=Com

Additional references

Command-Line Syntax Key

Dsquery

Dsquery computer

Dsquery contact

Dsquery ou

Dsquery site

Dsquery server

Dsquery user

Dsquery quota

Dsquery partition

Dsquery *


Dsquery ou

Applies To: Windows Server 2008,Windows Server 2008 R2

Finds organizational units (OUs) in the directory that match the search criteria that you specify. If the predefined search criteria in this command are insufficient, use the more general version of the query command, dsquery *.

Dsquery is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) server role installed. To use dsquery, you must run the dsquery command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsquery ou [{<StartNode> | forestroot | domainroot}] [-o {dn | rdn}][-scope {subtree | onelevel | base}][-name <Name] [-desc <Description>] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-q] [-r] [-gc] [-limit <NumberOfObjects>] [{-uc | -uco | -uci}]

Parameters

Parameter Description

{<StartNode> | forestroot | domainroot}

Specifies the node in the console tree where the search starts. You can specify the forest root (forestroot), domain root (domainroot), or distinguished name of a node as the start node (<StartNode>). If you specify forestroot, dsquery searches by using the global catalog. The default value is domainroot.

-o {dn | rdn}

Specifies the format that dsquery uses to display the search results. A dn value displays the distinguished name of each entry. An rdn value displays the relative distinguished name of each entry.

-scope {subtree | onelevel | base}

Specifies the scope of the search. A subtree value specifies that the scope is a subtree that is rooted at the start node of the console tree. A onelevel value specifies the immediate children of the start node only. A base value specifies the single object that the start node represents. If you specify forestroot as the start node (<StartNode>), subtree is the only valid scope. The default value is subtree.

-name <Name>

Searches for OUs whose name attributes (value of CN attribute) matches <Name>. For example, "jon*", "*ith", or "j*th".

-desc <Description>

Searches for OUs whose description attributes match <Description>. For example, "jon*", "*ith", or "j*th".

{-s <Server> | -d <Domain>}

Connects a computer to a remote server or domain that you specify. By default, dsquery connects the computer to the domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, Linda@widgets.contoso.com)

-p {<Password> | *}

Specifies to use either a password or an asterisk (*) to log on to a remote server. If you type *, dsquery prompts you for a password.

-q

Suppresses all output to standard output (quiet mode).

-r

Specifies that the search use recursion or follow referrals during search. By default, the search will not follow referrals during search.

-gc

Specifies that the search use the Active Directory global catalog.

-limit <NumberOfObjects>

Specifies the number of objects to return that matches the criteria that you specify. If you specify a value of 0 for <NumberOfObjects>, this parameter returns all matching objects. If you do not specify this parameter, dsquery displays the first 100 results by default.

{-uc | -uco | -uci}

Specifies that dsquery formats output or input data in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

/?

Displays help at the command prompt.

Remarks

  • The results from a dsquery search can be piped as input to one of the other directory service command-line tools, such as Dsget, Dsmod, Dsmove, or Dsrm.

  • If a value that you supply contains spaces, use quotation marks around the text, for example, "CN=Mike Danseglio,CN=Users,DC=Contoso,DC=Com".

  • If you supply multiple values for a parameter, use spaces to separate the values, for example, a list of distinguished names.

Examples

To find all OUs in the current domain whose names start with "ms" and whose descriptions start with "sales," and then display their distinguished names, type:

Copy Code
dsquery ou domainroot -name ms* -desc sales*

To find all OUs in the domain that you specify in DC=Contoso,DC=Com, and then display their distinguished names, type:

Copy Code
dsquery ou DC=Contoso,DC=Com

Additional references

Command-Line Syntax Key

Dsquery

Dsquery computer

Dsquery contact

Dsquery group

Dsquery site

Dsquery server

Dsquery user

Dsquery quota

Dsquery partition

Dsquery *


Dsquery site

Applies To: Windows Server 2008,Windows Server 2008 R2

Finds sites in the directory that match the search criteria that you specify. If the predefined search criteria in this command are insufficient, use the more general version of the query command, dsquery *.

Dsquery is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) server role installed. To use dsquery, you must run the dsquery command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsquery site [-o {dn | rdn}] [-name <Name>] [-desc <Description>] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-q] [-r] [-gc] [-limit <NumberOfObjects>] [{-uc | -uco | -uci}]

Parameters

Parameter Description

-o {dn | rdn}

Specifies the format that dsquery uses to display the search results. A dn value displays the distinguished name of each entry. An rdn value displays the relative distinguished name of each entry.

-name <Name>

Searches for sites whose name attributes (value of CN attribute) match <Name>. For example, "NA*" or "Europe*".

-desc <Description>

Searches for computers whose description attributes match <Description>. For example, "corp*" or "*nch".

{-s <Server> | -d <Domain>}

Connects a computer to a remote server or domain that you specify. By default, dsquery connects the computer to the domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, Linda@widgets.contoso.com)

-p {Password | *}

Specifies to use either a password or an asterisk (*) to log on to a remote server. If you type *, dsquery prompts you for a password.

-q

Suppresses all output to standard output (quiet mode).

-r

Specifies that the search use recursion or follow referrals. By default, the search does not follow referrals during search.

-gc

Specifies that the search use the Active Directory global catalog.

-limit <NumberOfObjects>

Specifies the number of objects to return that matches the criteria that you specify. If you specify a value of 0 for <NumberOfObjects>, this parameter returns all matching objects. If you do not specify this parameter, dsquery displays the first 100 results by default.

{-uc | -uco | -uci}

Specifies that dsquery formats output or input data in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

/?

Displays help at the command prompt.

Remarks

  • The results from a dsquery search can be piped as input to one of the other directory service command-line tools, such as Dsget, Dsmod, Dsmove, or Dsrm.

  • If a value that you supply contains spaces, use quotation marks around the text, for example, "CN=Mike Danseglio,CN=Users,DC=Contoso,DC=Com".

  • If you supply multiple values for a parameter, use spaces to separate the values, for example, a list of distinguished names.

Examples

To find all sites in North America with names that start with "north", and then display their distinguished names, type:

Copy Code
dsquery site -name north*

To list the relative distinguished names of all sites that are defined in the directory, type:

Copy Code
dsquery site -o rdn

Additional references

Command-Line Syntax Key

Dsquery

Dsquery computer

Dsquery contact

Dsquery group

Dsquery ou

Dsquery server

Dsquery user

Dsquery quota

Dsquery partition

Dsquery *


Dsquery server

Applies To: Windows Server 2008 R2,Windows Server 2008

Finds domain controllers that match search criteria that you specify. If the predefined search criteria in this command are insufficient, use the more general version of the query command, dsquery *.

Dsquery is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) server role installed. To use dsquery, you must run the dsquery command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsquery server [-o {dn | rdn}] [-forest] [-domain <DomainName>] [-site <SiteName>] [-name <Name>] [-desc <Description>] [-hasfsmo {schema | name | infr | pdc | rid}] [-isgc] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-q] [-r] [-gc] [-limit <NumberOfObjects>] [{-uc | -uco | -uci}]

Parameters

Parameter Description

-o {dn | rdn}

Specifies the format that dsquery uses to display the search results. A dn value displays the distinguished name of each entry. An rdn value displays the relative distinguished name of each entry. The default value is dn.

-forest

Searches for all domain controllers (server objects) that are part of the current forest.

-domain <DomainName>

Searches for all domain controllers (server objects) that are part of the domain whose Domain Name System (DNS) names you specify in <DomainName>. Search displays all domain controllers in the current domain by default.

-site <SiteName>

Searches for all domain controllers (server objects) that are part of the <SiteName> site.

-name <Name>

Searches for server objects whose name attributes (value of CN attribute) match <Name>. For example, "jon*", "*ith", or "j*th".

-desc <Description>

Searches for server objects whose description attributes match <Description>. For example, "jon*", "*ith", or "j*th".

[-hasfsmo {schema | name | infr | pdc | rid}

Searches for the domain controller (server object) that holds the operations master role that you specify.

The following list explains the possible values for this parameter.

  • schema: Specifies the schema master of the forest.

  • name: Specifies the domain naming master of the forest.

  • infr: Specifies the infrastructure master of the domain that you specify in the -domain parameter or the current domain if you do not specify the -domain parameter.

  • pdc: Specifies the primary domain controller (PDC) role owner of the domain that you specify in the -domain parameter or the current domain if you do not specify the -domain parameter.

  • rid: Specifies the relative identifier master (RID master) of the domain that you specify in the -domain parameter or the current domain if you do not specify the -domain parameter.

    If you do not specify a rid value in the -domain parameter, rid uses the current domain.

-isgc

Searches for all domain controllers (server objects) that are global catalog servers in the scope specified by any of the -forest, -domain, or -site scope parameters. If you specify none of those scope parameters, this parameter finds all global catalogs that are in the current domain.

{-s <Server> | -d <Domain>}

Connects a computer to a remote server or domain that you specify. By default, dsquery connects the computer to the domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, Linda@widgets.contoso.com)

-p {<Password> | *}

Specifies to use either a password or an asterisk (*) to log on to a remote server. If you type *, dsquery prompts you for a password.

-q

Suppresses all output to standard output (quiet mode).

-r

Specifies that the search use recursion or follow referrals during search. By default, the search will not follow referrals during search.

-gc

Specifies that the search use the Active Directory global catalog.

-limit <NumberOfObjects>

Specifies the number of objects to return that matches the criteria that you specify. If you specify a value of 0 for <NumberOfObjects>, this parameter returns all matching objects. If you do not specify this parameter, dsquery displays the first 100 results by default.

{-uc | -uco | -uci}

Specifies that dsquery formats output or input data in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

/?

Displays help at the command prompt.

Remarks

  • The results from a dsquery search can be piped as input to one of the other directory service command-line tools, such as Dsget, Dsmod, Dsmove, or Dsrm.

  • If a value that you supply contains spaces, use quotation marks around the text, for example, "CN=Mike Danseglio,CN=Users,DC=Contoso,DC=Com".

  • If you supply multiple values for a parameter, use spaces to separate the values, for example, a list of distinguished names.

Examples

To find all domain controllers in the current domain, type:

Copy Code
dsquery server

To find all domain controllers in the forest, and then display their relative distinguished names, type:

Copy Code
dsquery server -o rdn -forest

To find all domain controllers in the site whose names are United States, and then display their relative distinguished names, type:

Copy Code
dsquery server -o rdn -site United States

To find the domain controller in the forest that holds the schema operations master role, type:

Copy Code
dsquery server –forest –hasfsmo schema

To find all domain controllers in the domain widgets.contoso.com that are global catalog servers, type:

Copy Code
dsquery server –domain widgets.contoso.com -isgc

Additional references

Command-Line Syntax Key

Dsquery

Dsquery computer

Dsquery contact

Dsquery group

Dsquery ou

Dsquery site

Dsquery user

Dsquery quota

Dsquery partition

Dsquery *


Dsquery user

Applies To: Windows Server 2008 R2,Windows Server 2008

Finds users in the directory who match the search criteria that you specify. If the predefined search criteria in this command are insufficient, use the more general version of the query command, dsquery *.

Dsquery is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) server role installed. To use dsquery, you must run the dsquery command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsquery user [{<StartNode> | forestroot | domainroot}] [-o {dn | rdn | upn | samid}] [-scope {subtree | onelevel | base}] [-name <Name>] [-desc <Description>] [-upn <UPN>] [-samid <SAMName>] [-inactive <NumberOfWeeks>] [-stalepwd <NumberOfDays>] [-disabled] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-q] [-r] [-gc] [-limit <NumberOfObjects>] [{-uc | -uco | -uci}]

Parameters

Parameter Description

{<StartNode> | forestroot | domainroot}

Specifies the node in the console tree where the search starts. You can specify the forest root (forestroot), domain root (domainroot), or distinguished name of a node as the start node (<StartNode>). If you specify forestroot, dsquery searches by using the global catalog. The default value is domainroot.

[-o {dn | rdn | upn | samid}

Specifies the format in which the list of entries found by the search will be displayed. A dn value displays the distinguished name of each entry. An rdn value displays the relative distinguished name of each entry. A upn value displays the user principal name of each entry. A samid value displays the SAM account name of each entry. By default, the dn format is used.

-scope {subtree | onelevel | base}

Specifies the scope of the search. A subtree value specifies a subtree that is rooted at the start node in the console tree. A onelevel value specifies the immediate children of the start node only. A base value specifies the single object that the start node represents. If you specify forestroot as the start node (<StartNode>), subtree is the only valid scope. The default value is subtree.

-name <Name>

Searches for users whose name attributes match<Name>. For example, "jon*", "*ith", or "j*th".

-desc <Description>

Searches for users whose description attributes match <Description>. For example, "jon*", "*ith", or "j*th".

-upn <UPN>

Searches for users whose UPN attribute matches <UPN>.

-samid <SAMName>

Searches for users whose SAM account name matches <SAMName>.

-inactive <NumberOfWeeks>

Searches for users who have been inactive (stale) for at least the number of weeks that you specify.

-stalepwd <NumberOfDays>

Searches for users who have not changed their passwords for at least the number of days that you specify.

-disabled

Searches for users who have disabled accounts.

{-s <Server> | -d <Domain>}

Connects a computer to a remote server or domain that you specify. By default, dsquery connects the computer to the domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • UPN (for example, Linda@widgets.contoso.com)

-p {<Password> | *}

Specifies to use either a password or an asterisk (*) to log on to a remote server. If you type *, dsquery prompts you for a password.

-q

Suppresses all output to standard output (quiet mode).

-r

Specifies that the search use recursion or follow referrals. By default, the search does not follow referrals during search.

-gc

Specifies that the search use the Active Directory global catalog.

-limit <NumberOfObjects>

Specifies the number of objects to return that matches the criteria that you specify. If you specify a value of 0 for <NumberOfObjects>, this parameter returns all matching objects. If you do not specify this parameter, dsquery displays the first 100 results by default.

{-uc | -uco | -uci}

Specifies that dsquery formats output or input data in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

/?

Displays help at the command prompt.

Remarks

  • The results from a dsquery search can be piped as input to one of the other directory service command-line tools, such as Dsget, Dsmod, Dsmove, or Dsrm.

  • If a value that you supply contains spaces, use quotation marks around the text, for example, "CN=Mike Danseglio,CN=Users,DC=Contoso,DC=Com".

  • If you supply multiple values for a parameter, use spaces to separate the values, for example, a list of distinguished names.

Examples

To display the UPNs of all users in an organizational unit (OU) that you specify whose names start with "Jon" and whose accounts are disabled for logon, type:

Copy Code
dsquery user OU=Test,DC=Contoso,DC=Com -o upn -name jon* -disabled

To display the distinguished names of all users in the current domain only whose names end with "Smith" and who have been inactive for three weeks or more, type:

Copy Code
dsquery user domainroot -name *smith -inactive 3

To display the UPNs of all users in the OU that you specify in OU=Sales,DC=Contoso,DC=Com, type:

Copy Code
dsquery user OU=Sales,DC=Contoso,DC=Com -o upn

Additional references

Command-Line Syntax Key

Dsquery

Dsquery computer

Dsquery contact

Dsquery group

Dsquery ou

Dsquery site

Dsquery server

Dsquery quota

Dsquery partition

Dsquery *


Dsquery quota

Applies To: Windows Server 2008,Windows Server 2008 R2

Finds quota specifications in the directory that match the search criteria that you specify. A quota specification determines the maximum number of directory objects that a security principal can own in a directory partition that you specify. If the predefined search criteria in this command are insufficient, use the more general version of the query command, dsquery *.

Dsquery is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) server role installed. To use dsquery, you must run the dsquery command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsquery quota {domainroot | <ObjectDN>} [-o {dn | rdn}] [-acct <Name>] [-qlimit <Filter>] [-desc <Description>] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-q] [-r] [-gc] [-limit <NumberOfObjects>] [{-uc | -uco | -uci}]

Parameters

Parameter Description

{domainroot | <ObjectDN>}

Required. Specifies where the search begins. Use <ObjectDN> to specify the distinguished name (also known as DN) or use domainroot to specify the root of the current domain.

-o {dn | rdn}

Specifies the format that dsquery uses to display the search results. The following list explains each format.

  • dn: Displays the distinguished name of each entry. This is the default value.

  • rdn: Displays the relative distinguished name of each entry.

-acct <Name>

Specifies to find the quota specifications that are assigned to the security principal (user, group, computer, or InetOrgPerson) that <Name> represents. You can use the distinguished name of the security principal or the Domain\SAMAccountName of the security principal to specify the -acct parameter.

-qlimit <Filter>

Specifies to find quota specifications whose limit matches <Filter>.

-desc <Description>

Searches for quota objects that have description attributes that match <Description>, for example, "jon*", "*ith", or "j*th".

{-s <Server | -d <Domain>}

Connects a computer to a remote server or domain that you specify. By default, the computer is connected to a domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, Linda@widgets.contoso.com)

-p {<Password> | *}

Specifies to use either a password or an asterisk (*) to log on to a remote server. If you type *, dsquery prompts you for a password.

-q

Suppresses all output to standard output (quiet mode).

-r

Specifies that the search use recursion or follow referrals. By default, the search does not follow referrals.

-gc

Specifies that the search use the Active Directory global catalog.

-limit <NumberOfObjects>

Specifies the number of objects to return that matches the criteria that you specify. If you specify a value of 0 for <NumberOfObjects>, this parameter returns all matching objects. If you do not specify this parameter, dsquery displays the first 100 results by default.

{-uc | -uco | -uci}

Specifies that dsquery formats output or input data in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

/?

Displays help at the command prompt.

Remarks

  • The results from a dsquery search can be piped as input to one of the other directory service command-line tools, such as Dsget, Dsmod, Dsmove, or Dsrm.

  • If a value that you use contains spaces, use quotation marks around the text, for example, "CN=Mike Danseglio,CN=Users,DC=Contoso,DC=Com".

  • If you use multiple values for a parameter, use spaces to separate the values, for example, a list of distinguished names.

  • If you specify values for <Description>, you can use the wildcard character (*), for example, "NA*", "*BR", or "NA*BA".

  • Any value for <Filter> that you specify with qlimit is read as a string. You must enclose this parameter in quotation marks. In addition, you must enclose any value ranges that you specify using <=, =, or >= in quotation marks, for example, -qlimit "=100", -qlimit "<=99", -qlimit">=101". To find quotas with no limits, use "-1".

Examples

To list the accounts in the current domain that have quota specifications assigned to them, type:

Copy Code
dsquery quota domainroot

To list users named Jon in the SALES domain partition, type:

Copy Code
dsquery user -name jon* | dsquery quota domainroot -acct

Additional references

Command-Line Syntax Key

Dsquery

Dsquery computer

Dsquery contact

Dsquery group

Dsquery ou

Dsquery site

Dsquery server

Dsquery user

Dsquery partition

Dsquery *


Dsquery partition

Applies To: Windows Server 2008 R2,Windows Server 2008

Finds partition objects in the directory that match the search criteria that you specify. If the predefined search criteria in this command are insufficient, then use the more general version of the query command, dsquery *.

Dsquery is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) server role installed. To use dsquery, you must run the dsquery command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsquery partition [-o {dn | rdn}] [-part <Filter>] [{-s <Server> | -d <Domain>}][-u <UserName>] [-p {<Password> | *}] [-q] [-r] [-gc] [-limit <NumberOfObjects>] [{-uc | -uco | -uci}]

Parameters

Parameter Description

-o {dn | rdn}

Specifies the format that dsquery uses to display the search results. The following table shows each format. A dn value displays the distinguished name of each entry. An rdn value displays the relative distinguished name of each entry. The default value is dn.

-part <Filter>

Searches for partitions whose common name (CN) matches the filter that the <Filter> value specifies.

{-s <Server> | -d <Domain>}

Connects to a remote server or domain that you specify. By default, dsquery connects the computer to a domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, Linda@widgets.contoso.com)

-p {<Password> | *}

Specifies to use either a password or an asterisk (*) to log on to a remote server. If you type *, dsquery prompts you for a password.

-q

Suppresses all output to standard output (quiet mode).

-r

Specifies that the search use recursion or follow referrals. By default, the search does not follow referrals.

-gc

Specifies that the search use the Active Directory global catalog.

-limit <NumberOfObjects>

Specifies the number of objects to return that matches the criteria that you specify. If you specify a value of 0 for <NumberOfObjects>, this parameter returns all matching objects. If you do not specify this parameter, dsquery displays the first 100 results by default.

{-uc | -uco | -uci}

Specifies that dsquery formats output or input data in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

/?

Displays help at the command prompt.

Remarks

  • The results from a dsquery search can be piped as input to one of the other directory service command-line tools, such as Dsget, Dsmod, Dsmove, or Dsrm.

  • If a value that you use contains spaces, use quotation marks around the text, for example, "CN=Mike Danseglio,CN=Users,DC=Contoso,DC=Com".

  • If you use multiple values for a parameter, use spaces to separate the values, for example, a list of distinguished names.

  • If you specify values for Description, you can use the wildcard character (*), for example, "NA*", "*BR", and "NA*BA".

Examples

To list the distinguished names of all directory partitions in the current forest, type:

Copy Code
dsquery partition

To list the distinguished names of all directory partitions in the forest whose common name begins with SQL, type:

Copy Code
dsquery -part SQL*

Additional references

Command-Line Syntax Key

Dsquery

Dsquery computer

Dsquery contact

Dsquery group

Dsquery ou

Dsquery site

Dsquery server

Dsquery user

Dsquery quota

Dsquery *


Dsquery *

Applies To: Windows Server 2008 R2,Windows Server 2008

Finds any objects in the directory according to criteria using a Lightweight Directory Access Protocol (LDAP) query.

Dsquery is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) server role installed. To use dsquery, you must run the dsquery command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsquery * [{<StartNode> | forestroot | domainroot}] [-scope {subtree | onelevel | base}] [-filter <LDAPFilter>] [-attr {<AttributeList> | *}] [-attrsonly] [-l][{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-q] [-r] [-gc] [-limit <NumberOfObjects>] [{-uc | -uco | -uci}]

Parameters

Parameter Definition

{<StartNode> | forestroot | domainroot}

Specifies the node in the console tree where the search starts. You can specify the forest root (forestroot), domain root (domainroot), or distinguished name of a node as the start node <StartNode>. If you specify forestroot, AD DS searches by using the global catalog. The default value is domainroot.

-scope {subtree | onelevel | base}

Specifies the scope of the search. A subtree value specifies that the scope is a subtree that is rooted at the start node. A onelevel value specifies the immediate children of the start node only. A base value specifies the single object that the start node represents. If you specify forestroot as the start node <StartNode>, subtree is the only valid scope. The default value is subtree.

-filter <LDAPFilter>

Specifies to use an explicit search filter, <LDAPFilter>, in the LDAP search filter format. For example, a valid search filter is (&(objectCategory=Person)(sn=smith*)). The default value for <LDAPFilter> is (objectClass=*).

-attr {<AttributeList> | *}

Specifies that the semicolon separated LDAP display names included in <AttributeList> for each entry in the result set. If you specify the value of this parameter as a wildcard character (*), this parameter displays all attributes that are present on the object in the result set. In addition, if you specify a *, this parameter uses the default output format (a list), regardless of whether you specify the -l parameter. The default <AttributeList> is a distinguished name.

-attrsonly

Specifies to display only the attribute types that are present on the entries in the result set, not their values. The default is to display both the attribute type and the value.

-l

Displays entries in a list. By default, dsquery displays entries in a table.

{-s <Server> | -d <Domain>}

Connects a computer to a remote server or domain that you specify. By default, dsquery connects the computer to the domain controller in the logon domain.

-u <UserName>

Specifies the user name with which user will log on to the remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, Linda@widgets.contoso.com)

-p {<Password> | *}

Specifies to use either a password or an asterisk (*) to log on to a remote server. If you type *, dsquery prompts you for a password.

-q

Suppresses all output to standard output (quiet mode).

-r

Specifies that the search use recursion or follow referrals. By default, the search does not follow referrals during search.

-gc

Specifies that the search use the Active Directory global catalog.

-limit <NumberOfObjects>

Specifies the number of objects to return that matches the criteria that you specify. If you specify a value of 0 for <NumberOfObjects>, this parameter returns all matching objects. If you do not specify this parameter, dsquery displays the first 100 results by default.

{-uc | -uco | -uci}

Specifies that dsquery formats output or input data in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

/?

Displays help at the command prompt.

Remarks

  • The results from a dsquery search can be piped as input to one of the other directory service command-line tools, such as Dsget, Dsmod, Dsmove, or Dsrm.

  • If a value that you supply contains spaces, use quotation marks around the text, for example, "CN=Mike Danseglio,CN=Users,DC=Contoso,DC=Com".

  • If you supply multiple values for a parameter, use spaces to separate the values, for example, a list of distinguished names.

Examples

To display, in table format, the Security Accounts Manager (SAM) account names, user principal names, and departments of all users in the current domain whose SAM account names begin with "Jon", type:

Copy Code
dsquery * domainroot -filter "((objectCategory=Person)(objectClass=User)(sAMAccountName=Jon*)) -attr sAMAccountName userPrincipalName department

To read the SAM account names, user principal names (UPNs), and department attributes of the object whose distinguished name is OU=Test,DC=Contoso,DC=Com, type:

Copy Code
dsquery * OU=Test,DC=Contoso,DC=Com -scope base -attr sAMAccountName userPrincipalName department

To read all attributes of the object whose distinguished name is OU=Test,DC=Contoso,DC=Com, type:

Copy Code
dsquery * OU=Test,DC=Contoso,DC=Com -scope base -attr *

Additional references

Command-Line Syntax Key

Dsquery

Dsquery computer

Dsquery contact

Dsquery group

Dsquery ou

Dsquery site

Dsquery server

Dsquery user

Dsquery quota

Dsquery partition


Dsrm

Applies To: Windows Server 2008,Windows Server 2003 with SP1,Windows Server 2003 R2,Windows Server 2003

Deletes an object of a specific type or any general object from the directory.

Dsrm is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) or Active Directory Lightweight Directory Services (AD LDS) server role installed. To use dsrm, you must run the dsrm command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
dsrm <ObjectDN> ... [-subtree [-exclude]] [-noprompt] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}][-c][-q][{-uc | -uco | -uci}]

Parameters

Parameter Description

<ObjectDN>

Required. Specifies the distinguished names of objects to delete. If no value is entered at the command prompt, the value will be obtained through standard input.

-subtree [-exclude]

Specifies that both the object and all objects contained in the subtree under that object should be deleted. If you specify the -exclude parameter, you must also specify the -subtree parameter. When you specify both parameters, dsrm excludes from deletion the base object that the <ObjectDN> parameter supplies when it deletes the objects under the subtree. By default, dsrm deletes only the base object specified.

-noprompt

Sets the optional silent mode, which prevents prompts that ask you to confirm deletion of each object. By default, dsrm prompts you to confirm each deletion.

{-s <Server> | -d <Domain>}

Connects a computer to a remote server or domain that you specify. By default, dsrm connects the computer to the domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, Linda@widgets.contoso.com)

-p {<Password> | *}

Specifies to use either a password or an asterisk (*) to log on to a remote server. If you type *, dsrm prompts you for a password.

-c

Reports errors, but continues with the next object in the argument list when you specify multiple target objects (continuous operation mode). If you do not supply this parameter, dsrm exits when the first error occurs.

-q

Suppresses all output to standard output (quiet mode).

{-uc | -uco | -uci}

Specifies that dsrm formats output or input data in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

/?

Displays help at the command prompt.

Remarks

  • If a value that you supply contains spaces, use quotation marks around the text, for example, "CN=Mike Danseglio,CN=Users,DC=Contoso,DC=Com".

  • If you supply multiple values for a parameter, use spaces to separate the values, for example, a list of distinguished names.

Examples

To remove an organizational unit (OU) named Marketing and all the objects under that OU, type:

Copy Code
dsrm -subtree -noprompt -c OU=Marketing,DC=Contoso,DC=Com

To remove all objects under an OU named Marketing, but leave the OU intact, type:

Copy Code
dsrm -subtree -exclude -noprompt -c "OU=Marketing,DC=Contoso,DC=Com"

Additional references

Command-Line Syntax Key


Echo

Applies To: Windows Vista,Windows Server 2008

Displays messages or turns on or off the command echoing feature. If used without parameters, echo displays the current echo setting.

For examples of how to use this command, see Examples.

Syntax

Copy Code
echo [<Message>]
echo [on | off]

Parameters

Parameter | Description
[on | off] | Turns on or off the command echoing feature. Command echoing is on by default.
<Message> | Specifies the text to display on the screen.
/? | Displays help at the command prompt.

Remarks

  • The echo Message command is particularly useful when echo is turned off. To display a message that is several lines long without displaying any commands, you can include several echo Message commands after the echo off command in your batch program.

  • When echo is turned off, the command prompt does not appear in the Command Prompt window. To display the command prompt, type echo on.

  • If used in a batch file, echo on and echo off do not affect the setting at the command prompt.

  • To prevent echoing a particular command in a batch file, insert an at sign (@) in front of the command. To prevent echoing all commands in a batch file, include the echo off command at the beginning of the file.

  • To display a pipe (|) or redirection character (< or >) when you are using echo, use a caret (^) immediately before the pipe or redirection character (for example, ^|, ^>, or ^<). To display a caret, type two carets in succession (^^).

Examples

To display the current echo setting, type:

Copy Code
echo

To echo a blank line on the screen, type:

Copy Code
echo.
Note
Do not include a space before the period. Otherwise, the period will be displayed instead of a blank line.

To prevent echoing commands at the command prompt, type:

Copy Code
echo off
Note
When echo is turned off, the command prompt does not appear in the Command Prompt window. To display the command prompt again, type echo on.

To prevent all commands in a batch file (including the echo off command) from displaying on the screen, on the first line of the batch file type:

Copy Code
@echo off

You can use the echo command as part of an if statement. For example, to search the current directory for any file with the .rpt file name extension, and to echo a message if such a file is found, type:

Copy Code
if exist *.rpt echo The report has arrived.

The following batch file searches the current directory for files with the .txt file name extension, and displays a message indicating the results of the search:

Copy Code
@echo off
if not exist *.txt (
echo This directory contains no text files.
) else (
   echo This directory contains the following text files:
   echo.
   dir /b *.txt
   )

If no .txt files are found when the batch file is run, the following message displays:

Copy Code
This directory contains no text files.

If .txt files are found when the batch file is run the following output displays (for this example, assume the files File1.txt, File2.txt, and File3.txt exist):

Copy Code
This directory contains the following text files:
File1.txt
File2.txt
File3.txt

Additional references

Command-Line Syntax Key


Edit

Applies To: Windows Server 2008

Starts MS-DOS Editor, which creates and changes ASCII text files.

For examples of how to use this command, see Examples.

Syntax

Copy Code
edit [/b] [/h] [/r] [/s] [/<NNN>] [[<Drive>:][<Path>]<FileName> [<FileName2> [...]]

Parameters

Parameter | Description
[<Drive>:][<Path>]<FileName> [<FileName2> [...]] | Specifies the location and name of one or more ASCII text files. If the file does not exist, MS-DOS Editor creates it. If the file exists, MS-DOS Editor opens it and displays its contents on the screen. FileName can contain wildcard characters (* and ?). Separate multiple file names with spaces.
/b | Forces monochrome mode, so that MS-DOS Editor displays in black and white.
/h | Displays the maximum number of lines possible for the current monitor.
/r | Loads file(s) in read-only mode.
/s | Forces the use of short filenames.
<NNN> | Loads binary file(s), wrapping lines to NNN characters wide.
/? | Displays help at the command prompt.

Remarks

  • For additional help, open MS-DOS Editor, and then press the F1 key.

  • Some monitors do not support the display of shortcut keys by default. If your monitor does not display shortcut keys, use /b.

Examples

To open MS-DOS Editor, type:

Copy Code
edit

To create and edit a file named newtextfile.txt in the current directory, type:

Copy Code
edit newtextfile.txt


Endlocal

Applies To: Windows Server 2008,Windows Vista

Ends localization of environment changes in a batch file, and restores environment variables to their values before the corresponding setlocal command was run.

For examples of how to use this command, see Examples.

Syntax

Copy Code
endlocal

Parameters

Parameter | Description
/? | Displays help at the command prompt.

Remarks

  • The endlocal command has no effect outside a script or batch file.

  • There is an implicit endlocal command at the end of a batch file.

  • If command extensions are enabled (command extensions are enabled by default), the endlocal command restores the state of command extensions (that is, enabled or disabled) to what it was before the corresponding setlocal command was run.

Note
For more information about enabling and disabling command extensions, see Cmd.

Examples

You can localize environment variables in a batch file. For example, the following program starts the superapp batch program on the network, directs the output to a file, and displays the file in Notepad:

Copy Code
@echo off
setlocal
path=g:\programs\superapp;%path%
call superapp>c:\superapp.out
endlocal
start notepad c:\superapp.out

Additional references

Command-Line Syntax Key


Erase

Applies To: Windows Vista,Windows Server 2008

This command is the same as the del command. See Del for syntax and parameters.


Eventcreate

Applies To: Windows Server 2008

Enables an administrator to create a custom event in a specified event log. For examples of how to use this command, see Examples.

Syntax

Copy Code
eventcreate [/s <Computer> [/u <Domain\User> [/p <Password>]] {[/l {APPLICATION|SYSTEM}]|[/so <SrcName>]} /t {ERROR|WARNING|INFORMATION|SUCCESSAUDIT|FAILUREAUDIT} /id <EventID> /d <Description>

Parameters

Parameter | Description
/s <Computer> | Specifies the name or IP address of a remote computer (do not use backslashes). The default is the local computer.
/u <Domain\User> | Runs the command with the account permissions of the user specified by <User> or <Domain\User>. The default is the permissions of the current logged on user on the computer issuing the command.
/p <Password> | Specifies the password of the user account that is specified in the /u parameter.
/l {APPLICATION|SYSTEM} | Specifies the name of the event log where the event will be created. The valid log names are APPLICATION and SYSTEM.
/so <SrcName> | Specifies the source to use for the event. A valid source can be any string and should represent the application or component that is generating the event.
/t {ERROR|WARNING|INFORMATION| SUCCESSAUDIT|FAILUREAUDIT} | Specifies the type of event to create. The valid types are ERROR, WARNING, INFORMATION, SUCCESSAUDIT, and FAILUREAUDIT.
/id <EventID> | Specifies the event ID for the event. A valid ID is any number from 1 to 65535.
/d <Description> | Specifies the description to use for the newly created event.
/? | Displays help at the command prompt.

Remarks

  • Custom events cannot be written to the security log.

Examples

The following examples show how you can use the eventcreate command:

Copy Code
eventcreate /t error /id 100 /l application /d "Create event in application log"
eventcreate /t information /id 1000 /so winmgmt /d "Create event in WinMgmt source"
eventcreate /t error /id 2001 /so winword /l application /d "new src Winword in application log"
eventcreate /s server /t error /id 100 /l application /d "Remote machine without user credentials"
eventcreate /s server /u user /p password /id 100 /t error /l application /d "Remote machine with user credentials"
eventcreate /s server1 /s server2 /u user /p password /id 100 /t error /so winmgmt /d "Creating events on Multiple remote machines"
eventcreate /s server /u user /id 100 /t warning /so winmgmt /d "Remote machine with partial user credentials"

Additional References

Command-Line Syntax Key


Eventquery.vbs

Applies To: Windows Server 2003 with SP1,Windows XP,Windows Server 2003,Windows Server 2003 with SP2,Windows Server 2003 R2

Eventquery.vbs is deprecated, and is not guaranteed to be supported in future releases of Windows.

This tool is included in Windows Server 2003 . For more information see Eventquery.vbs.


Eventtriggers

Applies To: Windows Server 2003 R2,Windows Server 2003 with SP2,Windows Server 2003,Windows XP,Windows Server 2003 with SP1

Eventtriggers is deprecated, and is not guaranteed to be supported in future releases of Windows.

This tool is included in Windows Server 2003. For more information see Eventtriggers.


Evntcmd
See Also

Evntcmd

Configures the translation of events to traps, trap destinations, or both based on information in a configuration file.
Syntax

evntcmd [/s ComputerName] [/v VerbosityLevel] [/n] FileName

Parameters
/s ComputerName

Specifies, by name, the computer on which you want to configure the translation of events to traps, trap destinations, or both. If you do not specify a computer, the configuration occurs on the local computer.

/v VerbosityLevel

Specifies which types of status messages appear as traps and trap destinations are configured. This parameter must be an integer between 0 and 10. If you specify 10, all types of messages appear, including tracing messages and warnings about whether trap configuration was successful. If you specify 0, no messages appear.

/n

Specifies that the SNMP service should not be restarted if this computer receives trap configuration changes.

FileName

Specifies, by name, the configuration file that contains information about the translation of events to traps and trap destinations you want to configure.

/?

Displays help at the command prompt.

Remarks
  • If you want to configure traps but not trap destinations, you can create a valid configuration file by using Event to Trap Translator, which is a graphical utility. If you have the SNMP service installed, you can start Event to Trap Translator by typing evntwin at a command prompt. After you have defined the traps you want, click Export to create a file suitable for use with evntcmd. You can use Event to Trap Translator to easily create a configuration file and then use the configuration file with evntcmd at the command prompt to quickly configure traps on multiple computers.

  • The syntax for configuring a trap is as follows:

    #pragma ADD EventLogFile EventSource EventID [Count [Period]]

    • The text #pragma must appear at the beginning of every entry in the file.

    • The parameter ADD specifies that you want to add an event to trap configuration.

    • The parameters EventLogFile, EventSource, and EventID are required. The parameter EventLogFile specifies the file in which the event is recorded. The parameter EventSource specifies the application that generates the event. The EventID parameter specifies the unique number that identifies each event. To find out what values correspond to particular events, start Event to Trap Translator by typing evntwin at a command prompt. Click Custom, and then click Edit. Under Event Sources, browse the folders until you locate the event you want to configure, click it, and then click Add. Information about the event source, the event log file, and the event ID appear under Source, Log, and Trap specific ID, respectively.

    • The Count parameter is optional, and it specifies how many times the event must occur before a trap message is sent. If you do not use the Count parameter, the trap message is sent after the event occurs once.

    • The Period parameter is optional, but it requires you to use the Count parameter. The Period parameter specifies a length of time (in seconds) during which the event must occur the number of times specified with the Count parameter before a trap message is sent. If you do not use the Period parameter, a trap message is sent after the event occurs the number of times specified with the Count parameter, no matter how much time elapses between occurrences.

  • The syntax for removing a trap is as follows:

    #pragma DELETE EventLogFile EventSource EventID

    • The text #pragma must appear at the beginning of every entry in the file.

    • The parameter DELETE specifies that you want to remove an event to trap configuration.

    • The parameters EventLogFile, EventSource, and EventID are required. The parameter EventLogFile specifies the log in which the event is recorded. The parameter EventSource specifies the application that generates the event. The EventID parameter specifies the unique number that identifies each event.

  • The syntax for configuring a trap destination is as follows:

    #pragma ADD_TRAP_DEST CommunityName HostID

    • The text #pragma must appear at the beginning of every entry in the file.

    • The parameter ADD_TRAP_DEST specifies that you want trap messages to be sent to a specified host within a community.

    • The parameter CommunityName specifies, by name, the community in which trap messages are sent.

    • The parameter HostID specifies, by name or IP address, the host to which you want trap messages to be sent.

  • The syntax for removing a trap destination is as follows:

    #pragma DELETE_TRAP_DEST CommunityName HostID

    • The text #pragma must appear at the beginning of every entry in the file.

    • The parameter DELETE_TRAP_DEST specifies that you do not want trap messages to be sent to a specified host within a community.

    • The parameter CommunityName specifies, by name, the community in which trap messages are sent.

    • The parameter HostID specifies, by name or IP address, the host to which you do not want trap messages to be sent.

Examples

The following examples illustrate entries in the configuration file for the evntcmd command. They are not designed to be typed at a command prompt.

To send a trap message if the Event Log service is restarted, type:

#pragma ADD System "Eventlog" 2147489653

To send a trap message if the Event Log service is restarted twice in three minutes, type:

#pragma ADD System "Eventlog" 2147489653 2 180

To stop sending a trap message whenever the Event Log service is restarted, type:

#pragma DELETE System "Eventlog" 2147489653

To send trap messages within the community named Public to the host with the IP address 192.168.100.100, type:

#pragma ADD_TRAP_DEST public 192.168.100.100

To send trap messages within the community named Private to the host named Host1, type:

#pragma ADD_TRAP_DEST private Host1

To stop sending trap messages within the community named Private to the same computer on which you are configuring trap destinations, type:

#pragma DELETE_TRAP_DEST private localhost

Formatting legend

Format | Meaning
Italic | Information that the user must supply
Bold | Elements that the user must type exactly as shown
Ellipsis (...) | Parameter that can be repeated several times in a command line
Between brackets ([]) | Optional items
Between braces ({}); choices separated by pipe (|). Example: {even|odd} | Set of choices from which the user must choose only one
Courier font | Code or program output

See Also

Command-line reference A-ZCommand shell overview


Exit

Applies To: Windows Server 2008,Windows Vista

Exits the Cmd.exe program (the command interpreter) or the current batch script.

For examples of how to use this command, see Examples.

Syntax

Copy Code
exit [/b] [<ExitCode>]

Parameters

Parameter | Description
/b | Exits the current batch script instead of exiting Cmd.exe. If executed from outside a batch script, exits Cmd.exe.
<ExitCode> | Specifies a numeric number. If /b is specified, the ERRORLEVEL environment variable is set to that number. If you are quitting Cmd.exe, the process exit code is set to that number.
/? | Displays help at the command prompt.

Examples

To close the command interpreter, Cmd.exe, type:

Copy Code
exit

Additional references

Command-Line Syntax Key


Extract

Applies To: Windows Server 2008

Syntax

Copy Code
EXTRACT [/Y] [/A] [/D | /E] [/L dir] cabinet [filename ...]
EXTRACT [/Y] source [newname]
EXTRACT [/Y] /C source destination

Parameters

Parameter | Description
cabinet | File contains two or more files.
filename | Name of the file to extract from the cabinet. Wild cards and multiple filenames (separated by blanks) may be used.
source | Compressed file (a cabinet with only one file).
newname | New filename to give the extracted file. If not supplied, the original name is used.
/A | Process ALL cabinets. Follows cabinet chain starting in first cabinet mentioned.
/C | Copy source file to destination (to copy from DMF disks).
/D | Display cabinet directory (use with filename to avoid extract).
/E | Extract (use instead of *.* to extract all files).
/L dir | Location to place extracted files (default is current directory).
/Y | Do not prompt before overwriting an existing file.

Additional references

Command-Line Syntax Key


Fc

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows 7,Windows Vista

Compares two files or sets of files and displays the differences between them.

For examples of how to use this command, see Examples.

Syntax

Copy Code
fc /a [/c] [/l] [/lb<N>] [/n] [/off[line]] [/t] [/u] [/w] [/<NNNN>] [<Drive1>:][<Path1>]<FileName1> [<Drive2>:][<Path2>]<FileName2>
fc /b [<Drive1:>][<Path1>]<FileName1> [<Drive2:>][<Path2>]<FileName2>

Parameters

Parameter | Description
/a | Abbreviates the output of an ASCII comparison. Instead of displaying all of the lines that are different, fc displays only the first and last line for each set of differences.
/b | Compares the two files in binary mode, byte by byte, and does not attempt to resynchronize the files after finding a mismatch. This is the default mode for comparing files that have the following file extensions: .exe, .com, .sys, .obj, .lib, or .bin.
/c | Ignores the letter case.
/l | Compares the files in ASCII mode, line-by-line, and attempts to resynchronize the files after finding a mismatch. This is the default mode for comparing files, except files with the following file extensions: .exe, .com, .sys, .obj, .lib, or .bin.
/lb<N> | Sets the number of lines for the internal line buffer to N. The default length of the line buffer is 100 lines. If the files that you are comparing have more than 100 consecutive differing lines, fc cancels the comparison.
/n | Displays the line numbers during an ASCII comparison.
/off[line] | Does not skip files that have the offline attribute set.
/t | Prevents fc from converting tabs to spaces. The default behavior is to treat tabs as spaces, with stops at each eighth character position.
/u | Compares files as Unicode text files.
/w | Compresses white space (that is, tabs and spaces) during the comparison. If a line contains many consecutive spaces or tabs, /w treats these characters as a single space. When used with /w, fc ignores white space at the beginning and end of a line.
/<NNNN> | Specifies the number of consecutive lines that must match following a mismatch, before fc considers the files to be resynchronized. If the number of matching lines in the files is less than NNNN, fc displays the matching lines as differences. The default value is 2.
[<Drive1>:][<Path1>]<FileName1> | Specifies the location and name of the first file or set of files to compare. FileName1 is required.
[<Drive2>:][<Path2>]<FileName2> | Specifies the location and name of the second file or set of files to compare. FileName2 is required.
/? | Displays help at the command prompt.

Remarks

  • Reporting differences between files for an ASCII comparison

    When you use fc for an ASCII comparison, fc displays the differences between two files in the following order:

    • Name of the first file

    • Lines from FileName1 that differ between the files

    • First line to match in both files

    • Name of the second file

    • Lines from FileName2 that differ

    • First line to match

  • Using /b for binary comparisons

    /b displays mismatches that are found during a binary comparison in the following syntax:

    <XXXXXXXX: YY ZZ>

    The value of XXXXXXXX specifies the relative hexadecimal address for the pair of bytes, measured from the beginning of the file. Addresses start at 00000000. The hexadecimal values for YY and ZZ represent the mismatched bytes from FileName1 and FileName2, respectively.

  • Using wildcard characters

    You can use wildcard characters (* and ?) in FileName1 and FileName2. If you use a wildcard in FileName1, fc compares all the specified files to the file or set of files specified by FileName2. If you use a wildcard in FileName2, fc uses the corresponding value from FileName1.

  • Working with memory

    When comparing ASCII files, fc uses an internal buffer (large enough to hold 100 lines) as storage. If the files are larger than the buffer, fc compares what it can load into the buffer. If fc does not find a match in the loaded portions of the files, it stops and displays the following message:

    Resynch failed. Files are too different.

    When comparing binary files that are larger than the available memory, fc compares both files completely, overlaying the portions in memory with the next portions from the disk. The output is the same as that for files that fit completely in memory.

Examples

To make an ASCII comparison of two text files, Monthly.rpt and Sales.rpt, and display the results in abbreviated format, type:

Copy Code
fc /a monthly.rpt sales.rpt

To make a binary comparison of two batch files, Profits.bat and Earnings.bat, type:

Copy Code
fc /b profits.bat earnings.bat

Results similar to the following appear:

Copy Code
00000002: 72 43
00000004: 65 3A
0000000E: 56 92
...
...
...
000005E8: 00 6E
FC: Earnings.bat longer than Profits.bat

If the Profits.bat and Earnings.bat files are identical, fc displays the following message:

Copy Code
Comparing files Profits.bat and Earnings.bat
FC: no differences encountered

To compare every .bat file in the current directory with the file New.bat, type:

Copy Code
fc *.bat new.bat

To compare the file New.bat on drive C with the file New.bat on drive D, type:

Copy Code
fc c:new.bat d:*.bat

To compare each batch file in the root directory on drive C to the file with the same name in the root directory on drive D, type:

Copy Code
fc c:*.bat d:*.bat

Additional references

Command-Line Syntax Key


Filescrn

Applies To: Windows Server 2008

Create and manage file screens, file screening exceptions, and file groups.

Syntax

Copy Code
Filescrn {Filegroup | Screen | Exception | Template | Admin | Notification}

Parameters

Parameter | Description
Filegroup | List, add, modify, and delete file groups.
Screen | List, add, modify, and delete file screens.
Exception | List, add, modify, and delete file screen exceptions.
Template | List, add, modify, and delete file screen templates.
Admin | Configure settings and perform administrative operations.
Notification | Display help on notification configuration file syntax


Find

Applies To: Windows Vista,Windows Server 2008

Searches for a string of text in a file or files, and displays lines of text that contain the specified string.

For examples of how to use this command, see Examples.

Syntax

Copy Code
find [/v] [/c] [/n] [/i] [/off[line]] "<String>" [[<Drive>:][<Path>]<FileName>[...]]

Parameters

Parameter | Description
/v | Displays all lines that do not contain the specified <String>.
/c | Counts the lines that contain the specified <String>and displays the total.
/n | Precedes each line with the file's line number.
/i | Specifies that the search is not case-sensitive.
[/off[line]] | Does not skip files that have the offline attribute set.
"<String>" | Required. Specifies the group of characters (enclosed in quotation marks) that you want to search for.
[<Drive>:][<Path>]<FileName> | Specifies the location and name of the file in which to search for the specified string.
/? | Displays help at the command prompt.

Remarks

  • Specifying a string

    If you do not use /i, find searches for exactly what you specify for String. For example, the find command treats the characters "a" and "A" differently. If you use /i, however, find is not case sensitive, and it treats "a" and "A" as the same character.

    If the string you want to search for contains quotation marks, you must use double quotation marks for each quotation mark contained within the string (for example, "This ""string"" contains quotation marks").

  • Using find as a filter

    If you omit a file name, find acts as a filter, taking input from the standard input source (usually the keyboard, a pipe (|), or a redirected file) and then displaying any lines that contain String.

  • Ordering command syntax

    You can type parameters and command-line options for the find command in any order.

  • Using wildcards

    You cannot use wildcards (* and ?) in file names or extensions that you specify with the find command. To search for a string in a set of files that you specify with wildcards, you can use the find command within a for command.

  • Using /v or /n with /c

    If you use /c and /v in the same command line, find displays a count of the lines that do not contain the specified string. If you specify /c and /n in the same command line, find ignores /n.

  • Using find with carriage returns

    The find command does not recognize carriage returns. When you use find to search for text in a file that includes carriage returns, you must limit the search string to text that can be found between carriage returns (that is, a string that is not likely to be interrupted by a carriage return). For example, find does not report a match for the string "tax file" if a carriage return occurs between the words "tax" and "file."

Examples

To display all lines from Pencil.ad that contain the string "Pencil Sharpener", type:

Copy Code
find "Pencil Sharpener" pencil.ad

To find a string that contains text within quotation marks, you must enclose the entire string in quotation marks. Then you must use two quotation marks for each quotation mark contained within the string. To find "The scientists labeled their paper "for discussion only." It is not a final report." in Report.doc, type:

Copy Code
find "The scientists labeled their paper ""for discussion only."" It is not a final report." report.doc

If you want to search for a set of files, you can use the find command within the for command. To search the current directory for files that have the extension .bat and that contain the string "PROMPT", type:

Copy Code
for %f in (*.bat) do find "PROMPT" %f

To search your hard disk to find and display the file names on drive C that contain the string "CPU", use the pipe (|) to direct the output of the dir command to the find command as follows:

Copy Code
dir c:\ /s /b | find "CPU"

Because find searches are case-sensitive and dir produces uppercase output, you must either type the string "CPU" in uppercase letters or use the /i command-line option with find.

Additional references

Command-Line Syntax Key


Findstr

Applies To: Windows Server 2008,Windows Vista

Searches for patterns of text in files.

For examples of how to use this command, see Examples.

Syntax

Copy Code
findstr [/b] [/e] [/l | /r] [/s] [/i] [/x] [/v] [/n] [/m] [/o] [/p] [/f:<File>] [/c:<String>] [/g:<File>] [/d:<DirList>] [/a:<ColorAttribute>] [/off[line]] <Strings> [<Drive>:][<Path>]<FileName>[ ...]

Parameters

Parameter | Description
/b | Matches the text pattern if it is at the beginning of a line.
/e | Matches the text pattern if it is at the end of a line.
/l | Processes search strings literally.
/r | Processes search strings as regular expressions. This is the default setting.
/s | Searches the current directory and all subdirectories.
/i | Ignores the case of the characters when searching for the string.
/x | Prints lines that match exactly.
/v | Prints only lines that do not contain a match.
/n | Prints the line number of each line that matches.
/m | Prints only the file name if a file contains a match.
/o | Prints character offset before each matching line.
/p | Skips files with non-printable characters.
/off[line] | Does not skip files that have the offline attribute set.
/f:<File> | Gets a file list from the specified file.
/c:<String> | Uses the specified text as a literal search string.
/g:<File> | Gets search strings from the specified file.
/d:<DirList> | Searches the specified list of directories. Each directory must be separated with a semicolon (;), for example dir1;dir2;dir3.
/a:<ColorAttribute> | Specifies color attributes with two hexadecimal digits. Type color /? for additional information.
<Strings> | Specifies the text to search for in FileName. Required.
[<Drive>:][<Path>]<FileName>[ ...] | Specifies the location and file or files to search. At least one file name is required.
/? | Displays Help at the command prompt.

Remarks

  • All findstr command-line options must precede Strings and FileName in the command string.

  • Regular expressions use both literal characters and metacharacters to find patterns of text, rather than exact strings of characters. A literal character is a character that does not have a special meaning in the regular-expression syntax—it matches an occurrence of that character. For example, letters and numbers are literal characters. A metacharacter is a symbol with special meaning (an operator or delimiter) in the regular-expression syntax.

    The following table lists the metacharacters that findstr accepts.

    Metacharacter Value

    .

    Wildcard: any character

    *

    Repeat: zero or more occurrences of the previous character or class

    ^

    Line position: beginning of the line

    $

    Line position: end of the line

    [class]

    Character class: any one character in a set

    [^class]

    Inverse class: any one character not in a set

    [x-y]

    Range: any characters within the specified range

    \x

    Escape: literal use of a metacharacter x

    \<string

    Word position: beginning of the word

    string\>

    Word position: end of the word

    The special characters in regular expression syntax have the most power when you use them together. For example, use the following combination of the wildcard character (.) and repeat (*) character to match any string of characters:

    Copy Code
    .*
    Use the following expression as part of a larger expression to match any string beginning with "b" and ending with "ing":

    Copy Code
    b.*ing

Examples

Use spaces to separate multiple search strings unless the argument is prefixed with /c.

To search for "hello" or "there" in file x.y, type:

Copy Code
findstr "hello there" x.y

To search for "hello there" in file x.y, type:

Copy Code
findstr /c:"hello there" x.y

To find all occurrences of the word "Windows" (with an initial capital letter W) in the file Proposal.txt, type:

Copy Code
findstr Windows proposal.txt

To search every file in the current directory and all subdirectories that contained the word Windows, regardless of the letter case, type:

Copy Code
findstr /s /i Windows *.*

To find all occurrences of lines that begin with "FOR" and are preceded by zero or more spaces (as in a computer program loop), and to display the line number where each occurrence is found, type:

Copy Code
findstr /b /n /r /c:"^ *FOR" *.bas

To search for multiple strings in a set of files, create a text file that contains each search criterion on a separate line. You can also list the exact files that you want to search in a text file. For example, to use the search criteria in the file Stringlist.txt, search the files listed in Filelist.txt, and then store the results in the file Results.out, type:

Copy Code
findstr /g:stringlist.txt /f:filelist.txt > results.out

To list every file containing the word "computer" within the current directory and all subdirectories, regardless of case, type:

Copy Code
findstr /s /i /m "\<computer\>" *.*

To list every file containing the word "computer" and any other words that begin with "comp", (such as "compliment" and "compete"), type:

Copy Code
findstr /s /i /m "\<comp.*" *.*

Additional references

Command-Line Syntax Key


Flattemp

Applies To: Windows Server 2008

Enables or disables flat temporary folders.

For examples of how to use this command, see Examples.

Syntax

Copy Code
flattemp {/query | /enable | /disable}

Parameters

Parameter | Description
/query | Queries the current setting.
/enable | Enables flat temporary folders. Users will share the temporary folder unless the temporary folder resides in the user’s home folder.
/disable | Disables flat temporary folders. Each user’s temporary folder will reside in a separate folder (determined by the user’s Session ID).
/? | Displays help at the command prompt.

Remarks

  • The flattemp command is only available when you have installed the Terminal Server role service on a computer running Microsoft Windows Server® 2008.

  • You must have administrative credentials to run flattemp.

  • After each user has a unique temporary folder, use flattemp /enable to enable flat temporary folders.

  • The default method for creating temporary folders for multiple users (usually pointed to by the TEMP and TMP environment variables) is to create subfolders in the \Temp folder, by using the logonID as the subfolder name. For example, if the TEMP environment variable points to C:\Temp, the temporary folder assigned to the user logonID 4 is C:\Temp\4. Using flattemp, you can point directly to the \Temp folder and prevent subfolders from forming. This is useful when you want the user temporary folders to be contained in home folders, whether on a terminal server local drive or on a shared network drive. You should use the flattemp /enable command only when each user has a separate temporary folder.

  • You might encounter application errors if the user's temporary folder is on a network drive. This occurs when the shared network drive becomes momentarily inaccessible on the network. Because the temporary files of the application are either inaccessible or out of synchronization, it responds as if the disk has stopped. Moving the temporary folder to a network drive is not recommended. The default is to keep temporary folders on the local hard disk. If you experience unexpected behavior or disk-corruption errors with certain applications, stabilize your network or move the temporary folders back to the local hard disk.

  • If you disable using separate temporary folders per-session, flattemp settings are ignored. This option is set in the Terminal Services Configuration tool.

Examples

  • To display the current setting for flat temporary folders, type:

    Copy Code
    flattemp /query
  • To enable flat temporary folders, type:

    Copy Code
    flattemp /enable
  • To disable flat temporary folders, type:

    Copy Code
    flattemp /disable

Additional references

Command-Line Syntax Key

Terminal Services Command Reference


For

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows XP,Windows Vista,Windows Server 2003,Windows Server 2003 R2,Windows 7

Runs a specified command for each file in a set of files.

For examples of how to use this command, see Examples.

Syntax

Copy Code
for {%%|%}<Variable> in (<Set>) do <Command> [<CommandLineOptions>]

Parameters

Parameter | Description
{%%|%}<Variable> | Required. Represents a replaceable parameter. Use a single percent sign (%) to carry out the for command at the command prompt. Use double percent signs (%%) to carry out the for command within a batch file. Variables are case sensitive, and they must be represented with an alphabetical value such as %A, %B, or %C.
(<Set>) | Required. Specifies one or more files, directories, or text strings, or a range of values on which to run the command. The parentheses are required.
<Command> | Required. Specifies the command that you want to carry out on each file, directory, or text string, or on the range of values included in Set.
<CommandLineOptions> | Specifies any command-line options that you want to use with the specified command.
/? | Displays help at the command prompt.

Remarks

  • Using for

    You can use the for command within a batch file or directly from the command prompt.

  • Using batch parameters

    The following attributes apply to the for command:

    • The for command replaces %Variable or %%Variable with each text string in the specified set until the specified command processes all of the files.

    • Variable names are case sensitive, global, and no more than 52 can be active at a time.

    • To avoid confusion with the batch parameters %0 through %9, you can use any character for Variable except the numerals 0 through 9. For simple batch files, a single character such as %%f will work.

    • You can use multiple values for Variable in complex batch files to distinguish different replaceable variables.

  • Specifying a group of files

    The Set parameter can represent a single group of files or several groups of files. You can use wildcard characters (* and ?) to specify a file set. The following are valid file sets:

    Copy Code
    (*.doc)
(*.doc *.txt *.me)
(jan*.doc jan*.rpt feb*.doc feb*.rpt)
(ar??1991.* ap??1991.*)
    When you use the for command, the first value in Set replaces %Variable or %%Variable, and then the specified command processes this value. This continues until all of the files (or groups of files) that correspond to the Set value are processed.

  • Using the in and do keywords

    In and do are not parameters, but you must use them with for. If you omit either of these keywords, an error message appears.

  • Using additional forms of for

    If command extensions are enabled (that is the default), the following additional forms of for are supported:

    • Directories only

      If Set contains wildcard characters (* or ?), the specified Command executes for each directory (instead of a set of files in a specified directory) that matches Set.

      The syntax is:

      Copy Code
      for /d {%%|%}<Variable> in (<Set>) do <Command> [<CommandLineOptions>]
    • Recursive

      Walks the directory tree that is rooted at Drive:Path and executes the for statement in each directory of the tree. If no directory is specified after /r, the current directory is used as the root directory. If Set is just a single period (.), it only enumerates the directory tree.

      The syntax is:

      Copy Code
      for /r [[<Drive>:]<Path>] {%%|%}<Variable> in (<Set>) do <Command> [<CommandLineOptions>]
    • Iterating a range of values

      Use an iterative variable to set the starting value (Start#) and then step through a set range of values until the value exceeds the set ending value (End#). /l will execute the iterative by comparing Start# with End#. If Start# is less than End# the command will execute. When the iterative variable exceeds End#, the command shell exits the loop. You can also use a negative Step# to step through a range in decreasing values. For example, (1,1,5) generates the sequence 1 2 3 4 5 and (5,-1,1) generates the sequence 5 4 3 2 1.

      The syntax is:

      Copy Code
      for /l {%%|%}<Variable> in (<Start#>,<Step#>,<End#>) do <Command> [<CommandLineOptions>]
    • Iterating and file parsing

      Use file parsing to process command output, strings, and file content. Use iterative variables to define the content or strings that you want to examine, and use the various ParsingKeywords options to further modify the parsing. Use the ParsingKeywords token option to specify which tokens should be passed as iterative variables. Note that when used without the token option, /f will only examine the first token.

      File parsing consists of reading the output, string, or file content, and then breaking it into individual lines of text and parsing each line into zero or more tokens. The for loop is then called with the iterative variable value set to the token. By default, /f passes the first blank separated token from each line of each file. Blank lines are skipped.

      The syntaxes are:

      Copy Code
      for /f ["<ParsingKeywords>"] {%%|%}<Variable> in (<Set>) do <Command> [<CommandLineOptions>]
for /f ["ParsingKeywords"] {%%|%}<Variable> in ("<LiteralString>") do <Command> [<CommandLineOptions>]
for /f ["<ParsingKeywords>"] {%%|%}<Variable> in ('<Command>') do <Command> [<CommandLineOptions>]
      The Set argument specifies one or more file names. Each file is opened, read, and processed before moving to the next file in Set. To override the default parsing behavior, specify ParsingKeywords. This is a quoted string that contains one or more keywords to specify different parsing options.

      If you use the usebackq option, use one of the following syntaxes:

      Copy Code
      for /f ["usebackq <ParsingKeywords>"] {%%|%}<Variable> in (<Set>) do <Command> [<CommandLineOptions>]
for /f ["usebackq <ParsingKeywords>"] {%%|%}<Variable> in ("<LiteralString>") do <Command> [<CommandLineOptions>]
for /f ["usebackq <ParsingKeywords>"] {%%|%}<Variable> in ('<Command>') do <Command> [<CommandLineOptions>]
      The following table lists the parsing keywords that you can use for ParsingKeywords.

      Keyword Description

      eol=<c>

      Specifies an end of line character (just one character).

      skip=<N>

      Specifies the number of lines to skip at the beginning of the file.

      delims=<xxx>

      Specifies a delimiter set. This replaces the default delimiter set of space and tab.

      tokens=<X,Y,M–N>

      Specifies which tokens from each line are to be passed to the for loop for each iteration. As a result, additional variable names are allocated. M–N specifies a range, from the Mth through the Nth tokens. If the last character in the tokens= string is an asterisk (*), an additional variable is allocated, and it receives the remaining text on the line after the last token that is parsed.

      usebackq

      Specifies to execute a back-quoted string as a command, and a single-quoted string as a literal string command. Also, allows file names in Set to be enclosed in quotation marks.

    • Variable substitution

      The following table lists optional syntax (for any variable I).

      Variable with modifier Description

      %~I

      Expands %I which removes any surrounding quotation marks (" ").

      %~fI

      Expands %I to a fully-qualified path name.

      %~dI

      Expands %I to a drive letter only.

      %~pI

      Expands %I to a path only.

      %~nI

      Expands %I to a file name only.

      %~xI

      Expands %I to a file name extension only.

      %~sI

      Expands path to contain short names only.

      %~aI

      Expands %I to the file attributes of file.

      %~tI

      Expands %I to the date and time of file.

      %~zI

      Expands %I to the size of the file.

      %~$PATH:I

      Searches the directories listed in the PATH environment variable and expands %I to the fully qualified name of the first directory found. If the environment variable name is not defined or the file is not found by the search, this modifier expands to the empty string.

      The following table lists modifier combinations that you can use to get compound results.

      Variable with combined modifiers Description

      %~dpI

      Expands %I to a drive letter and path only.

      %~nxI

      Expands %I to a file name and extension only.

      %~fsI

      Expands %I to a full path name with short names only.

      %~dp$PATH:I

      Searches the directories that are listed in the PATH environment variable for %I and expands to the drive letter and path of the first one found.

      %~ftzaI

      Expands %I to an output line that is like dir.

      In the above examples, you can replace %I and PATH with other valid values. A valid for variable name terminates the %~ syntax.

      By using uppercase variable names such as %I, you can make your code more readable and avoid confusion with the modifiers, which are not case sensitive.

  • Parsing a string

    You can use the for /f parsing logic on an immediate string by wrapping Set in single quotes--for example, ('Set'). Set is treated as a single line of input from a file, and then it is parsed.

  • Parsing output

    You can use the for /f command to parse the output of a command by making a back-quoted string from the Set between the parentheses. It is treated as a command line, which is passed to a child Cmd.exe. The output is captured into memory and parsed as if it is a file.

Examples

To use for in a batch file, use the following syntax:

Copy Code
for {%%|%}<Variable> in (<Set>) do <Command> [<CommandLineOptions>]

To display the contents of all the files in the current directory that have the extension .doc or .txt by using the replaceable variable %f, type:

Copy Code
for %f in (*.doc *.txt) do type %f

In the preceding example, each file that has the .doc or .txt extension in the current directory is substituted for the %f variable until the contents of every file are displayed. To use this command in a batch file, replace every occurrence of %f with %%f. Otherwise, the variable is ignored and an error message is displayed.

To parse a file, ignoring commented lines, type:

Copy Code
for /f "eol=; tokens=2,3* delims=," %i in (myfile.txt) do @echo %i %j %k

This command parses each line in Myfile.txt. It ignores lines that begin with a semicolon and passes the second and third token from each line to the for body (tokens are delimited by commas or spaces). The body of the for statement references %i to get the second token, %j to get the third token, and %k to get all of the remaining tokens. If the file names that you supply contain spaces, use quotation marks around the text (for example, "File Name"). To use quotation marks, you must use usebackq. Otherwise, the quotation marks are interpreted as defining a literal string to parse.

%i is explicitly declared in the for statement. %j and %k are implicitly declared by using tokens=. You can use tokens= to specify up to 26 tokens, provided that it does not cause an attempt to declare a variable higher than the letter "z" or "Z."

The following example enumerates the environment variable names in the current environment. To parse the output of a command by placing Set between the parentheses, type:

Copy Code
for /f "usebackq delims==" %i in ('set') do @echo %i

Additional references

Command-Line Syntax Key


Forfiles

Applies To: Windows Vista,Windows Server 2008

Selects and executes a command on a file or set of files. This command is useful for batch processing.

For examples of how to use this command, see Examples.

Syntax

Copy Code
forfiles [/p <Path>] [/m <SearchMask>] [/s] [/c "<Command>"] [/d [{+|-}][{<Date>|<Days>}]]

Parameters

Parameter Description

/p <Path>

Specifies the path from which to start the search. By default, searching starts in the current working directory.

/m <SearchMask>

Searches files according to the specified search mask. The default search mask is *.*.

/s

Instructs the forfiles command to search into subdirectories recursively.

/c "<Command>"

Runs the specified command on each file. Command strings should be enclosed in quotation marks. The default command is "cmd /c echo @file".

/d [{+|-}][{<Date>|<Days>}]

Selects files with a last modified date within the specified time frame.

  • Selects files with a last modified date later than or equal to (+) or earlier than or equal to (-) the specified date, where Date is in the format MM/DD/YYYY.

  • Selects files with a last modified date later than or equal to (+) the current date plus the number of days specified, or earlier than or equal to (-) the current date minus the number of days specified.

  • Valid values for Days include any number in the range 0–32,768. If no sign is specified, + is used by default.

/?

Displays help at the command prompt.

Remarks

  • Forfiles is most commonly used in batch files.

  • Forfiles /s is similar to dir /s.

  • You can use the following variables in the command string as specified by the /c command-line option.

    Variable Description

    @FILE

    File name.

    @FNAME

    File name without extension.

    @EXT

    File name extension.

    @PATH

    Full path of the file.

    @RELPATH

    Relative path of the file.

    @ISDIR

    Evaluates to TRUE if a file type is a directory. Otherwise, this variable evaluates to FALSE.

    @FSIZE

    File size, in bytes.

    @FDATE

    Last modified date stamp on the file.

    @FTIME

    Last modified time stamp on the file.

  • With forfiles, you can run a command on or pass arguments to multiple files. For example, you could run the type command on all files in a tree with the .txt file name extension. Or you could execute every batch file (*.bat) on drive C, with the file name "Myinput.txt" as the first argument.

  • With forfiles, you can do any of the following:

    • Select files by an absolute date or a relative date by using the /d parameter.

    • Build an archive tree of files by using variables such as @FSIZE and @FDATE.

    • Differentiate files from directories by using the @ISDIR variable.

    • Include special characters in the command line by using the hexadecimal code for the character, in 0xHH format (for example, 0x09 for a tab).

  • Forfiles works by implementing the recurse subdirectories flag on tools that are designed to process only a single file.

Examples

To list all of the batch files on drive C, type:

Copy Code
forfiles /p c:\ /s /m *.bat /c "cmd /c echo @file is a batch file"

To list all of the directories on drive C, type:

Copy Code
forfiles /p c:\ /s /m *.* /c "cmd /c if @isdir==true echo @file is a directory"

To list all of the files in the current directory that are at least one year old, type:

Copy Code
forfiles /s /m *.* /d -365 /c "cmd /c echo @file is at least one year old."

To display the text "File is outdated" for each of the files in the current directory that are older than January 1, 2007, type:

Copy Code
forfiles /s /m *.* /d -01/01/2007 /c "cmd /c echo @file is outdated."

To list the file name extensions of all the files in the current directory in column format, and add a tab before the extension, type:

Copy Code
forfiles /s /m *.* /c "cmd /c echo The extension of @file is 0x09@ext"

Additional references

Command-Line Syntax Key


Format

Applies To: Windows Vista,Windows Server 2008

Formats a disk to accept Windows files.

For examples of how to use this command, see Examples.

Syntax

Copy Code
format <Volume> [/fs:{FAT|FAT32|NTFS}] [/v:<Label>] [/q] [/a:<UnitSize>] [/c] [/x] [/p:<Passes>]
format <Volume> [/v:<Label>] [/q] [/f:<Size>] [/p:<Passes>]
format <Volume> [/v:<Label>] [/q] [/t:<Tracks> /n:<Sectors>] [/p:<Passes>]
format <Volume> [/v:<Label>] [/q] [/p:<Passes>]
format <Volume> [/q]

Parameters

Parameter Description

<Volume>

Specifies the mount point, volume name, or drive letter (followed by a colon) of the drive that you want to format. If you do not specify any of the following command-line options, format uses the volume type to determine the default format for the disk.

/fs:{FAT|FAT32|NTFS}

Specifies the type of the file system: FAT, FAT32, NTFS, or UDF. Floppy disks can use only the FAT file system.

/v:<Label>

Specifies the volume label. If you omit the /v command-line option or use it without specifying a volume label, format prompts you for the volume label after the formatting is complete. Use the syntax /v: to prevent the prompt for a volume label. If you use a single format command to format more than one disk, all of the disks will be given the same volume label.

/a:<UnitSize>

Specifies the allocation unit size to use on FAT, FAT32, or NTFS volumes. If you do not specify UnitSize, it is chosen based on volume size. Default settings are strongly recommended for general use. The following list presents valid values for NTFS, FAT, and FAT32 UnitSize:

512

1024

2048

4096

8192

16K

32K

64K

FAT and FAT32 also support 128K and 256K for a sector size greater than 512 bytes.

/q

Performs a quick format. Deletes the file table and the root directory of a previously formatted volume, but does not perform a sector-by-sector scan for bad areas. You should use the /q command-line option to format only previously formatted volumes that you know are in good condition. Note that /q overrides /p.

/f:<Size>

Specifies the size of the floppy disk to format. When possible, use this command-line option instead of the /t and /n command-line options. Windows accepts the following values for size:

  • 1440 or 1440k or 1440kb

  • 1.44 or 1.44m or 1.44mb

  • 1.44-MB, double-sided, quadruple-density, 3.5-inch disk

/t:<Tracks>

Specifies the number of tracks on the disk. When possible, use the /f command-line option instead. If you use the /t option, you must also use the /n option. These options together provide an alternative method of specifying the size of the disk that is being formatted. This option is not valid with the /f option.

/n:<Sectors>

Specifies the number of sectors per track. When possible, use the /f command-line option instead of /n. If you use /n, you must also use /t. These two options together provide an alternative method of specifying the size of the disk that is being formatted. This option is not valid with the /f option.

/p:<Passes>

Zeros every sector on the volume for the number of passes specified. This option is not valid with the /q option.

/c

NTFS only. Files created on the new volume will be compressed by default.

/x

Causes the volume to dismount, if necessary, before it is formatted. Any open handles to the volume will no longer be valid.

/?

Displays help at the command prompt.

Remarks

  • Administrative credentials

    You must be a member of the Administrators group to format a hard drive.

  • Using format

    The format command creates a new root directory and file system for the disk. It can also check for bad areas on the disk, and it can delete all data on the disk. To be able to use a new disk, you must first use this command to format the disk.

  • Adding a volume label

    After formatting a floppy disk, format displays the following message:

    Volume label (11 characters, ENTER for none)?

    To add a volume label, type up to 11 characters (including spaces). If you do not want to add a volume label to the disk, press ENTER.

  • Formatting a hard disk

Note
You must be a member of the Administrators group to format a hard disk.

When you use the format command to format a hard disk, a warning message similar to the following displays:

Copy Code
WARNING, ALL DATA ON NON-REMOVABLE DISK
DRIVE x: WILL BE LOST!
Proceed with Format (Y/N)? _

To format the hard disk, press Y; if you do not want to format the disk, press N.

  • Unit size

    FAT file systems restrict the number of clusters to no more than 65526. FAT32 file systems restrict the number of clusters to between 65527 and 4177917.

    NTFS compression is not supported for allocation unit sizes above 4096.

Note
Format will immediately stop processing if it determines that the previous requirements cannot be met using the specified cluster size.

  • Format messages

    When formatting is complete, format displays messages that show the total disk space, the spaces marked as defective, and the space available for your files.

  • Quick formatting

    You can speed up the formatting process by using the /q command-line option. Use this option only if there are no bad sectors on your hard disk.

  • Using format with a reassigned drive or a network drive

    You should not use the format command on a drive that was prepared by using the subst command. You cannot format disks over a network.

  • Format exit codes

    The following table lists each exit code and a brief description of its meaning.

    Exit code Description

    0

    The format operation was successful.

    1

    Incorrect parameters were supplied.

    4

    A fatal error occurred (which is any error other than 0, 1, or 5).

    5

    The user pressed N in response to the prompt "Proceed with Format (Y/N)?" to stop the process.

    You can check these exit codes by using the ERRORLEVEL environment variable with the if batch command.

  • Using format at the Recovery Console

    The format command, with different parameters, is available from the Recovery Console.

Examples

To format a new floppy disk in drive A using the default size, type:

Copy Code
format a:

To perform a quick format operation on a previously formatted floppy disk in drive A, type:

Copy Code
format a: /q

To format a floppy disk in drive A and assign it the volume label "DATA," type:

Copy Code
format a: /v:DATA

Additional references

Command-Line Syntax Key


Freedisk

Applies To: Windows Server 2008,Windows Vista

Checks to see if the specified amount of disk space is available before continuing with an installation process.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
freedisk [/s <Computer> [/u [<Domain>\]<User> [/p [<Password>]]]] [/d <Drive>] [<Value>]

Parameters

Parameter | Description
/s <Computer> | Specifies the name or IP address of a remote computer (do not use backslashes). The default is the local computer. This parameter applies to all files and folders specified in the command.
/u [<Domain>\]<User> | Runs the script with the permissions of the specified user account. The default is system permissions.
/p [<Password>] | Specifies the password of the user account that is specified in /u.
/d <Drive> | Specifies the drive for which you want to find out the availability of free space. You must specify <Drive>for a remote computer.
<Value> | Checks for a specific amount of free disk space. You can specify <Value>in bytes, KB, MB, GB, TB, PB, EB, ZB or YB.

Remarks

  • Using the /s, /u, and /p command-line options The /u and /p command-line options are available only when you use /s. You must use /p with /u to provide the user's password.

  • For unattended installations, you can use freedisk in installation batch files to check for the prerequisite amount free space before continuing with the installation.

  • When you use freedisk in a batch file, it returns a 0 if there is enough space and a 1 if there is not enough space.

Examples

Examples

To determine whether there are at least 50 MB of free space available on drive C:, type:

Copy Code
freedisk 50mb

Output similar to the following appears on the screen:

Copy Code
INFO: The specified 52,428,800 byte(s) of free space is available on current drive.

Additional references

Command-Line Syntax Key


Fsutil

Applies To: Windows Vista,Windows Server 2003,Windows Server 2000,Windows Server 2003 R2,Windows 7,Windows Server 2008,Windows Server 2008 R2

Performs tasks that are related to file allocation table (FAT) and NTFS file systems, such as managing reparse points, managing sparse files, or dismounting a volume. If it is used without parameters, fsutil displays a list of supported subcommands.

Note
You must be logged on as an administrator or a member of the Administrators group to use fsutil. The fsutil command is quite powerful and should be used only by advanced users who have a thorough knowledge of Windows operating systems.

Parameters

The following table lists the fsutil subcommands.

Subcommand Description

Fsutil 8dot3name

Queries or changes the settings for short name behavior on the system, for example, generates 8.3 character-length file names. Removes short names for all files within a directory. Scans a directory and identifies registry keys that might be impacted if short names were stripped from the files in the directory.

This parameter applies to: Windows Server® 2008 R2 and Windows® 7.

Fsutil behavior

Queries or sets NTFS volume behavior, which includes:

  • The last access time stamp on NTFS volumes

  • How often quota events are written to the system log

  • The internal cache levels of NTFS paged pool and NTFS non-paged pool memory

  • The amount of disk space reserved for the master file table (MFT) Zone

  • The silent deletion of data when the system encounters corruption on an NTFS volume.

Fsutil dirty

Queries whether the volume's dirty bit is set or sets a volume's dirty bit. When a volume's dirty bit is set, autochk automatically checks the volume for errors the next time the computer is restarted.

Fsutil file

Finds a file by user name (if Disk Quotas are enabled), queries allocated ranges for a file, sets a file's short name, sets a file's valid data length, sets zero data for a file, creates a new file of a specified size, finds a file ID if given the name, or finds a file link name for a specified file ID.

Fsutil fsinfo

Lists all drives and queries the drive type, volume information, NTFS-specific volume information, or file system statistics.

Fsutil hardlink

Creates a hard link (a directory entry for a file). Every file can be considered to have at least one hard link. On NTFS volumes, each file can have multiple hard links, so a single file can appear in many directories (or even in the same directory, with different names). Because all of the links reference the same file, programs can open any of the links and modify the file. A file is deleted from the file system only after all links to it are deleted. After you create a hard link, programs can use it like any other file name.

Lists the hard links for a specified file.

Fsutil objectid

Manages object identifiers, which are used by the Windows operating system to track objects such as files and directories.

Fsutil quota

Manages disk quotas on NTFS volumes to provide more precise control of network-based storage. Disk quotas are implemented on a per-volume basis and enable both hard- and soft-storage limits to be implemented on a per-user basis.

Fsutil repair

Queries or sets the self-healing state of the volume. Self-healing NTFS attempts to correct corruptions of the NTFS file system online without requiring Chkdsk.exe to be run.

Includes initiating on-disk verification and waiting for repair completion.

Fsutil reparsepoint

Queries or deletes reparse points (NTFS file system objects that have a definable attribute containing user-controlled data). Reparse points are used to extend functionality in the input/output (I/O) subsystem. They are used for directory junction points and volume mount points. They are also used by file system filter drivers to mark certain files as special to that driver.

This parameter applies to: Windows Vista®, Windows Server 2008, Windows Server 2008 R2 and Windows 7.

Fsutil resource

Creates a Secondary Transactional Resource Manager, starts or stops a Transactional Resource Manager, or displays information about a Transactional Resource Manager and modifies the following behavior:

  • Whether a default Transactional Resource Manager will clean its transactional metadata at the next mount

  • The specified Transactional Resource Manager to prefer consistency over availability

  • The specified Transaction Resource Manager to prefer availability over consistency

  • The characteristics of a running Transactional Resource Manager

This parameter applies to: Windows Vista, Windows Server 2008, Windows Server 2008 R2 and Windows 7.

Fsutil sparse

Manages sparse files. A sparse file is a file with one or more regions of unallocated data in it. A program will see these unallocated regions as containing bytes with the value zero, but no disk space is used to represent these zeros. All meaningful or nonzero data is allocated, whereas all non-meaningful data (large strings of data composed of zeros) is not allocated. When a sparse file is read, allocated data is returned as stored and unallocated data is returned as zeros (by default in accordance with the C2 security requirement specification). Sparse file support allows data to be deallocated from anywhere in the file.

Fsutil transaction

Commits a specified transaction, rolls back a specified transaction, or displays the following information:

  1. A list of currently running transactions

  2. Transaction information for a specific file

  3. Information for a specific transaction

    This parameter applies to: Windows Vista, Windows Server 2008, Windows Server 2008 R2 and Windows 7.

Fsutil usn

Manages the update sequence number (USN) change journal, which provides a persistent log of all changes made to files on the volume.

Fsutil volume

Manages a volume. Dismounts a volume, queries to see how much free space is available on a disk, or finds a file that is using a specified cluster.

Additional references

Command-Line Syntax Key


Fsutil 8dot3name

Applies To: Windows Server 2008 R2,Windows 7

Queries or changes the settings for short name (8dot3 name) behavior, which include:

  • Query the current setting for the short name behavior

  • Scan the specified directory path for registry keys that might be impacted if short names were stripped from the specified directory path

  • Change the setting that controls the short name behavior. This setting can be applied to a specified volume or to the default volume setting.

  • Remove the short names for all files within a directory

For examples of how to use this command, see Examples.

Syntax

Copy Code
fsutil 8dot3name [query] [<VolumePath>]
fsutil 8dot3name [scan] [/s] [/l [<log file>] ] [/v] <DirectoryPath>
fsutil 8dot3name [set] { <DefaultValue> | <VolumePath> {1|0}}
fsutil 8dot3name [strip] [/t] [/s] [/f] [/l [<log file.] ] [/v] <DirectoryPath>

Parameters

Parameter Description

query [<VolumePath>]

Queries the file system for the state of the 8dot3 short name creation behavior.

If a VolumePath is not specified as a parameter, the default 8dot3name creation behavior setting for all volumes is displayed.

scan <DirectoryPath>

Scans the files that are located in the specified DirectoryPath for registry keys that might be impacted if 8dot3 short names were stripped from the file names.

set { <DefaultValue> | <VolumePath>}

Changes the file system behavior for 8dot3 name creation in the following instances:

  • When DefaultValue is specified, the registry key, HKLM\System\CurrentControlSet\Control\FileSystem\NtfsDisable8dot3NameCreationNtfsDisable8dot3NameCreationNtfsDisable8dot3NameCreation, will be set to the DefaultValue.

    The DefaultValue can have the following values:

    • 0: Enables 8dot3 name creation for all volumes on the system.

    • 1: Disables 8dot3 name creation for all volumes on the system.

    • 2: Sets 8dot3 name creation on a per volume basis.

    • 3: Disables 8dot3 name creation for all volumes except the system volume.

  • When a VolumePath is specified, the specified volumes on disk flag 8dot3name properties will be set to enable 8dot3 name creation for a specified volume (0) or set to disable 8dot3 name creation on the specified volume (1).

    You must set the default file system behavior for 8dot3 name creation to the value 2 before you can enable or disable 8dot3 name creation for a specified volume.

strip <DirectoryPath>

Removes the 8dot3 file names for all files that are located in the specified DirectoryPath. The 8dot3 file name is not removed for any files where the DirectoryPath combined with the file name contains more than 260 characters.

This command lists, but does not modify the registry keys that point to the files that had 8dot3 file names permanently removed.

For more information about the effects of permanently removing the 8dot3 file names from files, see Remarks.

<VolumePath>

Specifies the drive name followed by a colon or the GUID in the format Volume{GUID}.

/f

Specifies that all files that are located in the specified DirectoryPath will have the 8dot3 file names removed even if there are registry keys that point to files using the 8dot3 file name. In this case, the operation removes the 8dot3 file names, but does not modify any registry keys that point to the files that are using the 8dot3 file names.

Warning
It is recommended that you back up your directory or volume prior to using the /f parameter because it may lead to unexpected application failures, including the inability to uninstall programs.

/l [<log file>]

Specifies a log file where information will be written.

If the /l parameter is not specified, all information is written to the default log file:

%temp%\8dot3_removal_log@( GMT YYYY-MM-DD HH-MM-SS ).log

/s

Specifies that the operation should be applied to the subdirectories of the specified DirectoryPath.

/t

Specifies that the removal of 8dot3 file names should be run in test mode. All operations except the actual removal of the 8dot3 file names are performed. You can use test mode to discover which registry keys point to files that use the 8dot3 file names.

/v

Specifies that all information that is written to the log file is also displayed on the command-line.

Remarks

  • Permanently removing 8dot3 file names and not modifying registry keys that point to the 8dot3 file names may lead to unexpected application failures, including the inability to uninstall an application. It is recommended you first back up your directory or volume before you attempt to remove 8dot3 file names.

Examples

To query for the disable 8dot3 name behavior for a disk volume that is specified with the GUID, {928842df-5a01-11de-a85c-806e6f6e6963}, type:

Copy Code
fsutil 8dot3name query Volume{928842df-5a01-11de-a85c-806e6f6e6963}

You can also query the 8dot3 name behavior by using the behavior subcommand.

To remove 8dot3 file names in the D:\MyData directory and all subdirectories, while writing the information to the log file that is specified as mylogfile.log, type:

Copy Code
fsutil 8dot3name scan /l mylogfile.log /s d:\MyData

Additional references

Command-Line Syntax Key

Fsutil

Fsutil 8dot3name

Fsutil behavior


Fsutil behavior

Applies To: Windows Server 2003 R2,Windows 7,Windows Server 2000,Windows Server 2003,Windows Vista,Windows Server 2008,Windows Server 2008 R2

Queries or sets NTFS volume behavior, which includes:

  • The creation of 8.3 character-length file names

  • Extended character use in 8.3 character-length short file names on NTFS volumes

  • The updating of the Last Access Time stamp when directories are listed on NTFS volumes

  • The frequency with which quota events are written to the system log and to NTFS paged pool and NTFS non-paged pool memory cache levels

  • The size of the master file table zone (MFT Zone)

  • Silent deletion of data when the system encounters corruption on an NTFS volume.

For examples of how to use this command, see Examples.

Syntax

Copy Code
fsutil behavior query {allowextchar | bugcheckoncorrupt | disable8dot3 [<VolumePath>] | disablecompression | disableencryption | disablelastaccess | encryptpagingfile | mftzone | memoryusage | quotanotify | symlinkevaluation | disabledeletenotify}
fsutil behavior set {allowextchar {1|0} | bugcheckoncorrupt {1|0} | disable8dot3 [ <Value> | [<VolumePath> {1|0}] ] | disablecompression {1|0} | disableencryption {1|0} | disablelastaccess {1|0} | encryppagingfile {1|0} | mftzone <Value> | memoryusage <Value> | quotanotify <Frequency> | symlinkevaluation <SymbolicLinkType> | disabledeletenotify {1|0}}

Parameters

Parameter Description

query

Queries the file system behavior parameters.

set

Changes the file system behavior parameters.

allowextchar {1|0}

Allows (1) or disallows (0) characters from the extended character set (including diacritic characters) to be used in 8.3 character-length short file names on NTFS volumes.

You must reboot your computer for this parameter to take effect.

Bugcheckoncorrupt {1|0}

Allows (1) or disallows (0) generation of a bug check when there is corruption on an NTFS volume. This feature can be used to prevent NTFS from silently deleting data when used with the Self-Healing NTFS feature.

You must reboot your computer for this parameter to take effect.

This parameter applies to: Windows Server® 2008 R2 and Windows® 7.

disable8dot3 [<VolumePath>] {1|0}

Disables (1) or enables (0) the creation of 8.3 character-length file names on FAT- and NTFS-formatted volumes. Optionally, prefix with the VolumePath specified as a drive name followed by a colon or GUID.

disablecompression {1|0}

Disables (1) or enables (0) NTFS compression.

You must reboot your computer for this parameter to take effect.

disableencryption {1|0}

Disables (1) or enables (0) the encryption of folders and files on NTFS volumes.

You must reboot your computer for this parameter to take effect.

disablelastaccess {1|0}

Disables (1) or enables (0) updates to the Last Access Time stamp on each directory when directories are listed on an NTFS volume.

You must reboot your computer for this parameter to take effect.

encryppagingfile {1|0}

Encrypts (1) or does not encrypt (0) the memory paging file in the Windows operating system.

You must reboot your computer for this parameter to take effect.

mftzone <Value>

Sets the size of the MFT Zone, and is expressed as a multiple of 200MB units. Set Value to a number from 1 (default is 200 MB) to 4 (maximum is 800 MB).

You must reboot your computer for this parameter to take effect.

memoryusage <Value>

Configures the internal cache levels of NTFS paged-pool memory and NTFS nonpaged-pool memory. Set to 1 or 2. When set to 1 (the default), NTFS uses the default amount of paged-pool memory. When set to 2, NTFS increases the size of its lookaside lists and memory thresholds. (A lookaside list is a pool of fixed-size memory buffers that the kernel and device drivers create as private memory caches for file system operations, such as reading a file.)

You must reboot your computer for this parameter to take effect.

quotanotify <Frequency>

Configures how frequently NTFS quota violations are reported in the system log. Valid values for are in the range 0 – 4294967295. The default frequency is 3600 seconds (one hour).

You must reboot your computer for this parameter to take effect.

symlinkevaluation <SymbolicLinkType>

Controls the kind of symbolic links that can be created on a computer. Valid choices are:

  1. Local to local symbolic links, L2L:{0|1}

  2. Local to remote symbolic links, L2R:{0|1}

  3. Remote to local symbolic links, R2R:{0|1}

  4. Remote to remote symbolic links, R2L:{0|1}

DisableDeleteNotify

Disables (1) or enables (0) delete notifications for all volumes. Delete notification is a feature that notifies the underlying storage device of clusters that have been freed due to a file delete operation.

This parameter applies to: Windows Server 2008 R2 and Windows 7.

Remarks

  • The MFT Zone is a reserved area that enables the master file table (MFT) to expand as needed to prevent MFT fragmentation. If the average file size on the volume is 2 KB or less, it can be beneficial to set the mftzone value to 2. If the average file size on the volume is 1 KB or less, it can be beneficial to set the mftzone value to 4.

  • When disable8dot3 is set to 0, every time you create a file with a long file name, NTFS creates a second file entry that has an 8.3 character-length file name. When NTFS creates files in a directory, it must look up the 8.3 character-length file names that are associated with the long file names. This parameter updates the HKLM\SYSTEM\CurrentControlSet\Control\FileSystem\NtfsDisable8dot3NameCreation registry key.

  • The allowextchar parameter updates the HKLM\SYSTEM\CurrentControlSet\Control\FileSystem\NtfsAllowExtendedCharacterIn8dot3Name registry key.

    The disablelastaccess parameter reduces the impact of logging updates to the Last Access Time stamp on files and directories. Disabling the Last Access Time feature improves the speed of file and directory access. This parameter updates the HKLM\SYSTEM\CurrentControlSet\Control\FileSystem\NtfsDisableLastAccessUpdate registry key.

    Notes:

    • File-based Last Access Time queries are accurate even if all on-disk values are not current. NTFS returns the correct value on queries because the accurate value is stored in memory.

    • One hour is the maximum amount of time that NTFS defers updating Last Access Time on disk. If NTFS updates other file attributes such as Last Modify Time, and a Last Access Time update is pending, NTFS updates Last Access Time with the other updates without additional performance impact.

    • The disablelastaccess parameter can affect programs such as Backup and Remote Storage that rely on this feature.

  • Increasing physical memory does not always increase the amount of paged pool memory available to NTFS. Setting memoryusage to 2 raises the limit of paged pool memory. This might improve performance if your system is opening and closing many files in the same file set and is not already using large amounts of system memory for other applications or for cache memory. If your computer is already using large amounts of system memory for other applications or for cache memory, increasing the limit of NTFS paged and non-paged pool memory reduces the available pool memory for other processes. This might reduce overall system performance. This parameter updates the HKLM\SYSTEM\CurrentControlSet\Control\FileSystem\NtfsMemoryUsage registry key.

  • The value specified in the mftzone parameter is an approximation of the initial size of the MFT plus the MFT Zone on a new volume, and it is set at mount time for each file system. As space on the volume is used, NTFS adjusts the space reserved for future MFT growth. If the MFT Zone is already large, the full MFT Zone size is not reserved again. Because the MFT Zone is based on the contiguous range past the end of the MFT, it shrinks as the space is used.

    The file system does not determine the new MFT Zone location until the current MFT Zone is completely used. Note that this never occurs on a typical system.

  • Some devices may experience performance degradation when the delete notification feature is turned on. In this case, use the disabledeletenotify option to turn off the notification feature.

Examples

To query for the disable 8dot3 name behavior for a disk volume specified with the GUID, {928842df-5a01-11de-a85c-806e6f6e6963}, type:

Copy Code
fsutil behavior query disable8dot3 Volume{928842df-5a01-11de-a85c-806e6f6e6963}

You can also query the 8dot3 name behavior by using the 8dot3name subcommand.

Additional references

Command-Line Syntax Key

Fsutil

Fsutil 8dot3name


Fsutil dirty

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Server 2003,Windows Vista,Windows Server 2000,Windows 7,Windows Server 2003 R2

Queries or sets a volume's dirty bit. When a volume's dirty bit is set, autochk automatically checks the volume for errors the next time the computer is restarted.

For examples of how to use this command, see Examples.

Syntax

Copy Code
fsutil dirty {query | set} <VolumePath>

Parameters

Parameter | Description
query | Queries the specified volume's dirty bit.
set | Sets the specified volume's dirty bit.
<VolumePath> | Specifies the drive name followed by a colon or GUID in the following format: Volume{GUID}.

Remarks

  • A volume's dirty bit indicates that the file system may be in an inconsistent state. The dirty bit can be set because:

    • The volume is online and it has outstanding changes.

    • Changes were made to the volume and the computer was shut down before the changes were committed to the disk.

    • Corruption was detected on the volume.

  • If the dirty bit is set when the computer restarts, chkdsk runs to verify the file system integrity and to attempt to fix any issues with the volume.

Examples

To query the dirty bit on drive C, type:

Copy Code
fsutil dirty query c:
  • If the volume is dirty, the following output displays:

    Volume C: is dirty

  • If the volume is not dirty, the following output displays:

    Volume C: is not dirty

To set the dirty bit on drive C, type:

Copy Code
fsutil dirty set C:

Additional references

Command-Line Syntax Key

Fsutil


Fsutil file

Applies To: Windows Server 2003 R2,Windows 7,Windows Server 2000,Windows Vista,Windows Server 2003,Windows Server 2008,Windows Server 2008 R2

Finds a file by user name (if Disk Quotas are enabled), queries allocated ranges for a file, sets a file's short name, sets a file's valid data length, sets zero data for a file, or creates a new file.

For examples of how to use this command, see Examples.

Syntax

Copy Code
fsutil file [createnew] <FileName> <Length>
fsutil file [findbysid] <UserName> <Directory>
fsutil file [queryallocranges] offset=<Offset> length=<Length> <FileName>
fsutil file [quaeryfileid] <FileName>
fsutil file [queryfilenamebyid] <Volume> <Fileid>
fsutil file [setshortname] <FileName> <ShortName>
fsutil file [setvaliddata] <FileName> <DataLength>
fsutil file [setzerodata] offset=<Offset> length=<Length> <FileName>

Parameters

Parameter | Description
createnew | Creates a file of the specified name and size, with content that consists of zeroes.
<FileName> | Specifies the full path to the file including the file name and extension, for example C:\documents\filename.txt.
<Length> | Specifies the file's valid data length.
findbysid | Finds files that belong to a specified user on NTFS volumes where Disk Quotas are enabled.
<UserName> | Specifies the user's user name or logon name.
<Directory> | Specifies the full path to the directory, for example C:\users.
queryallocranges | Queries the allocated ranges for a file on an NTFS volume. Useful for determining whether a file has sparse regions.
offset=<Offset> | Specifies the start of the range that should be set to zeroes.
length=<Length> | Specifies the length of the range (in bytes).
queryfileid | Queries the file ID of a file on an NTFS volume. This parameter applies to: Windows Server® 2008 R2 and Windows® 7.
queryfilenamebyid | Displays a random link name for a specified file ID on an NTFS volume. Since a file can have more than one link name pointing to that file, it is not guaranteed which file link will be provided as a result of the query for the file name. This parameter applies to: Windows Server 2008 R2 and Windows 7.
<Fileid> | Specifies the ID of the file on an NTFS volume.
<Volume> | Specifies the volume as drive name followed by a colon.
setshortname | Sets the short name (8.3 character-length file name) for a file on an NTFS volume.
<ShortName> | Specifies the file's short name.
setvaliddata | Sets the valid data length for a file on an NTFS volume.
<DataLength> | Specifies the length of the file in bytes.
setzerodata | Sets a range (specified by Offset and Length) of the file to zeroes, which empties the file. If the file is a sparse file, the underlying allocation units are decommitted.

Remarks

  • In NTFS, there are two important concepts of file length: the end-of-file (EOF) marker and the Valid Data Length (VDL). The EOF indicates the actual length of the file. The VDL identifies the length of valid data on disk. Any reads between VDL and EOF automatically return 0 to preserve the C2 object reuse requirement.

  • The setvaliddata parameter is only available for administrators because it requires the Perform volume maintenance tasks (SeManageVolumePrivilege) privilege. This feature is only required for advanced multimedia and system area network scenarios. The setvaliddata parameter must be a positive value that is greater than the current VDL, but less than the current file size.

    It is useful for programs to set a VDL when:

    • Writing raw clusters directly to disk through a hardware channel. This allows the program to inform the file system that this range contains valid data that can be returned to the user.

    • Creating large files when performance is an issue. This avoids the time it takes to fill the file with zeroes when the file is created or extended.

Examples

To find files that are owned by scottb on drive C, type:

Copy Code
fsutil file findbysid scottb c:\users

To query the allocated ranges for a file on an NTFS volume, type:

Copy Code
fsutil file queryallocranges offset=1024 length=64 c:\temp\sample.txt

To set the short name for the file Longfilename.txt on drive C to Longfile.txt, type:

Copy Code
fsutil file setshortname c:\longfilename.txt longfile.txt

To set the valid data length to 4096 bytes for a file named Testfile.txt on an NTFS volume, type:

Copy Code
fsutil file setvaliddata c:\testfile.txt 4096

To set a range of a file on an NTFS volume to zeros to empty it, type:

Copy Code
fsutil file setzerodata offset=100 length=150 c:\temp\sample.txt

Additional references

Command-Line Syntax Key

Fsutil


Fsutil fsinfo

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Server 2003,Windows Vista,Windows Server 2000,Windows 7,Windows Server 2003 R2

Lists all drives, queries the drive type, queries volume information, queries NTFS-specific volume information, or queries file system statistics.

For examples of how to use this command, see Examples.

Syntax

Copy Code
fsutil fsinfo [drives]
fsutil fsinfo [drivetype] <VolumePath>
fsutil fsinfo [ntfsinfo] <RootPath>
fsutil fsinfo [statistics] <VolumePath>
fsutil fsinfo [volumeinfo] <RootPath>

Parameters

Parameter | Description
drives | Lists all drives in the computer.
drivetype | Queries a drive and lists its type, for example CD-ROM drive.
ntfsinfo | Lists NTFS specific volume information for the specified volume, such as the number of sectors, total clusters, free clusters, and the start and end of the MFT Zone.
statistics | Lists file system statistics for the specified volume, such as metadata, log file, and MFT reads and writes.
volumeinfo | Lists information for the specified volume, such as the file system, and whether the volume supports case-sensitive file names, unicode in file names, or disk quotas.
<VolumePath> | Specifies the drive letter (followed by a colon).
<RootPathname> | Specifies the drive letter (followed by a colon) of the root drive.

Examples

To list all of the drives in the computer, type:

Copy Code
fsutil fsinfo drives

Output similar to the following displays:

Copy Code
Drives: A:\ C:\ D:\ E:\

To query the drive type of drive C, type:

Copy Code
fsutil fsinfo drivetype c:

Possible results of the query include:

Copy Code
Unknown Drive
No such Root Directory
Removable Drive, for example floppy
Fixed Drive
Remote/Network Drive
CD-ROM Drive
Ram Disk

To query the volume information for volume E, type:

Copy Code
fsinfo volumeinfo e:\

Output similar to the following displays:

Copy Code
Volume Name :Volume
Serial Number : 0xd0b634d9
Max Component Length : 255
File System Name : NTFS
.
.
.
Supports Named Streams

To query drive F for NTFS-specific volume information, type:

Copy Code
fsutil fsinfo ntfsinfo f:

Output similar to the following displays:

Copy Code
NTFS Volume Serial Number : 0xe660d46a60d442cb
Number Sectors :            0x00000000010ea04f
Total Clusters :            0x000000000021d409
.
.
.
Mft Zone End   :            0x0000000000004700

To query the file system statistics for drive E, type:

Copy Code
fsinfo statistics e:

Output similar to the following displays:

Copy Code
File System Type :     NTFS
Version :              1
UserFileReads :        75021
UserFileReadBytes :    1305244512
.
.
.
LogFileWriteBytes :    180936704

Additional references

Command-Line Syntax Key

Fsutil


Fsutil hardlink

Applies To: Windows Server 2003 R2,Windows 7,Windows Server 2000,Windows Server 2003,Windows Vista,Windows Server 2008,Windows Server 2008 R2

Creates a hard link between an existing file and a new file.

Syntax

Copy Code
fsutil hardlink create <NewFileName> <ExistingFileName>
fsutil hardlink list <Filename>

Parameters

Parameter | Description
create | Establishes an NTFS hard link between an existing file and a new file. (An NTFS hard link is similar to a POSIX hard link.)
<NewFileName> | Specifies the file that you want to create a hard link to.
<ExistingFileName> | Specifies the file that you want to create a hard link from.
list | Lists the hardlinks to Filename. This parameter applies to: Windows Server® 2008 R2 and Windows® 7.

Remarks

  • A hard link is a directory entry for a file. Every file can be considered to have at least one hard link. On NTFS volumes, each file can have multiple hard links, so a single file can appear in many directories (or even in the same directory with different names). Because all of the links reference the same file, programs can open any of the links and modify the file. A file is deleted from the file system only after all links to it have been deleted. After you create a hard link, programs can use it like any other file name.

Additional references

Command-Line Syntax Key

Fsutil


Fsutil objectid

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Server 2003,Windows Vista,Windows Server 2000,Windows 7,Windows Server 2003 R2

Manages object identifiers (OIDs), which are internal objects used by the Distributed Link Tracking (DLT) Client service and File Replication service (FRS) to track other objects such as files, directories, and links. Object identifiers are invisible to most programs and should never be modified.

Caution
Do not delete, set, or otherwise modify an object identifier. Deleting or setting an object identifier can result in the loss of data from portions of a file, up to and including entire volumes of data. In addition, you might cause adverse behavior in the Distributed Link Tracking (DLT) Client service and File Replication service (FRS).

For examples of how to use this command, see Examples.

Syntax

Copy Code
fsutil objectid [create] <FileName>
fsutil objectid [delete] <FileName>
fsutil objectid [query] <FileName>
fsutil objectid [set] <ObjectID> <BirthVolumeID> <BirthObjectID> <DomainID> <FileName>

Parameters

Parameter | Description
create | Creates an object identifier if the specified file does not already have one. If the file already has an object identifier, this subcommand is equivalent to the query subcommand.
delete | Deletes an object identifier.
query | Queries an object identifier.
set | Sets an object identifier.
<ObjectID> | Sets a file-specific 16 byte hexadecimal identifier that is guaranteed to be unique within a volume. The object identifier is used by the Distributed Link Tracking (DLT) Client service and the File Replication service (FRS) to identify files.
<BirthVolumeID> | Indicates the volume on which the file was located when it first obtained an object identifier. This value is a 16 byte hexadecimal identifier that is used by the DLT Client service.
<BirthObjectID> | Indicates the file's original object identifier (The ObjectID may change when a file is moved). This value is a 16 byte hexadecimal identifier that is used by the DLT Client service.
<DomainID> | 16 byte hexadecimal domain identifier. This value is not currently used and must be set to all zeros.
<FileName> | Specifies the full path to the file including the file name and extension, for example C:\documents\filename.txt.

Remarks

  • Any file that has an object identifier also has a birth volume identifier, a birth object identifier, and a domain identifier. When you move a file, the object identifier may change, but the birth volume and birth object identifiers remain the same. This behavior enables the Windows operating system to always find a file, no matter where it has been moved.

Examples

To create an object identifier, type:

fsutil objectid create c:\temp\sample.txt

To delete an object identifier, type:

fsutil objectid delete c:\temp\sample.txt

To query an object identifier, type:

fsutil objectid query c:\temp\sample.txt

To set an object identifier, type:

fsutil objectid set 40dff02fc9b4d4118f120090273fa9fc f86ad6865fe8d21183910008c709d19e 40dff02fc9b4d4118f120090273fa9fc 00000000000000000000000000000000 c:\temp\sample.txt

Additional references

Command-Line Syntax Key

Fsutil


Fsutil quota

Applies To: Windows Server 2003 R2,Windows 7,Windows Server 2000,Windows Vista,Windows Server 2003,Windows Server 2008,Windows Server 2008 R2

Manages disk quotas on NTFS volumes to provide more precise control of network-based storage.

For examples of how to use this command, see Examples.

Syntax

Copy Code
fsutil quota [disable] <VolumePath>
fsutil quota [enforce] <VolumePath>
fsutil quota [modify] <VolumePath> <Threshold> <Limit> <UserName>
fsutil quota [query] <VolumePath>
fsutil quota [track] <VolumePath>
fsutil quota [violations]

Parameters

Parameter | Description
disable | Disables quota tracking and enforcement on the specified volume.
enforce | Enforces quota usage on the specified volume.
modify | Modifies an existing disk quota or creates a new quota.
query | Lists existing disk quotas.
track | Tracks disk usage on the specified volume.
violations | Searches the system and application logs and displays a message to indicate that quota violations have been detected or that a user has reached a quota threshold or quota limit.
<VolumePath> | Required. Specifies the drive name followed by a colon or the GUID in the format Volume{GUID}.
<Threshold> | Sets the limit (in bytes) at which warnings are issued. This parameter is required for the fsutil quota modify command.
<Limit> | Sets the maximum allowed disk usage (in bytes). This parameter is required for the fsutil quota modify command.
<UserName> | Specifies the domain or user name. This parameter is required for the fsutil quota modify command.

Remarks

  • Disk quotas are implemented on a per-volume basis, and they enable both hard and soft storage limits to be implemented on a per-user basis.

  • You can use write scripts that use fsutil quota to set the quota limits every time you add a new user or to automatically track quota limits, compile them into a report, and automatically send them to the system administrator in e-mail.

Examples

To list existing disk quotas for a disk volume that is specified with the GUID, {928842df-5a01-11de-a85c-806e6f6e6963}, type:

Copy Code
fsutil quota query Volume{928842df-5a01-11de-a85c-806e6f6e6963}

To list existing disk quotas for a disk volume that is specified with the drive letter, C:, type:

Copy Code
Fsutil quota query C:

Additional references

Command-Line Syntax Key

Fsutil


Fsutil repair

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Administers and monitors NTFS self-healing repair operations.

For examples of how to use this command, see Examples.

Syntax

Copy Code
fsutil repair [initiate] <VolumePath> <FileReference>
fsutil repair [query] <VolumePath>
fsutil repair [set] <VolumePath> <Flags>
fsutil repair [wait][<WaitType>] <VolumePath>

Parameters

Parameter Description

initiate

Initiates NTFS self-healing.

<VolumePath>

Specifies the volume as the drive name followed by a colon.

<FileReference>

Specifies the NTFS volume-specific file ID (file reference number). The file reference includes the segment number of the file.

query

Queries the self-healing state of the NTFS volume.

set

Sets the self-healing state of the volume.

<Flags>

Specifies the repair method to be used when setting the self-healing state of the volume.

The Flags parameter can be set to three values:

  • 0x01: Enables general repair.

  • 0x09: Warns about potential data loss without repair.

  • 0x00: Disables NTFS self-healing repair operations.

wait

Waits for repair(s) to complete. If NTFS has detected a problem on a volume on which it is performing repairs, this option allows the system to wait until the repair is complete before it runs any pending scripts.

[WaitType {0|1}]

Indicates whether to wait for the current repair to complete or to wait for all repairs to complete. WaitType can be set to the following values:

  • 0: Waits for all repairs to complete. (default value)

  • 1: Waits for the current repair to complete.

Remarks

  • Self-healing NTFS attempts to correct corruptions of the NTFS file system online, without requiring Chkdsk.exe to be run. This feature was introduced in Windows Server 2008. For more information, see Self Healing NTFS.

Examples

To enable self-healing repair on drive C, type:

Copy Code
fsutil repair set c: 1

To disable self-healing repair on drive C, type:

Copy Code
fsutil repair set c: 0

Additional references

Command-Line Syntax Key

Fsutil

Self Healing NTFS


Fsutil reparsepoint

Applies To: Windows Server 2003 R2,Windows 7,Windows Vista,Windows Server 2003,Windows Server 2000,Windows Server 2008,Windows Server 2008 R2

Queries or deletes reparse points. The fsutil reparsepoint command is typically used by support professionals.

For examples of how to use this command, see Examples.

Syntax

Copy Code
fsutil reparsepoint [query] <FileName>
fsutil reparsepoint [delete] <FileName>

Parameters

Parameter | Description
query | Retrieves the reparse point data that is associated with the file or directory identified by the specified handle.
delete | Deletes a reparse point from the file or directory that is identified by the specified handle, but does not delete the file or directory.
<FileName> | Specifies the full path to the file including the file name and extension, for example C:\documents\filename.txt.

Remarks

  • Reparse points are NTFS file system objects that have a definable attribute that contains user-defined data, and they are used to extend functionality in the input/output (I/O) subsystem.

  • Reparse points are used for directory junction points and volume mount points. They are also used by file system filter drivers to mark certain files as special to that driver.

  • When a program sets a reparse point, it stores this data, plus a reparse tag, which uniquely identifies the data it is storing. When the file system opens a file with a reparse point, it attempts to find the associated file system filter. If the file system filter is found, the filter processes the file as directed by the reparse data. If no file system filter is found, the File open operation fails.

Examples

To retrieve reparse point data associated with C:\Server, type:

Copy Code
fsutil reparsepoint query c:\server

To delete a reparse point from a specified file or directory, use the following format:

Copy Code
fsutil reparsepoint delete c:\server

Additional references

Command-Line Syntax Key

Fsutil


Fsutil resource

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Creates a Secondary Transactional Resource Manager, starts or stops a Transactional Resource Manager, or displays information about a Transactional Resource Manager and modifies the following behavior:

  • Whether a default Transactional Resource Manager will clean its transactional metadata at the next mount

  • The specified Transactional Resource Manager to prefer consistency over availability

  • The specified Transaction Resource Manager to prefer availability over consistency

  • The characteristics of a running Transactional Resource Manager

For examples of how to use this command, see Examples .

Syntax

Copy Code
fsutil resource [create] <RmRootPathname>
fsutil resource [info] <RmRootPathname>
fsutil resource [setautoreset] {true|false} <DefaultRmRootPathname>
fsutil resource [setavailable] <RmRootPathname>
fsutil resource [setconsistent] <RmRootPathname>
fsutil resource [setlog] [growth {<Containers> containers|<Percent> percent} <RmRootPathname>] [maxextents <Containers> <RmRootPathname>] [minextents <Containers> <RmRootPathname>] [mode {full|undo} <RmRootPathname>] [rename <RmRootPathname>] [shrink <percent> <RmRootPathname>] [size <Containers> <RmRootPathname>]
fsutil resource [start] <RmRootPathname> [<RmLogPathname> <TmLogPathname>
fsutil resource [stop] <RmRootPathname>

Parameters

Parameter Description

create

Creates a secondary Transactional Resource Manager.

<RmRootPathname>

Specifies the full path to a Transactional Resource Manager root directory.

info

Displays the specified Transactional Resource Manager’s information.

setautoreset

Specifies whether a default Transactional Resource Manager will clean the transactional metadata on the next mount.

  • Set the setautoreset parameter to true to specify that the Transaction Resource Manager will clean the transactional metadata on the next mount, by default.

  • Set the setautoreset parameter to false to specify that the Transaction Resource Manager will not clean the transactional metadata on the next mount, by default.

<DefaultRmRootPathname>

Specifies the drive name followed by a colon.

setavailable

Specifies that a Transactional Resource Manager will prefer availability over consistency.

setconsistent

Specifies that a Transactional Resource Manager will prefer consistency over availability.

setlog

Changes the characteristics of a Transactional Resource Manager that is already running.

growth

Specifies the amount by which the Transactional Resource Manager log can grow.

The growth parameter can be specified as follows:

  • Number of containers using the format: Containers containers

  • Percentage using the format: Percent percent

<containers>

Specifies the data objects that are used by the Transactional Resource Manager.

maxextent

Specifies the maximum number of containers for the specified Transactional Resource Manager.

minextent

Specifies the minimum number of containers for the specified Transactional Resource Manager.

mode {full|undo}

Specifies whether all transactions are logged ( full) or only rolled back events are logged (undo).

rename

Changes the GUID for the Transactional Resource Manager.

shrink

Specifies percentage by which the Transactional Resource Manager log can automatically decrease.

size

Specifies the size of the Transactional Resource Manager as a specified number of Containers.

start

Starts the specified Transactional Resource Manager.

stop

Stops the specified Transactional Resource Manager.

Examples

To set the log for the Transactional Resource Manager that is specified by c:\test, to have an automatic growth of five containers, type:

Copy Code
fsutil resource setlog growth 5 containers c:test

To set the log for the Transactional Resource Manager that is specified by c:\test, to have an automatic growth of two percent, type:

Copy Code
fsutil resource setlog growth 2 percent c:test

To specify that the default Transactional Resource Manager will clean the transactional metadata on the next mount on drive C, type:

Copy Code
fsutil resource setautoreset true c:\

Additional references

Command-Line Syntax Key

Fsutil

Transactional NTFS


Fsutil sparse

Applies To: Windows Server 2003 R2,Windows 7,Windows Server 2003,Windows Vista,Windows Server 2000,Windows Server 2008,Windows Server 2008 R2

Manages sparse files.

For examples of how to use this command, see Examples.

Syntax

Copy Code
fsutil sparse [queryflag] <FileName>
fsutil sparse [queryrange] <FileName>
fsutil sparse [setflag] <FileName>
fsutil sparse [setrange] <FileName> <BeginningOffset> <Length>

Parameters

Parameter | Description
queryflag | Queries sparse.
queryrange | Scans a file and searches for ranges that may contain nonzero data.
setflag | Marks the indicated file as sparse.
setrange | Fills a specified range of a file with zeros.
<FileName> | Specifies the full path to the file including the file name and extension, for example C:\documents\filename.txt.
<BeginningOffset> | Specifies the offset within the file to mark as sparse.
<Length> | Specifies the length of the region in the file to be marked as sparse (in bytes).

Remarks

  • A sparse file is a file with one or more regions of unallocated data in it. A program will see these unallocated regions as containing bytes with the value zero, but no disk space is used to represent these zeros. All meaningful or nonzero data is allocated, whereas all nonmeaningful data (large strings of data that is composed of zeros) is not allocated. When a sparse file is read, allocated data is returned as stored, and unallocated data is returned, by default, as zeros, in accordance with the C2 security requirement specification. Sparse file support allows data to be deallocated from anywhere in the file.

  • In a sparse file, large ranges of zeroes may not require disk allocation. Space for nonzero data will be allocated as needed when the file is written.

  • Only compressed or sparse files can have zeroed ranges known to the operating system.

  • If the file is sparse or compressed, NTFS may deallocate disk space within the file. This sets the range of bytes to zeroes without extending the file size.

Examples

To mark a file named Sample.txt in the C:\Temp directory as sparse, type:

Copy Code
fsutil sparse setflag c:\temp\sample.txt

Additional references

Command-Line Syntax Key

Fsutil


Fsutil transaction

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Manages NTFS transactions.

For examples of how to use this command, see Examples .

Syntax

Copy Code
fsutil transaction [commit] <GUID>
fsutil transaction [fileinfo] <Filename>
fsutil transaction [list]
fsutil transaction [query] [{Files|All}] <GUID>
fsutil transaction [rollback] <GUID>

Parameters

Parameter Description

commit

Marks the end of a successful implicit or explicit specified transaction.

<GUID>

Specifies the GUID value that represents a transaction.

fileinfo

Displays transaction information for the specified file.

<Filename>

Specifies full path and file name.

list

Displays a list of currently running transactions.

query

Displays information for the specified transaction.

  • If fsutil transaction query Files is specified, the file information will be displayed only for the specified transaction.

  • If fsutil transaction query All is specified, all information for the transaction will be displayed.

rollback

Rolls back a specified transaction to the beginning.

Remarks

  • Transactional NTFS was introduced in Windows Server 2008.

Examples

To display transaction information for file c:\test.txt, type:

Copy Code
fsutil transaction fileinfo c:\test.txt

Additional references

Command-Line Syntax Key

Fsutil

Transactional NTFS


Fsutil usn

Applies To: Windows Server 2003 R2,Windows 7,Windows Server 2003,Windows Vista,Windows Server 2000,Windows Server 2008,Windows Server 2008 R2

Manages the update sequence number (USN) change journal.

Syntax

Copy Code
fsutil usn [createjournal] m=<MaxSize> a=<AllocationDelta> <VolumePath>
fsutil usn [deletejournal] {/D | /N} <VolumePath>
fsutil usn [enumdata] <FileRef> <LowUSN> <HighUSN> <VolumePath>
fsutil usn [queryjournal] <VolumePath>
fsutil usn [readdata] <FileName>

Parameters

Parameter Description

createjournal

Creates a USN change journal.

m=<MaxSize>

Specifies the maximum size, in bytes, that NTFS allocates for the change journal.

a=<AllocationDelta>

Specifies the size, in bytes, of memory allocation that is added to the end and removed from the beginning of the change journal.

<VolumePath>

Specifies the drive letter (followed by a colon).

deletejournal

Deletes or disables an active USN change journal.

Caution
Deleting the change journal impacts the File Replication service (FRS) and the Indexing Service, because it would require these services to perform a complete (and time-consuming) scan of the volume. This in turn negatively impacts FRS SYSVOL replication and replication between DFS link alternates while the volume is being rescanned.

/d

Disables an active USN change journal, and returns input/output (I/O) control while the change journal is being disabled.

/n

Disables an active USN change journal and returns I/O control only after the change journal is disabled.

enumdata

Enumerates and lists the change journal entries between two specified boundaries.

<FileRef>

Specifies the ordinal position within the files on the volume at which the enumeration is to begin.

<LowUSN>

Specifies the lower boundary of the range of USN values used to filter the records that are returned. Only records whose last change journal USN is between or equal to the LowUSN and HighUSN member values are returned.

<HighUSN>

Specifies the upper boundary of the range of USN values used to filter the files that are returned.

queryjournal

Queries a volume's USN data to gather information about the current change journal, its records, and its capacity.

readdata

Reads the USN data for a file.

<FileName>

Specifies the full path to the file, including the file name and extension For example: C:\documents\filename.txt

Remarks

  • About the USN change journal

    The USN change journal provides a persistent log of all changes made to files on the volume. As files, directories, and other NTFS objects are added, deleted, and modified, NTFS enters records into the USN change journal, one for each volume on the computer. Each record indicates the type of change and the object changed. New records are appended to the end of the stream.

    Programs can consult the USN change journal to determine all the modifications made to a set of files. The USN change journal is much more efficient than checking time stamps or registering for file notifications. The USN change journal is enabled and used by the Indexing Service, File Replication service (FRS), Remote Installation Services (RIS), and Remote Storage.

  • Using createjournal

    If a change journal already exists on a volume, the createjournal parameter updates the change journal's MaxSize and AllocationDelta parameters. This enables you to expand the number of records that an active journal maintains without having to disable it. If you specify 0 (zero) for MaxSize and AllocationDelta, the system chooses a default value based on the volume size.

  • Using m

    The change journal can grow larger than this target value, but the change journal is truncated at the next NTFS checkpoint to less than this value. NTFS examines the change journal and trims it when its size exceeds the value of MaxSize plus the value of AllocationDelta. At NTFS checkpoints, the operating system writes records to the NTFS log file that enable NTFS to determine what processing is required to recover from a failure.

  • Using a

    The change journal can grow to more than the sum of the values of MaxSize and AllocationDelta before being trimmed.

  • Using deletejournal

    Deleting or disabling an active change journal is very time consuming, because the system must access all the records in the master file table (MFT) and set the last USN attribute to 0 (zero). This process can take several minutes, and it can continue after the system restarts, if a restart is necessary. During this process, the change journal is not considered active, nor is it disabled. While the system is disabling the journal, it cannot be accessed, and all journal operations return errors. You should use extreme care when disabling an active journal, because it adversely affects other applications that are using the journal.

Examples

To create a USN change journal on drive C, type:

Copy Code
fsutil usn createjournal m=1000 a=100 c:

To delete an active USN change journal on drive C, type:

Copy Code
fsutil usn deletejournal /d c:

To enumerate and list the change journal entries between two specified boundaries on drive C, type:

Copy Code
fsutil usn enumdata 1 0 1 c:

To query USN data for a volume on drive C, type:

Copy Code
fsutil usn queryjournal c:

To read the USN data for a file in the \Temp folder on drive C, type:

Copy Code
fsutil usn readdata c:\temp\sample.txt

Additional references

Command-Line Syntax Key

Fsutil


Fsutil volume

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Server 2000,Windows Vista,Windows Server 2003,Windows 7,Windows Server 2003 R2

Dismounts a volume, or queries the hard disk drive to determine how much free space is currently available on the hard disk drive or which file is using a particular cluster.

For examples of how to use this command, see Examples.

Syntax

Copy Code
fsutil volume [diskfree] <VolumePath>
fsutil volume [dismount] <VolumePath>
fsutil volume [querycluster] <VolumePath> <Cluster> [<Cluster>] … …

Parameters

Parameter | Description
diskfree | Queries the hard disk drive to determine the amount of free space on it.
dismount | Dismounts a volume.
<VolumePath> | Specifies the drive letter (followed by a colon).
querycluster | Finds which file is using a specified cluster. You can specify multiple clusters with the querycluster parameter. This parameter applies to: Windows Server® 2008 R2 and Windows® 7.
<cluster> | Specifies the logical cluster number (LCN).

Examples

To dismount a volume on drive C, type:

Copy Code
fsutil volume dismount c:

To query the amount of free space of a volume on drive C, type:

Copy Code
fsutil volume diskfree c:

To find the file(s) that are using the clusters, specified by the logical cluster numbers 50 and 0x2000, on drive C, type:

Copy Code
fsutil volume querycluster C: 50 0x2000

Additional references

Command-Line Syntax Key

Fsutil

How NTFS Works


Ftp

Applies To: Windows 7,Windows Vista,Windows Server 2008,Windows Server 2008 R2

Transfers files to and from a computer running a File Transfer Protocol (FTP) server service. Ftp can be used interactively or in batch mode by processing ASCII text files. For examples of how this command can be used, see Examples.

Syntax

Copy Code
ftp [-v] [-d] [-i] [-n] [-g] [-s:<FileName>] [-a] [-A] [-x:<SendBuffer>] [-r:<RecvBuffer>] [-b:<AsyncBuffers>][-w:<WindowsSize>]  [-?] [<Host>]

Parameters

Parameter | Description
-v | Suppresses display of remote server responses.
-n | Suppresses auto-login upon initial connection.
-g | Disables file name globbing. Glob permits the use of the asterisk (*) and question mark (?) as wildcard characters in local file and path names. For more information, see Additional references.
-s:<FileName> | Specifies a text file that contains ftp commands. These commands run automatically after ftp starts. This parameter allows no spaces. Use this parameter instead of redirection (<).
-a | Specifies that any local interface can be used when binding the FTP data connection.
-A | Logs onto the FTP server as anonymous.
-x:<SendBuffer> | Overrides the default SO_SNDBUF size of 8192.
-r:<RecvBuffer> | Overrides the default SO_RCVBUF size of 8192.
-b:<AsyncBuffers> | Overrides the default async buffer count of 3.
-w:<WindowsSize> | Specifies the size of the transfer buffer. The default window size is 4096 bytes.
-? | Displays help at the command prompt.
<host> | Specifies the computer name, IP address, or IPv6 address of the FTP server to which to connect. The host name or address, if specified, must be the last parameter on the line.

Remarks

  • For more information about ftp commands on Windows Server 2003, see Ftp.

  • Ftp command-line parameters are case-sensitive.

  • This command is available only if the Internet Protocol (TCP/IP) protocol is installed as a component in the properties of a network adapter in Network Connections.

  • Ftp can be used interactively. After it is started, ftp creates a sub-environment in which you can use ftp commands. You can return to the command prompt by typing the quit command. When the ftp sub-environment is running, it is indicated by the ftp > command prompt. For more information see the ftp commands.

  • Ftp supports the use of IPv6 when the IPv6 protocol is installed. For more information, see Additional references.

Examples

To log on to the FTP server named ftp.example.microsoft.com, type:

Copy Code
ftp ftp.example.microsoft.com

To log on to the FTP server named ftp.example.microsoft.com and run the ftp commands contained in a file named resync.txt, type:

Copy Code
ftp -s:resync.txt ftp.example.microsoft.com

Additional references

  • IP version 6

  • IPv6 applications

  • Command-Line Syntax Key


Ftp: ?

Applies To: Windows 7,Windows Vista,Windows Server 2008,Windows Server 2008 R2

Displays the valid ftp commands that are available from the ftp prompt. For examples of how this command can be used, see Examples.

Syntax

Copy Code
? [!] [?] [append] [ascii] [bell [binary] [bye] [cd] [close] [delete] [debug] [dir] [disconnect] [get] [glob] [hash] [help] [lcd] [literal] [ls] [mdelete] [mdir] [mget] [mkdir] [mls] [mput] [open] [prompt] [put] [pwd] [quit] [quote] [recv] [remotehelp] [rename] [rmdir] [send] [status] [trace] [type] [user] [verbose]

Parameters

Parameter | Description
[<valid ftp subcommand>] | Displays the description for a valid ftp command.

Examples

Display the valid ftp commands that are available from the ftp prompt.

Copy Code
?

Display the description for the hash command.

Copy Code
? hash

Display the description for the hash and trace commands.

Copy Code
? hash trace

Additional references

  • Command-Line Syntax Key


Ftp: !

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Exits the ftp subsystem to a command prompt temporarily so that the operating system commands can be run. To return to the ftp subsystem, type exit at the command prompt. For examples of how this command can be used, see Examples.

Syntax

Copy Code
!

Parameters

none

Remarks

Use ! to run operating system commands without quitting ftp.

Examples

Open an operating system command prompt without exiting ftp.

Copy Code
!

Return to the ftp command prompt.

Copy Code
exit

Additional references

  • Command-Line Syntax Key


Ftp: append

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Appends a local file to a file on the remote computer using the current file type setting. For examples of how this command can be used, see Examples.

Syntax

Copy Code
Append <LocalFile> [RemoteFile]

Parameters

Parameter | Description
<LocalFile> | Specifies the local file to add.
[RemoteFile] | Specifies the file on the remote computer to which <LocalFile> is added.

Remarks

If RemoteFile is omitted, the LocalFile name is used in place of the remote file name.

Examples

Append file1.txt to file2.txt on the remote computer.

Copy Code
append file1.txt file2.txt

Append the local file1.txt to a file named file1.txt on the remote computer.

Copy Code
Append file1.txt

Additional references

  • Command-Line Syntax Key


Ftp: ascii

Applies To: Windows 7,Windows Vista,Windows Server 2008,Windows Server 2008 R2

Sets the file transfer type to ASCII. For examples of how this command can be used, see Examples.

Syntax

Copy Code
ascii

Parameters

none

Remarks

  • The default file transfer type is ASCII.

  • In ASCII mode, character conversions to and from the network standard character set are performed. For example, end-of-line characters are converted as necessary, based on the target operating system.

  • Ftp supports both ASCII and binary image file transfer types. Use ASCII when transferring text files. For more information about binary file transfer, see Ftp: binary in Additional references.

Examples

Set the file transfer type to ASCII.

Copy Code
ascii

Additional references

  • Ftp: binary

  • Command-Line Syntax Key


Ftp: bell

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Toggles an audible sound to occur after each file transfer command is completed. For examples of how this command can be used, see Examples.

Syntax

Copy Code
bell

Parameters

none

Remarks

By default, bell is off.

Examples

Toggle an audible sound to occur after each file transfer command is completed.

Copy Code
bell

Additional references

  • Command-Line Syntax Key


Ftp: bye

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Ends the FTP session with the remote computer and exits. For examples of how this command can be used, see Examples.

Syntax

Copy Code
bye

Parameters

none

Remarks

Bye and quit both end the FTP session with the remote computer and exits.

Examples

End the FTP session with the remote computer and exit.

Copy Code
bye

Additional references

  • Ftp: quit

  • Command-Line Syntax Key


Ftp: binary

Applies To: Windows 7,Windows Vista,Windows Server 2008,Windows Server 2008 R2

Sets the file transfer type to binary. For examples of how this command can be used, see Examples.

Syntax

Copy Code
binary

Parameters

none

Remarks <optional section>

Ftp supports both ASCII and binary image file transfer types. Use binary when transferring executable files. In binary mode, files are transferred in one-byte units. For more information about ASCII file transfer, see Ftp: ascii in Additional references.

Examples

Set the file transfer type to binary.

Copy Code
binary

Additional references

  • Ftp: ascii

  • Command-Line Syntax Key


Ftp: cd

Applies To: Windows 7,Windows Vista,Windows Server 2008,Windows Server 2008 R2

Changes the working directory on the remote computer. For examples of how this command can be used, see Examples.

Syntax

Copy Code
cd <RemoteDirectory>

Parameters

Parameter | Description
<RemoteDirectory> | Specifies the directory on the remote computer to which you want to change.

Examples

Change the directory on the remote computer to Docs.

Copy Code
cd Docs

Change the directory on the remote computer to May Videos.

Copy Code
cd “May Videos”

Additional references

  • Command-Line Syntax Key


Ftp: close

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Ends the FTP session with the remote server and remains at the ftp> prompt. For examples of how this command can be used, see Examples.

Syntax

Copy Code
close

Parameters

none

Examples

End the FTP session with the remote server and remain at the ftp> prompt.

Copy Code
close

Additional references

  • Command-Line Syntax Key


Ftp:debug

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Toggles Debugging Mode. For examples of how this command can be used, see Examples.

Syntax

Copy Code
debug

Parameters

none

Remarks

  • By default, debugging is off.

  • When debugging is on, each command that is sent to the remote computer is displayed, preceded by the greater than (>) character.

Examples

Toggle debug mode on and off.

Copy Code
debug

Additional references

  • Command-Line Syntax Key


Ftp: delete

Applies To: Windows 7,Windows Vista,Windows Server 2008,Windows Server 2008 R2

Deletes files on remote computers. For examples of how this command can be used, see Examples.

Syntax

Copy Code
delete <RemoteFile>

Parameters

Parameter | Description
<RemoteFile> | Specifies the file to delete.

Examples

Delete the file test.txt on the remote computer.

Copy Code
delete test.txt

Additional references

  • Command-Line Syntax Key


Ftp: dir

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Displays a list of directory files and subdirectories on a remote computer. For examples of how this command can be used, see Examples.

Syntax

Copy Code
dir [<RemoteDirectory>] [<LocalFile>]

Parameters

Parameter | Description
[<RemoteDirectory>] | Specifies the directory for which you want to see a listing. If no directory is specified, the current working directory on the remote computer is used.
[<LocalFile>] | Specifies a local file in which to store the directory listing. If a local file is not specified, results are displayed on the screen.

Examples

Display a directory listing for Dir1 on the remote computer.

Copy Code
dir Dir1

Save a list of the current directory on the remote computer in the local file DirList.txt.

Copy Code
dir . DirList.txt

Additional references

  • Command-Line Syntax Key


Ftp: disconnect

Applies To: Windows 7,Windows Vista,Windows Server 2008,Windows Server 2008 R2

Disconnects from the remote computer and retains the ftp> prompt. For examples of how this command can be used, see Examples.

Syntax

Copy Code
disconnect

Parameters

none

Examples

Disconnect from the remote computer and retain the ftp> prompt.

Copy Code
disconnect

Additional references

  • Command-Line Syntax Key


Ftp: get

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Copies a remote file to the local computer using the current file transfer type. For examples of how this command can be used, see Examples.

Syntax

Copy Code
get <RemoteFile> [<LocalFile>]

Parameters

Parameter | Description
<RemoteFile> | Specifies the remote file to copy.
[<LocalFile>] | Specifies the name of the file to use on the local computer. If LocalFile is not specified, the file is given the RemoteFile name.

Remarks

The get command is identical to the recv command.

Examples

Copy test.txt to the local computer using the current file transfer type.

Copy Code
get test.txt

Copy test.txt to the local computer as test1.txt using the current file transfer type.

Copy Code
Get test.txt test1.txt

Additional references

  • Ftp: ascii

  • Ftp: binary

  • Command-Line Syntax Key


Ftp: glob

Applies To: Windows 7,Windows Vista,Windows Server 2008,Windows Server 2008 R2

Toggles wildcard expansion of local file names. For examples of how this command can be used, see Examples.

Syntax

Copy Code
glob

Parameters

none

Remarks

  • By default, globbing is on.

  • Globbing permits the use of the asterisk (*) and question mark (?) as wildcard characters in local file or path names.

Examples

Toggle wildcard expansion of local file names.

Copy Code
glob

Additional references

  • Command-Line Syntax Key


Ftp: hash

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Toggles number sign (#) printing for each data block that is transferred. For examples of how this command can be used, see Examples.

Syntax

Copy Code
hash

Parameters

none

Remarks

  • The size of a data block is 2048 bytes.

  • By default, hash is off.

Examples

Toggle number sign (#) printing for each data block that is transferred.

Copy Code
hash

Additional references

  • Command-Line Syntax Key


Ftp: lcd

Applies To: Windows 7,Windows Vista,Windows Server 2008,Windows Server 2008 R2

Changes the working directory on the local computer. By default, the working directory is the directory in which ftp was started. For examples of how this command can be used, see Examples.

Syntax

Copy Code
lcd [<Directory>]

Parameters

Parameter | Description
[<Directory>] | Specifies the directory on the local computer to which to change. If Directory is not specified, the current working directory is changed to the default directory.

Examples

Change the working directory on the local computer to C:\Dir1

Copy Code
lcd C:\Dir1

Additional references

  • Command-Line Syntax Key


Ftp: literal

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Sends verbatim arguments to the remote FTP server. A single FTP reply code is returned. For examples of how this command can be used, see Examples.

Syntax

Copy Code
literal <Argument> […]

Parameters

Parameter | Description
<Argument> | Specifies the argument to send to the FTP server.

Remarks

The literal command is identical to the quote command.

Examples

Send a quit command to the remote FTP server.

Copy Code
literal quit

Additional references

  • Ftp: quote

  • Command-Line Syntax Key


Ftp: ls

Applies To: Windows 7,Windows Vista,Windows Server 2008,Windows Server 2008 R2

Displays an abbreviated list of files and subdirectories from the remote computer. For examples of how this command can be used, see Examples.

Syntax

Copy Code
ls [<RemoteDirectory>] [<LocalFile>]

Parameters

Parameter | Description
[<RemoteDirectory>] | Specifies the directory for which you want to see a listing. If no directory is specified, the current working directory on the remote computer is used.
[<LocalFile>] | Specifies a local file in which to store the listing. If a local file is not specified, results are displayed on the screen.

Examples

Display an abbreviated list of files and subdirectories from the remote computer.

Copy Code
ls

Get an abbreviated directory listing of Dir1 on the remote computer and save it in a local file called DirList.txt

Copy Code
ls Dir1 DirList.txt

Additional references

  • Command-Line Syntax Key


Ftp: mdelete

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Deletes files on the remote computer. For examples of how this command can be used, see Examples.

Syntax

Copy Code
mdelete <RemoteFile>[…]

Parameters

Parameter | Description
<RemoteFile> | Specifies the remote file to delete.

Examples

Delete remote files a.exe and b.exe.

Copy Code
mdelete a.exe b.exe

Additional references

  • Command-Line Syntax Key


Ftp: mdir

Applies To: Windows 7,Windows Vista,Windows Server 2008,Windows Server 2008 R2

Displays a directory list of files and subdirectories in a remote directory. For examples of how this command can be used, see Examples.

Syntax

Copy Code
mdir <RemoteFile>[…] <LocalFile>

Parameters

Parameter | Description
<RemoteFile> | Specifies the directory or file for which you want to see a listing.
<LocalFile> | Specifies a local file to store the listing. This parameter is required.

Remarks

  • You can use mdir to specify multiple files.

  • Specifying RemoteFile

    Type a hyphen (-) to use the current working directory on the remote computer.

  • Specifying a LocalFile

    Type a hyphen (-) to display the listing on the screen.

Examples

Display a directory listing of Dir1 and Dir2 on the screen

Copy Code
mdir Dir1 Dir2 -

Save the combined directory listing of Dir1 and Dir2 in a local file called dirlist.txt

Copy Code
mdir Dir1 Dir2 dirlist.txt

Additional references

  • Command-Line Syntax Key


Ftp: mget

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Copies remote files to the local computer using the current file transfer type. For examples of how this command can be used, see Examples.

Syntax

Copy Code
mget <RemoteFile>[…]

Parameters

Parameter | Description
<RemoteFile> | Specifies the remote files to copy to the local computer.

Examples

Copy remote files a.exe and b.exe to the local computer using the current file transfer type.

Copy Code
mget a.exe b.exe

Additional references

  • Ftp: ascii

  • Ftp: binary

  • Command-Line Syntax Key


Ftp: mkdir

Applies To: Windows 7,Windows Vista,Windows Server 2008,Windows Server 2008 R2

Creates a directory on the remote computer. For examples of how this command can be used, see Examples.

Syntax

Copy Code
mkdir <Directory>

Parameters

Parameter | Description
<Directory> | Specifies the name of the new remote directory.

Examples

Create a directory called Dir1 on the remote computer.

Copy Code
mkdir Dir1

Additional references

  • Command-Line Syntax Key


Ftp: mls

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Displays an abbreviated list of files and subdirectories in a remote directory. For examples of how this command can be used, see Examples.

Syntax

Copy Code
mls <RemoteFile>[…] <LocalFile>

Parameters

Parameter | Description
<RemoteFile> | Specifies the file for which you want to see a listing.
<LocalFile> | Specifies a local file in which to store the listing.

Remarks

  • Specifying RemoteFiles

    Type a hyphen (-) to use the current working directory on the remote computer.

  • Specifying LocalFile

    Type a hyphen (-) to display the listing on the screen.

Examples

Display an abbreviated list of files and subdirectories for Dir1 and Dir2.

Copy Code
mls Dir1 Dir2 -

Save an abbreviated list of files and subdirectories for Dir1 and Dir2 in the local file Dirlist.txt

Copy Code
mls Dir1 Dir2 Dirlist.txt

Additional references

  • Command-Line Syntax Key


Ftp: mput

Applies To: Windows 7,Windows Vista,Windows Server 2008,Windows Server 2008 R2

Copies local files to the remote computer using the current file transfer type. For examples of how this command can be used, see Examples.

Syntax

Copy Code
mput <LocalFile>[…]

Parameters

Parameter | Description
<LocalFile> | Specifies the local file to copy to the remote computer.

Examples

Copy Program1.exe and Program2.exe to the remote computer using the current file transfer type.

Copy Code
mput Program1.exe Program2.exe

Additional references

  • Ftp: ascii

  • Ftp: binary

  • Command-Line Syntax Key


Ftp: open

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Connects to the specified FTP server. For examples of how this command can be used, see Examples.

Syntax

Copy Code
open <Computer> [<Port>]

Parameters

Parameter | Description
<Computer> | Specifies the remote computer to which you are trying to connect.
[<Port>] | Specifies a TCP port number to use to connect to an FTP server. By default, TCP port 21 is used.

Remarks

You can use an IP address or computer name (in which case a DNS server or Hosts file must be available) to specify Computer.

Examples

Connect to the FTP server at ftp.microsoft.com.

Copy Code
Open ftp.microsoft.com

Connect to the FTP server at ftp.microsoft.com that is listening on TCP port 755.

Copy Code
open ftp.microsoft.com 755

Additional references

  • Command-Line Syntax Key


Ftp: prompt

Applies To: Windows 7,Windows Vista,Windows Server 2008,Windows Server 2008 R2

Toggles between prompt mode on and off. For examples of how this command can be used, see Examples.

Syntax

Copy Code
prompt

Parameters

none

Remarks

  • By default, prompt is on.

  • FTP prompts during multiple file transfers to allow you to selectively retrieve or store files. Mget and mput transfer all files if prompt is off.

Examples

Toggle prompt mode on and off.

Copy Code
prompt

Additional references

  • Command-Line Syntax Key


Ftp: put

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Copies a local file to the remote computer using the current file transfer type. For examples of how this command can be used, see Examples.

Syntax

Copy Code
put <LocalFile> [<RemoteFile>]

Parameters

Parameter | Description
<LocalFile> | Specifies the local file to copy.
[<RemoteFile>] | Specifies the name to use on the remote computer.

Remarks

  • The put command is identical to the send command.

  • If RemoteFile is not specified, the file is given the LocalFile name.

Examples

Copy the local file test.txt and name it test1.txt on the remote computer.

Copy Code
put test.txt test1.txt

Copy the local file program.exe to the remote computer.

Copy Code
put program.exe

Additional references

  • Ftp: ascii

  • Ftp: binary

  • Command-Line Syntax Key


Ftp: pwd

Applies To: Windows 7,Windows Vista,Windows Server 2008,Windows Server 2008 R2

Displays the current remote computer directory. For examples of how this command can be used, see Examples.

Syntax

Copy Code
pwd

Parameters

none

Examples

Display the current remote computer directory.

Copy Code
pwd

Additional references

  • Command-Line Syntax Key


Ftp: quit

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Ends the FTP session with the remote computer and exits ftp to the operating system command prompt. For examples of how this command can be used, see Examples.

Syntax

Copy Code
quit

Parameters

none

Examples

End the FTP session with the remote computer and exit ftp to the operating system command prompt.

Copy Code
quit

Additional references

  • Command-Line Syntax Key


Ftp: quote

Applies To: Windows 7,Windows Vista,Windows Server 2008,Windows Server 2008 R2

Sends verbatim arguments to the remote FTP server. A single FTP reply code is returned. For examples of how this command can be used, see Examples.

Syntax

Copy Code
quote <Argument>[…]

Parameters

Parameter | Description
<Argument> | Specifies the argument to send to the FTP server.

Remarks

The quote command is identical to the literal command.

Examples

Send a quit command to the remote FTP server.

Copy Code
quote quit

Additional references

  • Ftp: literal

  • Command-Line Syntax Key


Ftp: recv

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Copies a remote file to the local computer using the current file transfer type. For examples of how this command can be used, see Examples.

Syntax

Copy Code
recv <RemoteFile> [<LocalFile>]

Parameters

Parameter | Description
<RemoteFile> | Specifies the remote file to copy.
[<LocalFile>] | Specifies the name to use on the local computer.

Remarks

  • The recv command is identical to the get command.

  • If LocalFile is not specified, the file is given the RemoteFile name.

Examples

Copy test.txt to the local computer using the current file transfer type.

Copy Code
recv test.txt

Copy test.txt to the local computer as test1.txt using the current file transfer type.

Copy Code
recv test.txt test1.txt

Additional references

  • Ftp: ascii

  • Ftp: binary

  • Ftp: get

  • Command-Line Syntax Key


Ftp: remotehelp

Applies To: Windows 7,Windows Vista,Windows Server 2008,Windows Server 2008 R2

Displays help for remote commands. For examples of how this command can be used, see Examples.

Syntax

Copy Code
remotehelp [<Command>]

Parameters

Parameter | Description
[<Command>] | Specifies the name of the command about which you want help. If Command is not specified, ftp displays a list of all remote commands.

Remarks

You can run remote commands using quote or literal.

Examples

Display a list of remote commands.

Copy Code
remotehelp

Display the syntax for the feat remote command.

Copy Code
remotehelp feat

Additional references

  • Ftp: quote

  • Command-Line Syntax Key


Ftp: rename

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Renames remote files. For examples of how this command can be used, see Examples.

Syntax

Copy Code
rename <FileName> <NewFileName>

Parameters

Parameter | Description
<FileName> | Specifies the file that you want to rename.
<NewFileName> | Specifies the new file name.

Examples

Rename the remote file example.txt to example1.txt

Copy Code
Rename example.txt example1.txt

Additional references

  • Command-Line Syntax Key


Ftp: rmdir

Applies To: Windows 7,Windows Vista,Windows Server 2008,Windows Server 2008 R2

Deletes a remote directory. For examples of how this command can be used, see Examples.

Syntax

Copy Code
rmdir <Directory>

Parameters

Parameter | Description
<Directory> | Specifies the name of the remote directory to delete.

Examples

Delete the Pictures remote directory.

Copy Code
rmdir Pictures

Additional references

  • Command-Line Syntax Key


Ftp: send

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Copies a local file to the remote computer using the current file transfer type. For examples of how this command can be used, see Examples.

Syntax

Copy Code
send <LocalFile> [<RemoteFile>]

Parameters

Parameter | Description
<LocalFile> | Specifies the local file to copy.
<RemoteFile> | Specifies the name to use on the remote computer.

Remarks

  • The send command is identical to the put command.

  • If RemoteFile is not specified, the file is given the LocalFile name.

Examples

Copy the local file test.txt and name it test1.txt on the remote computer.

Copy Code
send test.txt test1.txt

Copy the local file program.exe to the remote computer.

Copy Code
send program.exe

Additional references

  • Command-Line Syntax Key


Ftp: status

Applies To: Windows 7,Windows Vista,Windows Server 2008,Windows Server 2008 R2

Displays the current status of FTP connections. For examples of how this command can be used, see Examples.

Syntax

Copy Code
status

Parameters

none

Examples

Display the current status of FTP connections.

Copy Code
status

Additional references

  • Command-Line Syntax Key


Ftp: trace

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Toggles packet tracing.

Syntax

Copy Code
trace

Parameters

none

Remarks

Trace displays the series of internal FTP function calls when running an ftp command.

Examples

Toggle tracing on and off.

Copy Code
trace

Additional references

  • Command-Line Syntax Key


Ftp: type

Applies To: Windows 7,Windows Vista,Windows Server 2008,Windows Server 2008 R2

Sets or displays the file transfer type. For examples of how this command can be used, see Examples.

Syntax

Copy Code
type [<TypeName>]

Parameters

Parameter | Description
[<TypeName>] | Specifies the file transfer type.

Remarks

  • If TypeName is not specified, the current type is displayed.

  • Ftp supports two file transfer types, ASCII and binary.

    The default file transfer type is ASCII. The ascii command should be used when transferring text files. In ASCII mode, character conversions to and from the network standard character set are performed. For example, end-of-line characters are converted as required, based on the operating system at the destination.

    The binary command should be used when transferring executable files. In binary mode, the file is moved in one-byte units.

Examples

Set the file transfer type to ASCII.

Copy Code
type ascii

Set the transfer file type to binary.

Copy Code
type binary

Additional references

  • Command-Line Syntax Key


Ftp: user

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Specifies a user to the remote computer. For examples of how this command can be used, see Examples.

Syntax

Copy Code
user <UserName> [<Password>] [<Account>]

Parameters

Parameter | Description
<UserName> | Specifies a user name with which to log on to the remote computer.
[<Password>] | Specifies the password for UserName. If a password is not specified but is required, ftp prompts for the password.
[<Account>] | Specifies an account with which to log on to the remote computer. If an Account is not specified but is required, ftp prompts for the account.

Examples

Specify User1 with the password Password1.

Copy Code
user User1 Password1

Additional references

  • Command-Line Syntax Key


Ftp: verbose

Applies To: Windows 7,Windows Vista,Windows Server 2008,Windows Server 2008 R2

Toggles verbose mode. For examples of how this command can be used, see Examples.

Syntax

Copy Code
verbose

Parameters

none

Remarks

By default, verbose is on. When verbose is on, all ftp responses are displayed. When a file transfer is completed, statistics regarding the efficiency of the transfer are also displayed.

Examples

Toggle verbose mode on and off.

Copy Code
verbose

Additional references

  • Command-Line Syntax Key


Ftype

Applies To: Windows Vista,Windows Server 2008

Displays or modifies file types that are used in file name extension associations. If used without an assignment operator (=), ftype displays the current open command string for the specified file type. If used without parameters, ftype displays the file types that have open command strings defined.

For examples of how to use this command, see Examples.

Syntax

Copy Code
ftype [<FileType>[=[<OpenCommandString>]]]

Parameters

Parameter | Description
<FileType> | Specifies the file type to display or change.
<OpenCommandString> | Specifies the open command string to use when opening files of the specified file type.
/? | Displays help at the command prompt.

Remarks

The following table describes how ftype substitutes variables within an open command string:

Variable | Replacement value
%0 or %1 | Gets substituted with the file name being launched through the association.
%* | Gets all of the parameters.
%2, %3, ... | Gets the first parameter (%2), the second parameter (%3), and so on.
%~<N> | Gets all of the remaining parameters starting with the Nth parameter, where N can be any number from 2 to 9.

Examples

To display the current file types that have open command strings defined, type:

Copy Code
ftype

To display the current open command string for the txtfile file type, type:

Copy Code
ftype txtfile

This command produces output similar to the following:

Copy Code
txtfile=%SystemRoot%\system32\NOTEPAD.EXE %1

To delete the open command string for a file type called Example, type:

Copy Code
ftype example=

To associate the .pl file name extension with the PerlScript file type and enable the PerlScript file type to run PERL.EXE, type the following commands:

Copy Code
assoc .pl=PerlScript
ftype PerlScript=perl.exe %1 %*

To eliminate the need to type the .pl file name extension when invoking a Perl script, type:

Copy Code
set PATHEXT=.pl;%PATHEXT%

Additional references

Command-Line Syntax Key


Finger
See Also

Applies To: Windows Server 2008 R2,Windows Server 2008

Finger

Displays information about a user or users on a specified remote computer (typically a computer running UNIX) that is running the Finger service or daemon. The remote computer specifies the format and output of the user information display. Used without parameters, finger displays help.
Syntax

finger [-l] [User] [@Host] [...]

Parameters
-l

Displays user information in long list format.

User

Specifies the user about which you want information. If you omit the User parameter, finger displays information about all users on the specified computer.

@ Host

Specifies the remote computer running the Finger service where you are looking for user information. You can specify a computer name or IP address.

/?

Displays help at the command prompt.

Remarks
  • Multiple User@Host parameters can be specified.

  • You must prefix finger parameters with a hyphen (-) rather than a slash (/).

  • This command is available only if the Internet Protocol (TCP/IP) protocol is installed as a component in the properties of a network adapter in Network Connections.

  • The Windows Server 2003 family does not provide a finger service.

Examples

To display information for user1 on the computer users.microsoft.com, type:

finger user1@users.microsoft.com

To display information for all users on the computer users.microsoft.com, type:

finger @users.microsoft.com

Formatting legend

Format | Meaning
Italic | Information that the user must supply
Bold | Elements that the user must type exactly as shown
Ellipsis (...) | Parameter that can be repeated several times in a command line
Between brackets ([]) | Optional items
Between braces ({}); choices separated by pipe (|). Example: {even|odd} | Set of choices from which the user must choose only one
Courier font | Code or program output

See Also

Command-line reference A-ZCommand shell overview


Gettype

Applies To: Windows XP,Windows Server 2003 with SP1,Windows Server 2003,Windows Server 2003 with SP2,Windows Server 2003 R2

Gettype is deprecated, and is not guaranteed to be supported in future releases of Windows.

This tool is included in Windows Server 2003 . For more information see Gettype.


Getmac
See Also

Applies To: Windows Server 2008,Windows Server 2008 R2

Getmac

Returns the media access control (MAC) address and list of network protocols associated with each address for all network cards in each computer, either locally or across a network.

Syntax

getmac[.exe][/s Computer [/u Domain\User [/p Password]]][/fo {TABLE | LIST | CSV}][/nh][/v]

Parameters
/s Computer

Specifies the name or IP address of a remote computer (do not use backslashes). The default is the local computer.

/u Domain \ User

Runs the command with the account permissions of the user specified by User or Domain\User. The default is the permissions of the current logged on user on the computer issuing the command.

/p Password

Specifies the password of the user account that is specified in the /u parameter.

/fo{ TABLE| LIST| CSV}

Specifies the format to use for the query output. Valid values are TABLE, LIST, and CSV. The default format for output is TABLE.

/nh

Suppresses column header in output. Valid when the /fo parameter is set to TABLE or CSV.

/v

Specifies that the output display verbose information.

/?

Displays help at the command prompt.

Remarks
  • Getmac can be useful either when you want to enter the MAC address into a network analyzer or when you need to know what protocols are currently in use on each network adapter in a computer.

Examples

The following examples show how you can use the getmac command:

getmac /fo table /nh /v

getmac /s srvmain

getmac /s srvmain /u maindom\hiropln

getmac /s srvmain /u maindom\hiropln /p p@ssW23

getmac /s srvmain /u maindom\hiropln /p p@ssW23 /fo list /v

getmac /s srvmain /u maindom\hiropln /p p@ssW23 /fo table /nh

Formatting legend

Format | Meaning
Italic | Information that the user must supply
Bold | Elements that the user must type exactly as shown
Ellipsis (...) | Parameter that can be repeated several times in a command line
Between brackets ([]) | Optional items
Between braces ({}); choices separated by pipe (|). Example: {even|odd} | Set of choices from which the user must choose only one
Courier font | Code or program output

See Also

Command-line reference A-ZCommand shell overviewCommand-line reference


Goto

Applies To: Windows Vista,Windows Server 2008

Directs cmd.exe to a labeled line in a batch program. Within a batch program, goto directs command processing to a line that is identified by a label. When the label is found, processing continues starting with the commands that begin on the next line.

For examples of how to use this command, see Examples.

Syntax

Copy Code
goto <Label>

Parameters

Parameter | Description
<Label> | Specifies a text string that is used as a label in the batch program.
/? | Displays help at the command prompt.

Remarks

  • Working with command extensions

    If command extensions are enabled (the default), and you use the goto command with a target label of :EOF, you transfer control to the end of the current batch script file and exit the batch script file without defining a label. When you use goto with the :EOF label, you must insert a colon before the label. For example:

    Copy Code
    goto:EOF
  • Using valid Label values

    You can use spaces in the Label parameter, but you cannot include other separators (for example, semicolons or equal signs). The goto command uses only the first eight characters of a label. For example, the following labels are equivalent and resolve to :hithere0:

    Copy Code
    :hithere0
:hithere01
:hithere02
  • Matching Label with the label in the batch program

    The Label value that you specify must match a label in the batch program. The label within the batch program must begin with a colon (:). If a line begins with a colon, it is treated as a label and any commands on that line are ignored. If your batch program does not contain the label that you specify in Label, the batch program stops and displays the following message:

    Copy Code
    Label not found
  • Using goto for conditional operations

    You can use goto with other commands to perform conditional operations. For more information about using goto for conditional operations, see the If command reference.

Examples

The following batch program formats a disk in drive A as a system disk. If the operation is successful, the goto command directs processing to the :end label:

Copy Code
echo off
format a: /s
if not errorlevel 1 goto end
echo An error occurred during formatting.
:end
echo End of batch program.

Additional references

Command-Line Syntax Key

Cmd

If


Gpresult

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Server 2003,Windows Vista,Windows Server 2003 R2,Windows 7

Displays the Resultant Set of Policy (RSoP) information for a remote user and computer. For examples of how this command can be used, see Examples.

Syntax

Copy Code
gpresult [/s <COMPUTER> [/u <USERNAME> [/p [<PASSWORD>]]]] [/user [<TARGETDOMAIN>\]<TARGETUSER>] [/scope {user | computer}] {/r | /v | /z | [/x | /h] <FILENAME> [/f] | /?}

Parameters

Note
Except when you use /?, you must include an output option, either /r, /v, /z, /x, or /h.

Parameter | Description
/s <COMPUTER> | Specifies the name or IP address of a remote computer. Do not use backslashes. The default is the local computer.
/u <USERNAME> | Uses the credentials of the specified user to run the command. The default user is the user who is logged on to the computer that issues the command.
/p [<PASSWORD>] | Specifies the password of the user account that is provided in the /u parameter. If /p is omitted, gpresult prompts for the password. /p cannot be used with /x or /h.
/user [<TARGETDOMAIN>\]<TARGETUSER> | Specifies the remote user whose RSoP data is to be displayed.
/scope {user | computer} | Displays RSoP data for either the user or the computer. If /scope is omitted, gpresult displays RSoP data for both the user and the computer.
[/x | /h] <FILENAME> | Saves the report in either XML (/x) or HTML (/h) format at the location and with the file name that is specified by the FILENAME parameter. Cannot be used with /u, /p, /r, /v, or /z.
/f | Forces gpresult to overwrite the file name that is specified in the /x or /h option.
/r | Displays RSoP summary data.
/v | Displays verbose policy information. This includes detailed settings that were applied with a precedence of 1.
/z | Displays all available information about Group Policy. This includes detailed settings that were applied with a precedence of 1 and higher.
/? | Displays Help at the command prompt.

Remarks

  • Group Policy is the primary administrative tool for defining and controlling how programs, network resources, and the operating system operate for users and computers in an organization. In an Active Directory environment, Group Policy is applied to users or computers based on their membership in sites, domains, or organizational units.

  • Because you can apply overlapping policy settings to any computer or user, the Group Policy feature generates a resulting set of policy settings when the user logs on. Gpresult displays the resulting set of policy settings that were enforced on the computer for the specified user when the user logged on.

  • Because /v and /z produce lots of information, it is useful to redirect output to a text file (for example, gpresult /z >policy.txt).

  • The gpresult command is available in Windows Server 2008 R2, Windows Server 2008, Windows 7 Ultimate, Windows 7 Professional, Windows Vista Ultimate, Windows Vista Enterprise, and Windows Vista Business.

Examples

The following example retrieves RSoP data for the remote user targetusername of the computer srvmain, and displays RSoP data about the user only. The command is run with the credentials of the user maindom\hiropln, and p@ssW23 is entered as the password for that user.

Copy Code
gpresult /s srvmain /u maindom\hiropln /p p@ssW23 /user targetusername /scope user /r

The following example saves all available information about Group Policy for the remote user targetusername of the computer srvmain to a file that is named policy.txt. No data is included about the computer. The command is run with the credentials of the user maindom\hiropln, and p@ssW23 is entered as the password for that user.

Copy Code
gpresult /s srvmain /u maindom\hiropln /p p@ssW23 /user targetusername /z > policy.txt

The following example displays RSoP data for the computer srvmain and the logged-on user. Data is included about both the user and the computer. The command is run with the credentials of the user maindom\hiropln, and p@ssW23 is entered as the password for that user.

Copy Code
gpresult /s srvmain /u maindom\hiropln /p p@ssW23 /r

Additional references

  • Group Policy TechCenter

  • Command-Line Syntax Key


Graftabl

Applies To: Windows Server 2008,Windows Vista

Enables Windows operating systems to display an extended character set in graphics mode. If used without parameters, graftabl displays the previous and the current code page.

For examples of how to use this command, see Examples.

Syntax

Copy Code
graftabl <CodePage>
graftabl /status

Parameters

Parameter | Description
<CodePage> | Specifies a code page to define the appearance of extended characters in graphics mode. Valid code page identification numbers are: 437: United States 850: Multilingual (Latin I) 852: Slavic (Latin II) 855: Cyrillic (Russian) 857: Turkish 860: Portuguese 861: Icelandic 863: Canadian-French 865: Nordic 866: Russian 869: Modern Greek
/status | Displays the current code page that graftabl is using.
/? | Displays help at the command prompt.

Remarks

  • Graftabl affects only the monitor display of extended characters of the code page that you specify. It does not change the actual console input code page. To change the console input code page, use the mode or chcp command.

  • The following table lists each exit code and a brief description of it.

    Exit code Description

    0

    Character set was loaded successfully. No previous code page was loaded.

    1

    An incorrect parameter was specified. No action was taken.

    2

    A file error occurred.

  • You can use the ERRORLEVEL environment variable in a batch program to process exit codes that are returned by graftabl.

Examples

To view the current code page used by graftabl, type:

Copy Code
graftabl /status

To load the graphics character set for code page 437 (United States) into memory, type:

Copy Code
graftabl 437

To load the graphics character set for code page 850 (multilingual) into memory, type:

Copy Code
graftabl 850

Additional references

Command-Line Syntax Key

Freedisk

Chcp


Hashgen

Applies To: Windows Server 2008 R2

Creates or deletes BranchCache content information, also called hashes, for the content in the specified directory on a BranchCache-capable file server.

Important
This command is available only on computers running Windows Server® 2008 R2 that have the File Services server role and the BranchCache for network files role service installed.

Syntax

Copy Code
hashgen [-q] [-t:HH:MM] [-d] [-f] <directory>

Parameters

Parameter | Description
directory | Required. Specifies the folder location that contains the content for which you want to generate content information. The command processes all content stored in directory and its subfolders.
-q | Optional. Specifies that the command is run in quiet mode. In quiet mode, the command does not display status information at the command prompt while the command is running. If –q is not specified, the command displays the folder location and file name for every file for which content information is generated.
-t:HH:MM | Optional. Specifies the maximum amount of time that content information can be generated before hashgen stops processing content, where HH means hours and MM means minutes. If –t is not specified, hashgen runs until it has produced content information for all content in the specified directory.
-d | Optional. Specifies the content information that you want to delete. All content information in the folder that you specify with the directory parameter is deleted when you use the –d parameter.
-f | Optional. Specifies that hashgen force the generation of content information for the specified directory, its subfolders and contents, even if current content information already exists.

Remarks

  • If hashgen is run without the –f parameter, the command skips the processing of content for which there is already valid content information.

  • The Windows Server® 2008 R2 family of operating systems can be used as BranchCache content servers, and include the hashgen command, with the following exceptions:

    • BranchCache is not supported in Server Core installations of Windows Server® 2008 R2 Enterprise with Hyper-V.

    • BranchCache is not supported in Server Core installations of Windows Server® 2008 R2 Datacenter with Hyper-V.


Help

Applies To: Windows Vista,Windows Server 2008

Provides online information about system commands (that is, non-network commands). If used without parameters, help lists and briefly describes every system command.

For examples of how to use this command, see Examples.

Syntax

Copy Code
help [<Command>]
[<Command>] /?

Parameters

Parameter | Description
<Command> | Specifies the name of the command that you want information about.

Examples

To view information about the robocopy command, type either of the following:

Copy Code
help robocopy
robocopy /?

Additional references

Command-Line Syntax Key


Helpctr

Applies To: Windows Server 2003 with SP1,Windows XP,Windows Server 2003,Windows Server 2003 with SP2,Windows Server 2003 R2

Helpctr is deprecated, and is not guaranteed to be supported in future releases of Windows.

This tool is included in Windows Server 2003 . For more information see Helpctr.


Hostname
See Also

Applies To: Windows Server 2003 R2,Windows 7,Windows Server 2003,Windows Vista,Windows XP,Windows Server 2008,Windows Server 2008 R2

Hostname

Displays the host name portion of the full computer name of the computer.
Syntax

hostname

Parameters
/?

Displays help at the command prompt.

Remarks
  • For more information about how to specify the full computer name, see Related Topics.

  • This command is available only if the Internet Protocol (TCP/IP) protocol is installed as a component in the properties of a network adapter in Network Connections.

Examples

To display the name of the computer, type:

hostname

Formatting legend

Format | Meaning
Italic | Information that the user must supply
Bold | Elements that the user must type exactly as shown
Ellipsis (...) | Parameter that can be repeated several times in a command line
Between brackets ([]) | Optional items
Between braces ({}); choices separated by pipe (|). Example: {even|odd} | Set of choices from which the user must choose only one
Courier font | Code or program output

See Also

Command-line reference A-ZCommand shell overview


Icacls

Applies To: Windows Server 2008

Displays or modifies discretionary access control lists (DACLs) on specified files, and applies stored DACLs to files in specified directories.

For examples of how to use this command, see Examples.

Syntax

Copy Code
icacls <FileName> [/grant[:r] <Sid>:<Perm>[...]] [/deny <Sid>:<Perm>[...]] [/remove[:g|:d]] <Sid>[...]] [/t] [/c] [/l] [/q] [/setintegritylevel <Level>:<Policy>[...]]
icacls <Directory> [/substitute <SidOld> <SidNew> [...]] [/restore <ACLfile> [/c] [/l] [/q]]

Parameters

Parameter Description

<FileName>

Specifies the file for which to display DACLs.

<Directory>

Specifies the directory for which to display DACLs.

/t

Performs the operation on all specified files in the current directory and its subdirectories.

/c

Continues the operation despite any file errors. Error messages will still be displayed.

/l

Performs the operation on a symbolic link versus its destination.

/q

Suppresses success messages.

[/save <ACLfile> [/t] [/c] [/l] [/q]]

Stores DACLs for all matching files into ACLfile for later use with /restore.

[/setowner <Username> [/t] [/c] [/l] [/q]]

Changes the owner of all matching files to the specified user.

[/findSID <Sid> [/t] [/c] [/l] [/q]]

Finds all matching files that contain a DACL explicitly mentioning the specified security identifier (SID).

[/verify [/t] [/c] [/l] [/q]]

Finds all files with ACLs that are not canonical or have lengths inconsistent with ACE (access control entry) counts.

[/reset [/t] [/c] [/l] [/q]]

Replaces ACLs with default inherited ACLs for all matching files.

[/grant[:r] <Sid>:<Perm>[...]]

Grants specified user access rights. Permissions replace previously granted explicit permissions.

Without :r, permissions are added to any previously granted explicit permissions.

[/deny <Sid>:<Perm>[...]]

Explicitly denies specified user access rights. An explicit deny ACE is added for the stated permissions and the same permissions in any explicit grant are removed.

[/remove[:g|:d]] <Sid>[...]] [/t] [/c] [/l] [/q]

Removes all occurrences of the specified SID from the DACL.

:g removes all occurrences of granted rights to the specified SID.

:d removes all occurrences of denied rights to the specified SID.

[/setintegritylevel [(CI)(OI)]<Level>:<Policy>[...]]

Explicitly adds an integrity ACE to all matching files. Level is specified as:

  • L[ow]

  • M[edium]

  • H[igh]

Inheritance options for the integrity ACE may precede the level and are applied only to directories.

[/substitute <SidOld> <SidNew> [...]]

Replaces an existing SID (SidOld) with a new SID (SidNew). Requires the Directory parameter.

/restore <ACLfile> [/c] [/l] [/q]

Applies stored DACLs from ACLfile to files in the specified directory. Requires the Directory parameter.

Remarks

  • SIDs may be in either numerical or friendly name form. If you use a numerical form, affix the wildcard character * to the beginning of the SID.

  • icacls preserves the canonical order of ACE entries as:

    • Explicit denials

    • Explicit grants

    • Inherited denials

    • Inherited grants

  • Perm is a permission mask that can be specified in one of the following forms:

    • A sequence of simple rights:

      F (full access)

      M (modify access)

      RX (read and execute access)

      R (read-only access)

      W (write-only access)

    • A comma-separated list in parenthesis of specific rights:

      D (delete)

      RC (read control)

      WDAC (write DAC)

      WO (write owner)

      S (synchronize)

      AS (access system security)

      MA (maximum allowed)

      GR (generic read)

      GW (generic write)

      GE (generic execute)

      GA (generic all)

      RD (read data/list directory)

      WD (write data/add file)

      AD (append data/add subdirectory)

      REA (read extended attributes)

      WEA (write extended attributes)

      X (execute/traverse)

      DC (delete child)

      RA (read attributes)

      WA (write attributes)

  • Inheritance rights may precede either Perm form, and they are applied only to directories:

    (OI): object inherit

    (CI): container inherit

    (IO): inherit only

    (NP): do not propagate inherit

Examples

To save the DACLs for all files in the C:\Windows directory and its subdirectories to the ACLFile file, type:

Copy Code
icacls c:\windows\* /save aclfile /t

To restore the DACLs for every file within ACLFile that exists in the C:\Windows directory and its subdirectories, type:

Copy Code
icacls c:\windows\ /restore aclfile

To grant the user User1 Delete and Write DAC permissions to a file named "Test1", type:

Copy Code
icacls test1 /grant User1:(d,wdac)

To grant the user defined by SID S-1-1-0 Delete and Write DAC permissions to a file, named "Test2", type:

Copy Code
icacls test2 /grant *S-1-1-0:(d,wdac)

Additional references

Command-Line Syntax Key


If

Applies To: Windows Server 2008,Windows Vista

Performs conditional processing in batch programs.

For examples of how to use this command, see Examples.

Syntax

Copy Code
if [not] ERRORLEVEL <Number> <Command> [else <Expression>]
if [not] <String1>==<String2> <Command> [else <Expression>]
if [not] exist <FileName> <Command> [else <Expression>]

If command extensions are enabled, use the following syntax:

Copy Code
if [/i] <String1> <CompareOp> <String2> <Command> [else <Expression>]
if cmdextversion <Number> <Command> [else <Expression>]
if defined <Variable> <Command> [else <Expression>]

Parameters

Parameter | Description
not | Specifies that the command should be carried out only if the condition is false.
errorlevel <Number> | Specifies a true condition only if the previous program run by Cmd.exe returned an exit code equal to or greater than Number.
<Command> | Specifies the command that should be carried out if the preceding condition is met.
<String1>==<String2> | Specifies a true condition only if String1 and String2 are the same. These values can be literal strings or batch variables (for example, %1). You do not need to enclose literal strings in quotation marks.
exist <FileName> | Specifies a true condition if the specified file name exists.
<CompareOp> | Specifies a three-letter comparison operator. The following list represents valid values for CompareOp: EQU Equal to NEQ Not equal to LSS Less than LEQ Less than or equal to GTR Greater than GEQ Greater than or equal to
/i | Forces string comparisons to ignore case. You can use /i on the String1==String2 form of if. These comparisons are generic, in that if both String1 and String2 are comprised of numeric digits only, the strings are converted to numbers and a numeric comparison is performed.
cmdextversion <Number> | Specifies a true condition only if the internal version number associated with the command extensions feature of Cmd.exe is equal to or greater than the number specified. The first version is 1. It increases by increments of one when significant enhancements are added to the command extensions. The cmdextversion conditional is never true when command extensions are disabled (by default, command extensions are enabled).
defined <Variable> | Specifies a true condition if Variable is defined.
<Expression> | Specifies a command-line command and any parameters to be passed to the command in an else clause.
/? | Displays help at the command prompt.

Remarks

  • If the condition specified in an if clause is true, the command that follows the condition is carried out. If the condition is false, the command in the if clause is ignored and the command executes any command that is specified in the else clause.

  • When a program stops, it returns an exit code. To use exit codes as conditions, use errorlevel.

  • If you use defined, the following three variables are added to the environment: %errorlevel%, %cmdcmdline%, and %cmdextversion%.

    • %errorlevel% expands into a string representation of the current value of the ERRORLEVEL environment variable. This assumes that there is not an existing environment variable with the name ERRORLEVEL—if there is, you will get that ERRORLEVEL value instead.

    • %cmdcmdline% expands into the original command line that was passed to Cmd.exe prior to any processing by Cmd.exe. This assumes that there is not an existing environment variable with the name CMDCMDLINE—if there is, you will get the CMDCMDLINE value instead.

    • %cmdextversion% expands into the string representation of the current value of cmdextversion. This assumes that there is not an existing environment variable with the name CMDEXTVERSION—if there is, you will get the CMDEXTVERSION value instead.

  • You must use the else clause on the same line as the command after the if.

Examples

To display the message "Cannot find data file" if the file Product.dat cannot be found, type:

Copy Code
if not exist product.dat echo Cannot find data file

To format a disk in drive A and display an error message if an error occurs during the formatting process, type the following lines in a batch file:

Copy Code
:begin
@echo off
format a: /s
if not errorlevel 1 goto end
echo An error occurred during formatting.
:end
echo End of batch program.

To delete the file Product.dat from the current directory or display a message if Product.dat is not found, type the following lines in a batch file:

Copy Code
IF EXIST Product.dat (
del Product.dat
) ELSE (
echo The Product.dat file is missing.
)
Note
These lines can be combined into a single line as follows:

Copy Code
IF EXIST Product.dat (del Product.dat) ELSE (echo The Product.dat file is missing.)

To echo the value of the ERRORLEVEL environment variable after running a batch file, type the following lines in the batch file:

Copy Code
goto answer%errorlevel%
:answer1
echo Program had return code 1
:answer0
echo Program had return code 0
goto end
:end
echo Done!

To go to the "okay" label if the value of the ERRORLEVEL environment variable is less than or equal to 1, type:

Copy Code
if %errorlevel% LEQ 1 goto okay

Additional references

Command-Line Syntax Key

If

Goto


Inuse

Applies To: Windows Server 2003,Windows Server 2003 with SP2,Windows Server 2003 R2,Windows XP,Windows Server 2003 with SP1

Inuse is deprecated, and is not guaranteed to be supported in future releases of Windows.

This tool is included in Windows Server 2003 . For more information see Inuse.


Ipconfig

Applies To: Windows Server 2008,Windows Vista

Ipconfig

Displays all current TCP/IP network configuration values and refreshes Dynamic Host Configuration Protocol (DHCP) and Domain Name System (DNS) settings. Used without parameters, ipconfig displays Internet Protocol version 4 (IPv4) and IPv6 addresses, subnet mask, and default gateway for all adapters.
Syntax
Copy Code
ipconfig [/allcompartments] [/all] [/renew[Adapter]] [/release[Adapter]] [/renew6[Adapter]] [/release6[Adapter]] [/flushdns] [/displaydns] [/registerdns] [/showclassidAdapter] [/setclassidAdapter [ClassID]]
Parameters

Parameter | Description
/? | Displays help at the command prompt.
/all | Displays the full TCP/IP configuration for all adapters. Adapters can represent physical interfaces, such as installed network adapters, or logical interfaces, such as dial-up connections.
/allcompartments | Displays the full TCP/IP configuration for all compartments.
/displaydns | Displays the contents of the DNS client resolver cache, which includes both entries preloaded from the local Hosts file and any recently obtained resource records for name queries resolved by the computer. The DNS Client service uses this information to resolve frequently queried names quickly, before querying its configured DNS servers.
/flushdns | Flushes and resets the contents of the DNS client resolver cache. During DNS troubleshooting, you can use this procedure to discard negative cache entries from the cache, as well as any other entries that have been added dynamically.
/registerdns | Initiates manual dynamic registration for the DNS names and IP addresses that are configured at a computer. You can use this parameter to troubleshoot a failed DNS name registration or resolve a dynamic update problem between a client and the DNS server without rebooting the client computer. The DNS settings in the advanced properties of the TCP/IP protocol determine which names are registered in DNS.
/release[Adapter] | Sends a DHCPRELEASE message to the DHCP server to release the current DHCP configuration and discard the IP address configuration for either all adapters (if an adapter is not specified) or for a specific adapter if the Adapter parameter is included. This parameter disables TCP/IP for adapters configured to obtain an IP address automatically. To specify an adapter name, type the adapter name that appears when you use ipconfig without parameters.
/release6[Adapter] | Sends a DHCPRELEASE message to the DHCPv6 server to release the current DHCP configuration and discard the IPv6 address configuration for either all adapters (if an adapter is not specified) or for a specific adapter if the Adapter parameter is included. This parameter disables TCP/IP for adapters configured to obtain an IP address automatically. To specify an adapter name, type the adapter name that appears when you use ipconfig without parameters.
/renew[Adapter] | Renews DHCP configuration for all adapters (if an adapter is not specified) or for a specific adapter if the Adapter parameter is included. This parameter is available only on computers with adapters that are configured to obtain an IP address automatically. To specify an adapter name, type the adapter name that appears when you use ipconfig without parameters.
/renew6[Adapter] | Renews DHCPv6 configuration for all adapters (if an adapter is not specified) or for a specific adapter if the Adapter parameter is included. This parameter is available only on computers with adapters that are configured to obtain an IPv6 address automatically. To specify an adapter name, type the adapter name that appears when you use ipconfig without parameters.
/setclassid Adapter[ ClassID] | Configures the DHCP class ID for a specified adapter. To set the DHCP class ID for all adapters, use the asterisk (*) wildcard character in place of Adapter. This parameter is available only on computers with adapters that are configured to obtain an IP address automatically. If a DHCP class ID is not specified, the current class ID is removed.
/showclassid Adapter | Displays the DHCP class ID for a specified adapter. To see the DHCP class ID for all adapters, use the asterisk (*) wildcard character in place of Adapter. This parameter is available only on computers with adapters that are configured to obtain an IP address automatically.
Remarks
  • This command is most useful on computers that are configured to obtain an IP address automatically. This enables users to determine which TCP/IP configuration values have been configured by DHCP, Automatic Private IP Addressing (APIPA), or an alternate configuration.

  • If the name you supply for Adapter contains any spaces, use quotation marks around the adapter name (that is, "Adapter Name").

  • For adapter names, ipconfig supports the use of the asterisk (*) wildcard character to specify either adapters with names that begin with a specified string or adapters with names that contain a specified string. For example, Local* matches all adapters that start with the string Local and *Con* matches all adapters that contain the string Con.

Examples

To display the basic TCP/IP configuration for all adapters, type:

Copy Code
ipconfig

To display the full TCP/IP configuration for all adapters, type:

Copy Code
ipconfig /all

To renew a DHCP-assigned IP address configuration for only the Local Area Connection adapter, type:

Copy Code
ipconfig /renew "Local Area Connection"

To flush the DNS resolver cache when troubleshooting DNS name resolution problems, type:

Copy Code
ipconfig /flushdns

To display the DHCP class ID for all adapters with names that start with Local, type:

Copy Code
ipconfig /showclassid Local*

To set the DHCP class ID for the Local Area Connection adapter to TEST, type:

Copy Code
ipconfig /setclassid "Local Area Connection" TEST


Ipxroute

Applies To: Windows Server 2008,Windows Server 2008 R2

Ipxroute is deprecated, and is not guaranteed to be supported in future releases of Windows.

This tool is included in Windows Server 2003. For more information see Ipxroute.


Irftp

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Sends files over an infrared link. For examples of how this command can be used, see Examples.

Syntax

Copy Code
irftp [<Drive>:\] [[<Path>] <FileName>] [/h][/s]

Parameters

Parameter | Description
Drive:\ | Specifies the drive that contains the files that you want to send over an infrared link.
[Path]FileName | Specifies the location and name of the file or set of files that you want to send over an infrared link. If you specify a set of files, you must specify the full path for each file.
/h | Specifies hidden mode. When hidden mode is used, the files are sent without displaying the Wireless Link dialog box.
/s | Opens the Wireless Link dialog box, so that you can select the file or set of files that you want to send without using the command line to specify the drive, path, and file names.

Remarks

  • Before using this command, verify that the devices that you want to communicate over an infrared link have infrared functionality enabled and working correctly, and that an infrared link is established between the devices.

  • Used without parameters or used with /s, irftp opens the Wireless Link dialog box, where you can select the files that you want to send without using the command line.

Examples

Send Example.txt over the infrared link.

Copy Code
irftp c:\example.txt

Additional references

  • Command-Line Syntax Key


Ismserv

Applies To: Windows Server 2008,Windows Server 2008 R2

This service enables messages to be exchanged between computers running Windows Server sites. This service is used for mail-based replication between sites. Active Directory includes support for replication between sites by using SMTP over IP transport. SMTP support is provided by the SMTP service, which is a component of IIS. The set of transports used for communication between sites must be extensible; therefore, each transport is defined in a separate add-in dynamic link library (DLL). These add-in DLLs are loaded into the ISM service, which runs on all domain controllers that are candidates for performing communication between sites. The ISM service directs send requests and receive requests to the appropriate transport add-in DLLs, which then route the messages to the ISM service on the destination computer.

For examples of how to use this command, see Examples.

Syntax

Copy Code
ismserv [/install] [/remove] [/debug]

Parameters

Parameter | Description
/install | Add the service to the Service Control Manager (SCM) database.
/remove | Remove the service from the SCM database.
/debug | Run the service as a normal process, not under the SCM.

Examples

To add the service to the SCM, use the following command:

Copy Code
ismserv /install

To remove the service from the SCM database, use the following command:

Copy Code
ismserv /remove

Additional references <bulleted list>

  • Command-Line Syntax Key


Ktmutil

Applies To: Windows Server 2008

Starts the Kernel Transaction Manager utility. If used without parameters, ktmutil displays available subcommands.

For examples of how to use this command, see Examples.

Syntax

Copy Code
ktmutil list tms
ktmutil list transactions [{TmGuid}]
ktmutil resolve complete {TmGuid} {RmGuid} {EnGuid}
ktmutil resolve commit {TxGuid}
ktmutil resolve rollback {TxGuid}
ktmutil force commit {??Guid}
ktmutil force rollback {??Guid}
ktmutil forget

Parameters

Remarks

Examples

To force an Indoubt transaction with GUID 311a9209-03f4-11dc-918f-00188b8f707b to commit, type:

Copy Code
ktmutil force commit {311a9209-03f4-11dc-918f-00188b8f707b}

Additional references

Command-Line Syntax Key


Ktpass

Applies To: Windows Server 2008

Configures the server principal name for the host or service in Active Directory Domain Services (AD DS) and generates a .keytab file containing the shared secret key of the service. The .keytab file is based on the Massachusetts Institute of Technology (MIT) implementation of the Kerberos authentication protocol. The Ktpass command-line tool allows UNIX-based services that support Kerberos authentication to use the interoperability features provided by the Kerberos Key Distribution Center (KDC) service in Windows Server 2008 R2.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
ktpass
[/out <FileName>]
[/princ <PrincipalName>]
[/mapuser <UserAccount>]
[/mapop {add|set}] [{-|+}desonly] [/in <FileName>]
[/pass {Password|*|{-|+}rndpass}]
[/minpass]
[/maxpass]
[/crypto {DES-CBC-CRC|DES-CBC-MD5|RC4-HMAC-NT|AES256-SHA1|AES128-SHA1|All}]
[/itercount]
[/ptype {KRB5_NT_PRINCIPAL|KRB5_NT_SRV_INST|KRB5_NT_SRV_HST}]
[/kvno <KeyVersionNum>]
[/answer {-|+}]
[/target]
[/rawsalt] [{-|+}dumpsalt] [{-|+}setupn] [{-|+}setpass <Password>]  [/?|/h|/help]

Parameters

Parameter Description

/out <FileName>

Specifies the name of the Kerberos version 5 .keytab file to generate.

Note
This is the .keytab file that you transfer to the UNIX computer and replace or merge with your existing .keytab file, /Etc/Krb5.keytab.

/princ <PrincipalName>

Specifies the principal name in the form user@REALM.

/mapuser <UserAccount>

Maps the name of the Kerberos principal specified by the princ parameter to the specified local user name. By default, Kerberos principals are not mapped to local user names.

/mapop {add|set}

Specifies how the mapping attribute is set.

  • Add adds the value of the specified local user name. This is the default.

  • Set sets the value for Data Encryption Standard (DES)-only encryption for the specified local user name.

{-|+}desonly

DES-only encryption is set by default.

  • + Sets an account for DES-only encryption.

  • - Releases restriction on an account for DES-only encryption.

/in <FileName>

Specifies the .keytab file from the UNIX host to read.

/pass {Password|*|{-|+}rndpass}

Specifies a password for the principal user name specified in the princ parameter. Use "*" to prompt for a password.

/minpass

Sets the minimum length of the random password to 15 characters.

/maxpass

Sets the maximum length of the random password to 256 characters.

/crypto {DES-CBC-CRC|DES-CBC-MD5|RC4-HMAC-NT|AES256-SHA1|AES128-SHA1|All}

Sets the encryption type to use.

  • DES-CBC-CRC is the default and is used for compatibility.

  • DES-CBC-MD5 adheres more closely to the MIT implementation and is used for compatibility.

  • RC4-HMAC-NT is the default and employs 128-bit encryption.

  • AES256-SHA1 employs AES256-CTS-HMAC-SHA1-96 encryption.

  • AES128-SHA1 employs AES128-CTS-HMAC-SHA1-96 encryption.

  • All states that all supported cryptographic types can be used.

/itercount

Specifies the iteration count that is used for AES encryption. The default is that itercount is ignored for non-AES encryption and set at 4,096 for AES encryption.

/ptype {KRB5_NT_PRINCIPAL|KRB5_NT_SRV_INST|KRB5_NT_SRV_HST}

Specifies the principal type.

  • KRB5_NT_PRINCIPAL is the general principal type (recommended).

  • KRB5_NT_SRV_INST is the user service instance.

  • KRB5_NT_SRV_HST is the host service instance.

/kvno <KeyVersionNum>

Specifies the Key version number. The default value is 1.

/answer {-|+}

Sets the background answer mode:

- Answers reset password prompts automatically with NO.

+ Answers reset password prompts automatically with YES.

/target

Sets which domain controller to use. The default is for the domain controller to be detected based on the principal name. If the domain controller name does not resolve, a dialog box will prompt for a valid domain controller.

/rawsalt

Forces Ktpass to use the rawsalt algorithm when generating the key. This parameter is not needed.

{-|+}dumpsalt

Shows in the output the MIT salt algorithm being used to generate the key.

{-|+}setupn

Sets the user principal name (UPN) in addition to the service principal name (SPN). The default is to set both in the .keytab file.

{-|+}setpass <Password>

Sets the user's password when supplied. If rndpass is used, a random password is generated instead.

/?|/h|/help

Displays command-line help for Ktpass.

Remarks

Services running on UNIX systems can be configured with service instance accounts in AD DS. This allows full interoperability. MIT Kerberos clients and servers on UNIX systems can authenticate by using the Windows Server 2008 R2–based Kerberos server, and clients connected to servers running Windows Server 2008 R2 can authenticate to Kerberos services that support the Generic Security Service application programming interface (GSS-API).

Unlike Kerberos principal names, account names in Windows Server 2008 and Windows Server 2008 R2 do not have multiple parts. For this reason, it is not possible to directly create an account from the name Sample/Unix1.example.com. Such a principal instance is created by using the SPN mappings.

To generate a UNIX host .keytab file, use the following steps to map the principal to the account and set the host principal password:

  1. Use the Active Directory User and Computers snap-in to create a user account for the UNIX service. For example, create an account with the name SampleUnix1.

  2. Use Ktpass to set up an identity mapping for the user account by typing the following at a command line:

    Copy Code
    ktpass /princ <ServiceInstance@REALM> /mapuser <AccountName> /pass <Password> /out <Unixmachine.keytab>
    Note
    Replace ServiceInstance@REALM, AccountName, Password, and Unixmachine.keytab with actual values.

    You cannot map multiple service instances to the same user account.

  3. Merge the .keytab file with the /Etc/Krb5.keytab file on the UNIX host as shown in the following example.

Examples

The following example illustrates how to create a Kerberos .keytab file, Unixmachine.keytab, in the current directory for the user someone. (You will merge this file with the Krb5.keytab file on the UNIX host.) The Kerberos .keytab file will be created for AES256-CTS-HMAC-SHA1-96 encryption (as an example of the cryptographic support on the UNIX host) for the general principal type. A random password will be generated without minimum or maximum character length stipulated, and the "reset password prompt" will be (by default) automatically answered with a YES. Because the target domain controller is not specified, the tool detects the one matching the domain and reports the target used.

Copy Code
<drive:\> ktpass /out Unixmachine.keytab /mapuser someone@example.com /princ someone/techgroup.example.com@example.com
/crypto AES256-SHA1 /pass rndpass /ptype KRB5_NT_PRINCIPAL

Additional references

Command-Line Syntax Key


Label

Applies To: Windows Server 2008,Windows Vista

Creates, changes, or deletes the volume label (that is, the name) of a disk. If used without parameters, the label command changes the current volume label or deletes the existing label.

For examples of how to use this command, see Examples.

Syntax

Copy Code
label [/mp] [<Volume>] [<Label>]

Parameters

Parameter | Description
/mp | Specifies that the volume should be treated as a mount point or volume name.
<Volume> | Specifies a drive letter (followed by a colon), mount point, or volume name. If a volume name is specified, the /mp parameter is unnecessary.
<Label> | Specifies the label for the volume.
/? | Displays help at the command prompt.

Remarks

  • Windows displays the volume label and serial number (if it has one) as part of the directory listing.

  • An NTFS volume label can be up to 32 characters in length, including spaces. NTFS volume labels retain and display the case that was used when the label was created.

  • If you do not specify a value for the Label parameter, the label command displays output in the following format:

    Copy Code
    Volume in drive C: xxxxxxxxxxx
Volume Serial Number is xxxx-xxxx
Volume label (32 characters, ENTER for none)?
    You can type a new volume label or press ENTER to keep the current label. If you press ENTER and the volume currently has a label, the label command prompts you with the following message:

    Copy Code
    Delete current volume label (Y/N)?
    Press Y to delete the label, or press N to keep the label.

Examples

To label a disk in drive A that contains sales information for July, type:

Copy Code
label a:sales-july

To delete the current label for drive C, follow these steps:

  1. At the command prompt, type:

    Copy Code
    Label
    Output similar to the following should be displayed:

    Copy Code
    Volume in drive C: is Main Disk
Volume Serial Number is 6789-ABCD
Volume label (32 characters, ENTER for none)?
  2. Press ENTER. The following prompt should be displayed:

    Copy Code
    Delete current volume label (Y/N)?
  3. Press Y to delete the current label.

Additional references

Command-Line Syntax Key


Ldifde

Applies To: Windows Server 2003 with SP1,Windows Server 2008 R2,Windows Server 2008,Windows Server 2003

Creates, modifies, and deletes directory objects. You can also use ldifde to extend the schema, export Active Directory user and group information to other applications or services, and populate Active Directory Domain Services (AD DS) with data from other directory services.

Ldifde is a command-line tool that is built into Windows Server 2008. It is available if you have the AD DS or Active Directory Lightweight Directory Services (AD LDS) server role installed. To use ldifde, you must run the ldifde command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
Ldifde [-i] [-f <FileName>] [-s <ServerName>] [-c <String1> <String2>] [-v] [-j <Path>] [-t <PortNumber>] [-d <BaseDN>] [-r <LDAPFilter>] [-p <Scope>] [-l <LDAPAttributeList>] [-o <LDAPAttributeList>] [-g] [-m] [-n] [-k] [-a <UserDistinguishedName> <Password>] [-b <UserName> <Domain> <Password>] [-?]

Parameters

Parameter Description

-i

Specifies to use the import mode. The default mode is export.

-f <FileName>

Identifies the import or export file name.

-s <ServerName>

Specifies the domain controller to perform the import or export operation. By default, ldifde runs on the domain controller on which ldifde is installed.

-c <String1> <String2>

Replaces all occurrences of <String1> with <String2>. Generally, you use this parameter when you import data from one domain to another and you must replace the distinguished name of the export domain (<String1>) with the distinguished name of the import domain (<String2>).

-v

Sets verbose mode.

-j <Path>

Sets the log file location. The default location is the current path.

-t <PortNumber>

Specifies a Lightweight Directory Access Protocol (LDAP) port number. The default LDAP port number is 389. The global catalog port number is 3268.

-d <BaseDN>

Sets the distinguished name of the search base for data export.

-r <LDAPFilter>

Creates an LDAP search filter for data export. For example, to export all users with a surname that you specify, you can use the following filter:

-r (and(objectClass=User)(sn=Surname))

-p <Scope>

Sets the search scope. The search scope options are Base, OneLevel, or SubTree.

-l <LDAPAttributeList>

Sets the list of attributes to return in the results of an export query. If you do not specify this parameter, the search returns all attributes.

-o <LDAPAttributeList>

Sets the list of attributes to omit from the results of an export query. This is typically used when exporting objects from AD DS and then importing them into another LDAP-compliant directory. If attributes are not supported by another directory, you can omit the attributes from the result set using this option.

-g

Omits paged searches.

-m

Omits attributes that apply only to Active Directory objects, such as the ObjectGUID, objectSID, pwdLastSet and samAccountType attributes.

-n

Omits the export of binary values.

-k

Ignores errors during an import operation and continues processing. This parameter ignores all of the following errors:

  • The object is already a member of the group

  • The operation has an object class violation

    This violation means that the specified object class does not exist, if the object being imported has no other attributes.

  • The object already exists

  • The operation has a constraint violation

  • The attribute or value already exists

  • The operation found no such object

-a <UserDistinguishedName> <Password>

Sets the command to run using the distinguished name (<UserDistinguishedName>) and password (<Password>) that you supply. By default, the command uses the credentials of the user who is currently logged on to the network.

-b <UserName> <Domain> <Password>

Sets the command to run using the supplied <UserName> <Domain> <Password>. By default, the command will run using the credentials of the user currently logged on to the network.

/?

Displays help at the command menu.

Remarks

  • When you create the import file to use with the ldifde command, use a changeType value to define the type of changes that the import file will contain. The following table shows the changeType values that you can use.

    Value Description

    add

    Specifies that new content is contained in the import file.

    modify

    Specifies that existing content has been modified in the import file.

    delete

    Specifies that content has been deleted in the import file.
    The following example shows an LDAP Data Interchange Format (LDIF) import file format that uses the add value.

    Copy Code
    DN: CN=SampleUser,DC=DomainName
changetype: add
CN: SampleUser
description: DescriptionOfFile
objectClass: User
sAMAccountName: SampleUser

Examples

To retrieve only the distinguished name, common name, first name, surname, and telephone number for user objects in the fabrikam.com domain to a file named ldifde.txt in the c:\ldifde folder, run the following command:

Copy Code
Ldifde -d dc=fabrikam,dc=com -r (objectClass=User) -l distinguishedname,cn,givenname,sn,telephone –f ldifde.txt

To selectively omit the object creation date and time and the object globally unique identifier (GUID), run the following command:

Copy Code
Ldifde -d dc=fabrikam,dc=com -r (objectClass=User) -o whenCreated,objectGUID –f ldifde.txt
Tip
For more examples, see the following resources:

  • Article 237677 (http://go.microsoft.com/fwlink/?LinkID=87487) in the Microsoft Knowledge Base

  • Article 555636 (http://go.microsoft.com/fwlink/?LinkId=187670) in Microsoft Knowledge Base

Additional references

Command-Line Syntax Key

LDIFDE

Import or export directory objects using ldifde


Ldp

Applies To: Windows Server 2008

Performs operations such as connect, bind, search, modify, add, delete against any Lightweight Directory Access Protocol (LDAP)-compatible directory, such as Active Directory Domain Services (AD DS). Ldp is an LDAP client that you use to view objects that are stored in AD DS along with their metadata, such as security descriptors and replication metadata.

Note
Ldp is a graphical user interface (GUI)-based, Windows Explorer–like tool with a scope pane on the left that is used for navigating through the Active Directory namespace, and a details pane on the right that is used for displaying the results of the LDAP operations. Any text that is displayed in the details pane can be selected with the mouse and copied to the Clipboard.

Ldp is built into Windows Server 2008. It is available if you have the AD DS server role installed. To start ldp, click Start, click Run, type ldp and then click OK.

For examples of how to use this command, see Examples.

Finding required and optional values for an attribute

The schema defines objects as well as the attributes and permissible values for each. Schema classes that contain attribute information about objects can be viewed. To view this information, search cn=Schema,cn=Configuration,dc=ForestRootDomain for classSchema objects.

Understanding bind options for LDAP authentication

There are several authentication methods available in ldp that allow a client to bind to an LDAP server. The best method depends on several factors.

Method | Description
Simple | Cleartext password. Try not to use this, as it is not secure.
MSN | MSN (Microsoft Network) authentication. This package brings up a dialog box to prompt the user for MSN credentials.
DPA | Normandy authentication, new MSN authentication. Same usage as MSN.
NTLM | Windows NT domain authentication. Use NULL credentials and attempt to use default logged-in user credentials.
Sicily | Negotiate with the server for any of: MSN, DPA, NTLM. Should be used for LDAPv2 servers only.
Negotiate | Use GSSAPI Negotiate package to negotiate security package of either Kerberos V5 or NTLM (or any other package the client and server negotiate). Pass in NULL credentials to specify default logged-in user. If Negotiate package is not installed on server or client, this will fall back to Sicily negotiation.

Examples

Example 1: Add a new object to an LDAP directory

To add a user to Active Directory by using ldp:

  1. On the Browse menu, click Add child.

  2. In the Add dialog box, in the Dn input box, enter the distinguished name of the new object.

  3. In the Edit Entry section, add the new attributes and values. Click Enter after typing in each attribute and associated value:

    Attribute Value

    userAccountControl

    512

    ObjectClass

    User

    SamAccountName

    Testuser2

  4. To add the attribute or value combination to the Entry List box, click Edit.

  5. To add the information to Active Directory using LDAP APIs when all the attributes are entered, click Run.

Example 2: Search an LDAP directory

To search Active Directory by using ldp:

  • On the Browse menu, click Search.

    The Search dialog box opens.

In the following searches, the LDAP directory is AD DS. For user names, it contains a givenName attribute for first names, and an attribute of sn for last names.

  • To search for all users that have a first name of John and a last name of either Smith or Jones, type the following in the Filter field:

    Copy Code
    (&(objectClass=user)(givenName=John)(|(sn=Smith)(sn=Jones))))
  • To search for users that have a last name of Jones, but filter out those users that have a first name of John or Jane, and also filter out users that have not logged on at least 100 times, type the following in the Filter field. (The exclamation point (!) is the NOT operator.)

    Copy Code
    (&(objectClass=user)(sn=Jones)(!givenName=John)(!givenName=Jane)(!logonCount<=100))
  • To search for reserved characters as part of an attribute value, you must precede the reserved character with an escape character. Use the following escape characters to represent the associated characters:

    Character Escape character

    *

    2a

    (

    28

    )

    29

    \

    5c

    NUL

    00

  • To search for all of the users whose display names end in a close parenthesis character, type the following in the Filter field:

    Copy Code
    (&(objectClass=user)(displayName=*\29))
  • To search for all users who have a surname that starts with the letter J, type the following in the Filter field. (Queries support the wildcard character (*).)

    Copy Code
    (&(objectClass=user)(sn=j*))
  • To search for users whose home directories are G:\Accounting, type the following in the Filter field. (The attribute name is home-directory.)

    Copy Code
    (&(objectClass=user)(home-directory=G:\5cACCOUNTING*))

Example 3: Control the returns on a search of an LDAP directory

In this example, you use the Search Options dialog box to control which attributes are displayed in a search. Just a few attributes are displayed; the rest are filtered and do not display in the details window of ldp.

To control which attributes display:

  • In the Attributes input box, type the attributes to display:

    Copy Code
    "memberof;range:1-20"objectClass;objectGUID
    Note
    Separate attributes with a semicolon. No spaces are necessary. All other attributes will be filtered out of the display.

    Note
    A range is specified for the memberof attribute. Because a semicolon is used, the entire section must be separated from the rest of the attributes by quotation marks.

All searches display only the memberof, objectClass, and objectGUID attributes in the details pane. To return all attributes, replace any existing list of attributes with the wildcard character (*).

Example 4: View replication metadata for an object

To list the replication metadata for an object in Active Directory:

  1. On the Browse menu, point to Replication and then click View Metadata.

    The Replication Metadata dialog box opens.

  2. In the Object DN field, enter the distinguished name of the object, and then click OK.

    The output will look similar to the output in the following table.

    AttID Ver Loc.USN Originating DSA Org.USN Org.Time/Date

    0

    1

    3693

    9fad4c38-2d76-44b2-84f6-f2fe384f8450

    3693

    2000-12-29 09:15.02

    3

    1

    3693

    9fad4c38-2d76-44b2-84f6-f2fe384f8450

    3693

    2000-12-29 09:15.02

    d

    1

    3693

    9fad4c38-2d76-44b2-84f6-f2fe384f8450

    3693

    2000-12-29 09:15.02

    20001

    1

    3693

    9fad4c38-2d76-44b2-84f6-f2fe384f8450

    3693

    2000-12-29 09:15.02

    20002

    1

    3693

    9fad4c38-2d76-44b2-84f6-f2fe384f8450

    3693

    2000-12-29 09:15.02

Additional references

Command-Line Syntax Key


Logman

Applies To: Windows Vista,Windows Server 2008

Logman creates and manages Event Trace Session and Performance logs and supports many functions of Performance Monitor from the command line.

Syntax

Copy Code
logman [create | query | start | stop | delete| update | import | export | /?] [options]

Actions

Action | Description
logman create | Create a counter, trace, configuration data collector, or API.
logman query | Query data collector properties.
logman start | stop | Start or stop data collection.
logman delete | Delete an existing data collector.
logman update | Update the properties of an existing data collector.
logman import | export | Import a data collector set from an XML file or export a data collector set to an XML file.
Copy Code


logman create

Applies To: Windows Server 2008,Windows Vista

Syntax

Copy Code
logman create <counter | trace | alert | cfg | api> <[-n] <name>> [options]

Parameters

Parameter | Description
logman create counter | Create a counter data collector.
logman create trace | Create a trace data collector.
logman create alert | Create an alert data collector.
logman create cfg | Create a configuration data collector.
logman create api | Create an API tracing data collector.

Additional references


logman create counter

Applies To: Windows Server 2008,Windows Vista

Create a counter data collector.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
logman create counter <[-n] <name>> [options]

Parameters

Parameter | Description
/? | Displays context-sensitive help.
-s <computer name> | Perform the command on the specified remote computer.
-config <value> | Specifies the settings file containing command options.
[-n] <name> | Name of the target object.
-f <bin|bincirc|csv|tsv|sql> | Specifies the log format for the data collector.
-[-]u <user [password]> | Specifies the user to Run As. Entering a * for the password produces a prompt for the password. The password is not displayed when you type it at the password prompt.
-m <[start] [stop] [[start] [stop] [...]]> | Change to manual start or stop instead of a scheduled begin or end time.
-rf <[[hh:]mm:]ss> | Run the data collector for the specified period of time.
-b <M/d/yyyy h:mm:ss[AM|PM]> | Begin collecting data at the specified time.
-e <M/d/yyyy h:mm:ss[AM|PM]> | End data collection at the specified time.
-si <[[hh:]mm:]ss> | Specifies the sample interval for performance counter data collectors.
-o <path|dsn!log> | Specifies the output log file or the DSN and log set name in a SQL database.
-[-]r | Repeat the data collector daily at the specified begin and end times.
-[-]a | Append to an existing log file.
-[-]ow | Overwrite an existing log file.
-[-]v <nnnnnn|mmddhhmm> | Attach file versioning information to the end of the log file name.
-[-]rc <task> | Run the command specified each time the log is closed.
-[-]max <value> | Maximum log file size in MB or maximum number of records for SQL logs.
-[-]cnf <[[hh:]mm:]ss> | When time is specified, create a new file when the specified time has elapsed. When time is not specified, create a new file when the maximum size is exceeded.
-y | Answer yes to all questions without prompting.
-cf <filename> | Specifies the file listing performance counters to collect. The file should contain one performance counter name per line.
-c <path [path […]]> | Specifies performance counter(s) to collect.
-sc <value> | Specifies the maximum number of samples to collect with a performance counter data collector.

Remarks

Where [-] is listed, an extra - negates the option.

Examples

The following command creates a counter called perf_log using the % Processor Time counter from the Processor(_Total) counter category.

Copy Code
logman create counter perf_log -c "\Processor(_Total)\% Processor Time"

The following command creates a counter called perf_log using the % Processor Time counter from the Processor(_Total) counter category, creating a log file with a maximum size of 10 MB and collecting data for 1 minute and 0 seconds.

Copy Code
logman create counter perf_log -c "\Processor(_Total)\% Processor Time" -max 10 -rf 01:00

Additional references

Logman


logman create trace

Applies To: Windows Vista,Windows Server 2008

Create an event trace data collector.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
logman create trace <[-n] <name>> [options]

Parameters

Parameter Description

/?

Displays context-sensitive help.

-s <computer name>

Perform the command on the specified remote computer.

-config <value>

Specifies the settings file containing command options.

-ets

Send commands to Event Trace Sessions directly without saving or scheduling.

[-n] <name>

Name of the target object.

-f <bin|bincirc|csv|tsv|sql>

Specifies the log format for the data collector.

-[-]u <user [password]>

Specifies the user to Run As. Entering a * for the password produces a prompt for the password. The password is not displayed when you type it at the password prompt.

-m <[start] [stop] [[start] [stop] [...]]>

Change to manual start or stop instead of a scheduled begin or end time.

-rf <[[hh:]mm:]ss>

Run the data collector for the specified period of time.

-b <M/d/yyyy h:mm:ss[AM|PM]>

Begin collecting data at the specified time.

-e <M/d/yyyy h:mm:ss[AM|PM]>

End data collection at the specified time.

-o <path|dsn!log>

Specifies the output log file or the DSN and log set name in a SQL database.

-[-]r

Repeat the data collector daily at the specified begin and end times.

-[-]a

Append to an existing log file.

-[-]ow

Overwrite an existing log file.

-[-]v <nnnnnn|mmddhhmm>

Attach file versioning information to the end of the log file name.

-[-]rc <task>

Run the command specified each time the log is closed.

-[-]max <value>

Maximum log file size in MB or maximum number of records for SQL logs.

-[-]cnf <[[hh:]mm:]ss>

When time is specified, create a new file when the specified time has elapsed. When time is not specified, create a new file when the maximum size is exceeded.

-y

Answer yes to all questions without prompting.

-ct <perf|system|cycle>

Specifies the Event Trace Session clock type.

-ln <logger_name>

Specifies the logger name for Event Trace Sessions.

-ft <[[hh:]mm:]ss>

Specifies the Event Trace Session flush timer.

-[-]p <provider [flags [level]]>

Specifies a single Event Trace provider to enable.

-pf <filename>

Specifies a file listing multiple Event Trace providers to enable. The file should be a text file containing one provider per line.

-[-]rt

Run the Event Trace Session in real-time mode.

-[-]ul

Run the Event Trace Session in user mode.

-bs <value>

Specifies the Event Trace Session buffer size in kb.

-nb <min max>

Specifies the number of Event Trace Session buffers.

-mode <globalsequence|localsequence|pagedmemory>

Specifies the event trace session logger mode.

Globalsequence specifies that the event tracer add a sequence number to every event it receives irrespective of which trace session received the event.

Localsequence specifies that the event tracer add sequence numbers for events received at a specific trace session. When the localsequence option is used, duplicate sequence numbers can exist across all sessions but will be unique within each trace session.

Pagedmemory specifies that the event tracer use paged memory rather than the default non-paged memory pool for its internal buffer allocations.

Remarks

Where [-] is listed, an extra - negates the option.

Examples

The following example creates an event trace data collector called trace_log using no fewer than 16 and no more than 256 buffers, each buffer 64kb in size, and outputs the results to the location c:\logfile.

Copy Code
logman create trace trace_log -nb 16 256 -bs 64 -o c:\logfile

Additional references

Logman


logman create alert

Applies To: Windows Vista,Windows Server 2008

Create an alert data collector.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
logman create alert <[-n] <name>> [options]

Parameters

Parameter | Description
/? | Displays context-sensitive help.
-s <computer name> | Perform the command on the specified remote computer.
-config <value> | Specifies the settings file containing command options.
[-n] <name> | Name of the target object.
-[-]u <user [password]> | Specifies the user to Run As. Entering a * for the password produces a prompt for the password. The password is not displayed when you type it at the password prompt.
-m <[start] [stop] [[start] [stop] [...]]> | Change to manual start or stop instead of a scheduled begin or end time.
-rf <[[hh:]mm:]ss> | Run the data collector for the specified period of time.
-b <M/d/yyyy h:mm:ss[AM|PM]> | Begin collecting data at the specified time.
-e <M/d/yyyy h:mm:ss[AM|PM]> | End data collection at the specified time.
-si <[[hh:]mm:]ss> | Specifies the sample interval for performance counter data collectors.
-o <path|dsn!log> | Specifies the output log file or the DSN and log set name in a SQL database.
-[-]r | Repeat the data collector daily at the specified begin and end times.
-[-]a | Append to an existing log file.
-[-]ow | Overwrite an existing log file.
-[-]v <nnnnnn|mmddhhmm> | Attach file versioning information to the end of the log file name.
-[-]rc <task> | Run the command specified each time the log is closed.
-[-]max <value> | Maximum log file size in MB or maximum number of records for SQL logs.
-[-]cnf <[[hh:]mm:]ss> | When time is specified, create a new file when the specified time has elapsed. When time is not specified, create a new file when the maximum size is exceeded.
-y | Answer yes to all questions without prompting.
-cf <filename> | Specifies the file listing performance counters to collect. The file should contain one performance counter name per line.
-[-]el | Enables or disables Event Log reporting.
-th <threshold [threshold [...]]> | Specify counters and their threshold values for an alert.
-[-]rdcs <name> | Specifies the Data Collector Set to start when an alert fires.
-[-]tn <task> | Specifies the task to run when an alert fires.
-[-]targ <argument> | Specifies the task arguments to be used with the task specified using -tn.

Remarks

Where [-] is listed, an extra - negates the option.

Examples

The following command creates an alert called new_alert that fires when the performance counter % Processor Time in the Processor(_Total) counter group exceeds the counter value of 50.

Copy Code
logman create alert new_alert -th "\Processor(_Total)\% Processor Time>50"
Note
The threshold value defined is based on the value collected by the counter, so in this example, the value of 50 equates to 50% Processor Time.

Additional references

Logman


logman create cfg

Applies To: Windows Vista,Windows Server 2008

Create a configuration data collector.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
logman create cfg <[-n] <name>> [options]

Parameters

Parameter | Description
/? | Displays context-sensitive help.
-s <computer name> | Perform the command on the specified remote computer.
-config <value> | Specifies the settings file containing command options.
[-n] <name> | Name of the target object.
-f <bin|bincirc|csv|tsv|sql> | Specifies the log format for the data collector.
-[-]u <user [password]> | Specifies the user to Run As. Entering a * for the password produces a prompt for the password. The password is not displayed when you type it at the password prompt.
-m <[start] [stop] [[start] [stop] [...]]> | Change to manual start or stop instead of a scheduled begin or end time.
-rf <[[hh:]mm:]ss> | Run the data collector for the specified period of time.
-b <M/d/yyyy h:mm:ss[AM|PM]> | Begin collecting data at the specified time.
-e <M/d/yyyy h:mm:ss[AM|PM]> | End data collection at the specified time.
-si <[[hh:]mm:]ss> | Specifies the sample interval for performance counter data collectors.
-o <path|dsn!log> | Specifies the output log file or the DSN and log set name in a SQL database.
-[-]r | Repeat the data collector daily at the specified begin and end times.
-[-]a | Append to an existing log file.
-[-]ow | Overwrite an existing log file.
-[-]v <nnnnnn|mmddhhmm> | Attach file versioning information to the end of the log file name.
-[-]rc <task> | Run the command specified each time the log is closed.
-[-]max <value> | Maximum log file size in MB or maximum number of records for SQL logs.
-[-]cnf <[[hh:]mm:]ss> | When time is specified, create a new file when the specified time has elapsed. When time is not specified, create a new file when the maximum size is exceeded.
-y | Answer yes to all questions without prompting.
-[-]ni | Enable (-ni) or disable (--ni) network interface query.
-reg <path [path [...]]> | Specifies registry value(s) to collect.
-mgt <query [query [...]]> | Specifies WMI object(s) to collect using SQL query language.
-ftc <path [path [...]]> | Specifies the full path to the file(s) to collect.

Remarks

Where [-] is listed, an extra - negates the option.

Examples

The following command creates a configuration data collector called cfg_log using the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVerion\.

Copy Code
logman create cfg cfg_log -reg "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVerion\\"

The following command creates a configuration data collector called cfg_log that records all WMI objects from root\wmi in the database column MSNdis_VendorDriverVersion.

Copy Code
logman create cfg cfg_log -mgt "root\wmi:SELECT * FROM MSNdis_VendorDriverVersion"

Additional references

Logman


logman create api

Applies To: Windows Server 2008,Windows Vista

Create an API tracing data collector.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
logman create api <[-n] <name>> [options]

Parameters

Parameter | Description
/? | Displays context-sensitive help.
-s <computer name> | Perform the command on the specified remote computer.
-config <value> | Specifies the settings file containing command options.
[-n] <name> | Name of the target object.
-f <bin|bincirc|csv|tsv|sql> | Specifies the log format for the data collector.
-[-]u <user [password]> | Specifies the user to Run As. Entering a * for the password produces a prompt for the password. The password is not displayed when you type it at the password prompt.
-m <[start] [stop] [[start] [stop] [...]]> | Change to manual start or stop instead of a scheduled begin or end time.
-rf <[[hh:]mm:]ss> | Run the data collector for the specified period of time.
-b <M/d/yyyy h:mm:ss[AM|PM]> | Begin collecting data at the specified time.
-e <M/d/yyyy h:mm:ss[AM|PM]> | End data collection at the specified time.
-si <[[hh:]mm:]ss> | Specifies the sample interval for performance counter data collectors.
-o <path|dsn!log> | Specifies the output log file or the DSN and log set name in a SQL database.
-[-]r | Repeat the data collector daily at the specified begin and end times.
-[-]a | Append to an existing log file.
-[-]ow | Overwrite an existing log file.
-[-]v <nnnnnn|mmddhhmm> | Attach file versioning information to the end of the log file name.
-[-]rc <task> | Run the command specified each time the log is closed.
-[-]max <value> | Maximum log file size in MB or maximum number of records for SQL logs.
-[-]cnf <[[hh:]mm:]ss> | When time is specified, create a new file when the specified time has elapsed. When time is not specified, create a new file when the maximum size is exceeded.
-y | Answer yes to all questions without prompting.
-mods <path [path [...]]> | Specifies the list of modules to log API calls from.
-inapis <module!api [module!api [...]]> | Specifies the list of API calls to include in logging.
-exapis <module!api [module!api [...]]> | Specifies the list of API calls to exclude from logging.
-[-]ano | Log (-ano) API names only, or do not log only (--ano) API names.
-[-]recursive | Log (-recursive) or do not log (--recursive) APIs recursively beyond the first layer.
-exe <value> | Specifies the full path to an executable for API Tracing.

Remarks

Where [-] is listed, an extra - negates the option.

Examples

The following command creates an API trace counter called trace_notepad for the executable file c:\windows\notepad.exe and outputs the results to the file c:\notepad.etl.

Copy Code
logman create api trace_notepad -exe c:\windows\notepad.exe -o c:\notepad.etl

The following command creates an API trace counter called trace_notepad for the executable file c:\windows\notepad.exe collecting values produced by the module c:\windows\system32\advapi32.dll.

Copy Code
logman create api trace_notepad -exe c:\windows\notepad.exe -mods c:\windows\system32\advapi32.dll

The following command creates an API trace counter called trace_notepad for the executable file c:\windows\notepad.exe excluding the API call TlsGetValue produced by the module kernel32.dll.

Copy Code
logman create api trace_notepad -exe c:\windows\notepad.exe -exapis kernel32.dll!TlsGetValue

Additional references

Logman


logman query

Applies To: Windows Server 2008,Windows Vista

Query data collector or data collector set properties.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
logman query [providers|"Data Collector Set name"] [options]

Parameters

Parameter | Description
/? | Displays context-sensitive help.
-s <computer name> | Perform the command on the specified remote computer.
-config <value> | Specifies the settings file containing command options.
[-n] <name> | Name of the target object.
-ets | Send commands to Event Trace Sessions directly without saving or scheduling.

Examples

The following command lists all Data Collector Sets configured on the target system.

Copy Code
logman query

The following command lists the data collectors contained in the Data Collector Set named perf_log.

Copy Code
logman query "perf_log"

The following command lists all available providers of data collectors on the target system.

Copy Code
logman query providers

Additional references

Logman


logman start | stop

Applies To: Windows Vista,Windows Server 2008

Start a data collector and set the begin time to manual, or stop a data collector set and set the end time to manual.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
logman start <[-n] <name>> [options]
logman stop <[-n] <name>> [options]

Parameters

Parameter | Description
-? | Displays context-sensitive help.
-s <computer name> | Perform the command on the specified remote computer.
-config <value> | Specifies the settings file containing command options.
[-n] <name> | Name of the target object.
-ets | Send commands to Event Trace Sessions directly without saving or scheduling.
-as | Perform the requested operation asynchronously.

Examples

The following command starts the data collector perf_log on the remote computer server_1.

Copy Code
logman start perf_log -s server_1

Additional references

Logman


logman delete

Applies To: Windows Server 2008,Windows Vista

Delete an existing data collector.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
logman delete <[-n] <name>> [options]

Parameters

Parameter | Description
/? | Displays context-sensitive help.
-s <computer name> | Perform the command on the specified remote computer.
-config <value> | Specifies the settings file containing command options.
[-n] <name> | Name of the target data collector.
-ets | Send commands to Event Trace Sessions directly without saving or scheduling.
-[-]u <user [password]> | Specifies the user to Run As. Entering a * for the password produces a prompt for the password. The password is not displayed when you type it at the password prompt.

Examples

The following command deletes the data collector perf_log.

Copy Code
logman delete perf_log

Additional references

Logman


logman update

Applies To: Windows Server 2008,Windows Vista

Update an existing data collector.

Syntax

Copy Code
logman update <counter | trace | alert | cfg | api> <[-n] <name>> [options]

Parameters

Parameter | Description
logman update counter | Update a counter data collector.
logman update trace | Update a trace data collector.
logman update alert | Update an alert data collector.
logman update cfg | Update a configuration data collector.
logman update api | Update an API tracing data collector.

Additional references

Logman


logman update counter

Applies To: Windows Server 2008,Windows Vista

Update an existing counter data collector's properties.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
logman update counter <[-n] <name>> [options]

Parameters

Parameter | Description
/? | Displays context-sensitive help.
-s <computer name> | Perform the command on the specified remote computer.
-config <value> | Specifies the settings file containing command options.
[-n] <name> | Name of the target object.
-f <bin|bincirc|csv|tsv|sql> | Specifies the log format for the data collector.
-[-]u <user [password]> | Specifies the user to Run As. Entering a * for the password produces a prompt for the password. The password is not displayed when you type it at the password prompt.
-m <[start] [stop] [[start] [stop] [...]]> | Change to manual start or stop instead of a scheduled begin or end time.
-rf <[[hh:]mm:]ss> | Run the data collector for the specified period of time.
-b <M/d/yyyy h:mm:ss[AM|PM]> | Begin collecting data at the specified time.
-e <M/d/yyyy h:mm:ss[AM|PM]> | End data collection at the specified time.
-si <[[hh:]mm:]ss> | Specifies the sample interval for performance counter data collectors.
-o <path|dsn!log> | Specifies the output log file or the DSN and log set name in a SQL database.
-[-]r | Repeat the data collector daily at the specified begin and end times.
-[-]a | Append to an existing log file.
-[-]ow | Overwrite an existing log file.
-[-]v <nnnnnn|mmddhhmm> | Attach file versioning information to the end of the log file name.
-[-]rc <task> | Run the command specified each time the log is closed.
-[-]max <value> | Maximum log file size in MB or maximum number of records for SQL logs.
-[-]cnf <[[hh:]mm:]ss> | When time is specified, create a new file when the specified time has elapsed. When time is not specified, create a new file when the maximum size is exceeded.
-y | Answer yes to all questions without prompting.
-cf <filename> | Specifies the file listing performance counters to collect. The file should contain one performance counter name per line.
-c <path [path […]]> | Specifies performance counter(s) to collect.
-sc <value> | Specifies the maximum number of samples to collect with a performance counter data collector.

Remarks

Where [-] is listed, an extra - negates the option.

Examples

The following command updates the data collector perf_log, changing the sample interval to 10 and the log format to CSV and adding versioning to the log file name in the format mmddhhmm.

Copy Code
logman update perf_log -si 10 -f csv -v mmddhhmm

Additional references

Logman

logman create counter


logman update trace

Applies To: Windows Vista,Windows Server 2008

Update the properties of an existing event trace data collector.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
logman update trace <[-n] <name>> [options]

Parameters

Parameter Description

/?

Displays context-sensitive help.

-s <computer name>

Perform the command on the specified remote computer.

-config <value>

Specifies the settings file containing command options.

-ets

Send commands to Event Trace Sessions directly without saving or scheduling.

[-n] <name>

Name of the target object.

-f <bin|bincirc|csv|tsv|sql>

Specifies the log format for the data collector.

-[-]u <user [password]>

Specifies the user to Run As. Entering a * for the password produces a prompt for the password. The password is not displayed when you type it at the password prompt.

-m <[start] [stop] [[start] [stop] [...]]>

Change to manual start or stop instead of a scheduled begin or end time.

-rf <[[hh:]mm:]ss>

Run the data collector for the specified period of time.

-b <M/d/yyyy h:mm:ss[AM|PM]>

Begin collecting data at the specified time.

-e <M/d/yyyy h:mm:ss[AM|PM]>

End data collection at the specified time.

-o <path|dsn!log>

Specifies the output log file or the DSN and log set name in a SQL database.

-[-]r

Repeat the data collector daily at the specified begin and end times.

-[-]a

Append to an existing log file.

-[-]ow

Overwrite an existing log file.

-[-]v <nnnnnn|mmddhhmm>

Attach file versioning information to the end of the log file name.

-[-]rc <task>

Run the command specified each time the log is closed.

-[-]max <value>

Maximum log file size in MB or maximum number of records for SQL logs.

-[-]cnf <[[hh:]mm:]ss>

When time is specified, create a new file when the specified time has elapsed. When time is not specified, create a new file when the maximum size is exceeded.

-y

Answer yes to all questions without prompting.

-ct <perf|system|cycle>

Specifies the Event Trace Session clock type.

-ln <logger_name>

Specifies the logger name for Event Trace Sessions.

-ft <[[hh:]mm:]ss>

Specifies the Event Trace Session flush timer.

-[-]p <provider [flags [level]]>

Specifies a single Event Trace provider to enable.

-pf <filename>

Specifies a file listing multiple Event Trace providers to enable. The file should be a text file containing one provider per line.

-[-]rt

Run the Event Trace Session in real-time mode.

-[-]ul

Run the Event Trace Session in user mode.

-bs <value>

Specifies the Event Trace Session buffer size in kb.

-nb <min max>

Specifies the number of Event Trace Session buffers.

-mode <globalsequence|localsequence|pagedmemory>

Specifies the event trace session logger mode.

Globalsequence specifies that the event tracer add a sequence number to every event it receives irrespective of which trace session received the event.

Localsequence specifies that the event tracer add sequence numbers for events received at a specific trace session. When the localsequence option is used, duplicate sequence numbers can exist across all sessions but will be unique within each trace session.

Pagedmemory specifies that the event tracer use paged memory rather than the default non-paged memory pool for its internal buffer allocations.

Remarks

Where [-] is listed, an extra - negates the option.

Examples

The following command updates the existing data collector perf_log, changing the maximum log size to 10 MB, updating the log file format to CSV, and appending file versioning in the format mmddhhmm.

Copy Code
logman update perf_log -max 10 -f csv -v mmddhhmm

Additional references

Logman

logman create trace


logman update alert

Applies To: Windows Vista,Windows Server 2008

Update the properties of an existing alert data collector.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
logman update alert <[-n] <name>> [options]

Parameters

Parameter | Description
/? | Displays context-sensitive help.
-s <computer name> | Perform the command on the specified remote computer.
-config <value> | Specifies the settings file containing command options.
[-n] <name> | Name of the target object.
-[-]u <user [password]> | Specifies the user to Run As. Entering a * for the password produces a prompt for the password. The password is not displayed when you type it at the password prompt.
-m <[start] [stop] [[start] [stop] [...]]> | Change to manual start or stop instead of a scheduled begin or end time.
-rf <[[hh:]mm:]ss> | Run the data collector for the specified period of time.
-b <M/d/yyyy h:mm:ss[AM|PM]> | Begin collecting data at the specified time.
-e <M/d/yyyy h:mm:ss[AM|PM]> | End data collection at the specified time.
-si <[[hh:]mm:]ss> | Specifies the sample interval for performance counter data collectors.
-o <path|dsn!log> | Specifies the output log file or the DSN and log set name in a SQL database.
-[-]r | Repeat the data collector daily at the specified begin and end times.
-[-]a | Append to an existing log file.
-[-]ow | Overwrite an existing log file.
-[-]v <nnnnnn|mmddhhmm> | Attach file versioning information to the end of the log file name.
-[-]rc <task> | Run the command specified each time the log is closed.
-[-]max <value> | Maximum log file size in MB or maximum number of records for SQL logs.
-[-]cnf <[[hh:]mm:]ss> | When time is specified, create a new file when the specified time has elapsed. When time is not specified, create a new file when the maximum size is exceeded.
-y | Answer yes to all questions without prompting.
-cf <filename> | Specifies the file listing performance counters to collect. The file should contain one performance counter name per line.
-[-]el | Enables or disables Event Log reporting.
-th <threshold [threshold [...]]> | Specify counters and their threshold values for an alert.
-[-]rdcs <name> | Specifies the Data Collector Set to start when an alert fires.
-[-]tn <task> | Specifies the task to run when an alert fires.
-[-]targ <argument> | Specifies the task arguments to be used with the task specified using -tn.

Remarks

Where [-] is listed, an extra - negates the option.

Examples

The following example updates the existing data collector new_alert, setting the threshold value for the counter % Processor Time in the Processor(_Total) counter group to 40%.

Copy Code
logman update alert new_alert -th "\Processor(_Total)\% Processor Time>40"

Additional references

Logman

logman create alert


logman update cfg

Applies To: Windows Vista,Windows Server 2008

Update the properties of an existing configuration data collector.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
logman update cfg <[-n] <name>> [options]

Parameters

Parameter | Description
/? | Displays context-sensitive help.
-s <computer name> | Perform the command on the specified remote computer.
-config <value> | Specifies the settings file containing command options.
[-n] <name> | Name of the target object.
-f <bin|bincirc|csv|tsv|sql> | Specifies the log format for the data collector.
-[-]u <user [password]> | Specifies the user to Run As. Entering a * for the password produces a prompt for the password. The password is not displayed when you type it at the password prompt.
-m <[start] [stop] [[start] [stop] [...]]> | Change to manual start or stop instead of a scheduled begin or end time.
-rf <[[hh:]mm:]ss> | Run the data collector for the specified period of time.
-b <M/d/yyyy h:mm:ss[AM|PM]> | Begin collecting data at the specified time.
-e <M/d/yyyy h:mm:ss[AM|PM]> | End data collection at the specified time.
-si <[[hh:]mm:]ss> | Specifies the sample interval for performance counter data collectors.
-o <path|dsn!log> | Specifies the output log file or the DSN and log set name in a SQL database.
-[-]r | Repeat the data collector daily at the specified begin and end times.
-[-]a | Append to an existing log file.
-[-]ow | Overwrite an existing log file.
-[-]v <nnnnnn|mmddhhmm> | Attach file versioning information to the end of the log file name.
-[-]rc <task> | Run the command specified each time the log is closed.
-[-]max <value> | Maximum log file size in MB or maximum number of records for SQL logs.
-[-]cnf <[[hh:]mm:]ss> | When time is specified, create a new file when the specified time has elapsed. When time is not specified, create a new file when the maximum size is exceeded.
-y | Answer yes to all questions without prompting.
-[-]ni | Enable (-ni) or disable (--ni) network interface query.
-reg <path [path [...]]> | Specifies registry value(s) to collect.
-mgt <query [query [...]]> | Specifies WMI object(s) to collect using SQL query language.
-ftc <path [path [...]]> | Specifies the full path to the file(s) to collect.

Remarks

Where [-] is listed, an extra - negates the option.

Examples

The following command updates the existing configuration data collector cfg_log to collect the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVerion\.

Copy Code
logman update cfg cfg_log -reg "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVerion\"

Additional references

Logman

logman create cfg


logman update api

Applies To: Windows Server 2008,Windows Vista

Update the properties of an existing API tracing data collector.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
logman update api <[-n] <name>> [options]

Parameters

Parameter | Description
/? | Displays context-sensitive help.
-s <computer name> | Perform the command on the specified remote computer.
-config <value> | Specifies the settings file containing command options.
[-n] <name> | Name of the target object.
-f <bin|bincirc|csv|tsv|sql> | Specifies the log format for the data collector.
-[-]u <user [password]> | Specifies the user to Run As. Entering a * for the password produces a prompt for the password. The password is not displayed when you type it at the password prompt.
-m <[start] [stop] [[start] [stop] [...]]> | Change to manual start or stop instead of a scheduled begin or end time.
-rf <[[hh:]mm:]ss> | Run the data collector for the specified period of time.
-b <M/d/yyyy h:mm:ss[AM|PM]> | Begin collecting data at the specified time.
-e <M/d/yyyy h:mm:ss[AM|PM]> | End data collection at the specified time.
-si <[[hh:]mm:]ss> | Specifies the sample interval for performance counter data collectors.
-o <path|dsn!log> | Specifies the output log file or the DSN and log set name in a SQL database.
-[-]r | Repeat the data collector daily at the specified begin and end times.
-[-]a | Append to an existing log file.
-[-]ow | Overwrite an existing log file.
-[-]v <nnnnnn|mmddhhmm> | Attach file versioning information to the end of the log file name.
-[-]rc <task> | Run the command specified each time the log is closed.
-[-]max <value> | Maximum log file size in MB or maximum number of records for SQL logs.
-[-]cnf <[[hh:]mm:]ss> | When time is specified, create a new file when the specified time has elapsed. When time is not specified, create a new file when the maximum size is exceeded.
-y | Answer yes to all questions without prompting.
-mods <path [path [...]]> | Specifies the list of modules to log API calls from.
-inapis <module!api [module!api [...]]> | Specifies the list of API calls to include in logging.
-exapis <module!api [module!api [...]]> | Specifies the list of API calls to exclude from logging.
-[-]ano | Log (-ano) API names only, or do not log only (--ano) API names.
-[-]recursive | Log (-recursive) or do not log (--recursive) APIs recursively beyond the first layer.
-exe <value> | Specifies the full path to an executable for API Tracing.

Remarks

Where [-] is listed, an extra - negates the option.

Examples

The following command updates the existing API trace counter called trace_notepad for the executable file c:\windows\notepad.exe by excluding the API call TlsGetValue produced by the module kernel32.dll.

Copy Code
logman create api trace_notepad -exe c:\windows\notepad.exe -exapis kernel32.dll!TlsGetValue

Additional references

Logman

logman create api


logman import | export

Applies To: Windows Vista,Windows Server 2008

Import a Data Collector Set from an XML file, or export a Data Collector Set to an XML file.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
logman import <[-n] <name>> <-xml <name>> [options]
logman export <[-n] <name>> <-xml <name>> [options]

Parameters

Parameter | Description
-? | Displays context-sensitive help.
-s <computer name> | Perform the command on the specified remote computer.
-config <value> | Specifies the settings file containing command options.
[-n] <name> | Name of the target object.
-xml <name> | Name of the XML file to import or export.
-ets | Send commands to Event Trace Sessions directly without saving or scheduling.
-[-]u <user [password]> | User to Run As. Entering a * for the password produces a prompt for the password. The password is not displayed when you type it at the password prompt.
-y | Answer yes to all questions without prompting.

Examples

The following command imports the XML file c:\windows\perf_log.xml from the computer server_1 as a data collector set called perf_log.

Copy Code
logman import perf_log -s server_1 -xml "c:\windows\perf_log.xml"

Additional references

Logman


Logoff

Applies To: Windows Server 2008,Windows Vista

Logs off a user from a session on a terminal server and deletes the session from the server.

For examples of how to use this command, see Examples.

Syntax

Copy Code
logoff [<SessionName> | <SessionID>] [/server:<ServerName>] [/v]

Parameters

Parameter | Description
<SessionName> | Specifies the name of the session.
<SessionID> | Specifies the numeric ID which identifies the session to the server.
/server:<ServerName> | Specifies the terminal server that contains the session whose user you want to log off. If unspecified, the server on which you are currently active is used.
/v | Displays information about the actions being performed.
/? | Displays help at the command prompt.

Remarks

  • You can always log off from the session to which you are currently logged on. You must, however, have Full Control permission to log off users from other sessions.

  • Logging off a user from a session without warning can result in loss of data at the user's session. You should send a message to the user by using the msg command to warn the user before taking this action.

  • If <SessionID> or <SessionName> is not specified, logoff logs off the user from the current session. If you specify <SessionName>, it must be an active one.

  • When you log off a user, all processes end and the session is deleted from the server.

  • You cannot log off a user from the console session.

Examples

  • To log off a user from the current session, type:

    Copy Code
    logoff
  • To log off a user from a session by using the session's ID, for example session 12, type:

    Copy Code
    logoff 12
  • To log off a user from a session by using the name of the session and server, for example session TERM04 on Server1, type:

    Copy Code
    logoff TERM04 /server:Server1

Additional references

Command-Line Syntax Key

Terminal Services Command Reference


Lpq

Applies To: Windows Vista,Windows Server 2008

Displays the status of a print queue on a computer running Line Printer Daemon (LPD).

For examples of how this command can be used, see Examples.

Syntax

Copy Code
Lpq -S <ServerName> -P <PrinterName> [-l]

Parameters

Parameter | Description
-S <ServerName> | Specifies (by name or IP address) the computer or printer sharing device that hosts the LPD print queue with a status that you want to display. Required.
-P <PrinterName> | Specifies (by name) the printer for the print queue with a status that you want to display. Required.
-l | Specifies that you want to display details about the status of the print queue.
/? | Displays help at the command prompt.

Remarks

The -S and -P parameters are case sensitive and must be typed in upper-case letters.

Examples

This example shows how to display the status of the LaserPrinter1 printer queue on an LPD host at 10.0.0.45:

Copy Code
Lpq -S 10.0.0.45 -P LaserPrinter1

Additional references

Command-Line Syntax Key

Print Command Reference


Lpr

Applies To: Windows Server 2008,Windows Vista

Sends a file to a computer or printer sharing device running the Line Printer Daemon (LPD) service in preparation for printing.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
Lpr [-S <ServerName>] -P <PrinterName> [-C <BannerContent>] [-J <JobName>] [-o | "-o l"] [-x] [-d] <filename>

Parameters

Parameter | Description
-S <ServerName> | Specifies (by name or IP address) the computer or printer sharing device that hosts the LPD print queue with a status that you want to display. Required.
-P <PrinterName> | Specifies (by name) the printer for the print queue with a status that you want to display. Required.
-C <BannerContent> | Specifies the content to print on the banner page of the print job. If you do not include this parameter, the name of the computer from which the print job was sent appears on the banner page.
-J <JobName> | Specifies the print job name that will be printed on the banner page. If you do not include this parameter, the name of the file being printed appears on the banner page.
[-o| "-o l"] | Specifies the type of file that you want to print. The parameter -o specifies that you want to print a text file. The parameter "-o l" specifies that you want to print a binary file (for example, a PostScript file).
-d | Specifies that the data file must be sent before the control file. Use this parameter if your printer requires the data file to be sent first. For more information, see your printer documentation.
-x | Specifies that the Lpr command must be compatible with the Sun Microsystems operating system (referred to as SunOS) for releases up to and including 4.1.4_u1.
<FileName> | Specifies (by name) the file to be printed. Required.
/? | Displays help at the command prompt.

Remarks

  • To find the name of the printer, open the Printers folder.

  • The -S, -P, -C, and -J parameters are case sensitive and must be typed in upper-case letters.

Examples

This example shows how to print the "Document.txt" text file to the LaserPrinter1 printer queue on an LPD host at 10.0.0.45:

Copy Code
Lpr -S 10.0.0.45 -P LaserPrinter1 -o Document.txt

This example shows how to print the "PostScript_file.ps" Adobe PostScript file to the LaserPrinter1 printer queue on an LPD host at 10.0.0.45:

Copy Code
Lpr -S 10.0.0.45 -P LaserPrinter1 "-o l" PostScript_file.ps

Additional references

Command-Line Syntax Key

Print Command Reference


Macfile

Applies To: Windows Server 2003

Macfile is deprecated, and is not guaranteed to be supported in future releases of Windows.

This tool is included in Windows Server 2003. For more information see Macfile.


mapadmin

Applies To: Windows Vista,Windows Server 2008

You can use Mapadmin to manage User Name Mapping for Microsoft Services for Network File System.

Syntax

Copy Code
mapadmin [<computer>] [-u <user> [-p <password>]]
mapadmin [<computer>] [-u <user> [-p <password>]] {start | stop}
mapadmin [<computer>] [-u <user> [-p <password>]] config <option[...]>
mapadmin [<computer>] [-u <user> [-p <password>]] add -wu <WindowsUser> -uu <UNIXUser> [-setprimary]
mapadmin [<computer>] [-u <user> [-p <password>]] add -wg <WindowsGroup> -ug <UNIXGroup> [-setprimary]
mapadmin [<computer>] [-u <user> [-p <password>]] setprimary -wu <WindowsUser> [-uu <UNIXUser>]
mapadmin [<computer>] [-u <user> [-p <password>]] setprimary -wg <WindowsGroup> [-ug <UNIXGroup>]
mapadmin [<computer>] [-u <user> [-p <password>]] delete <option[...]>
mapadmin [<computer>] [-u <user> [-p <password>]] list <option[...]>
mapadmin [<computer>] [-u <user> [-p <password>]] backup <filename>
mapadmin [<computer>] [-u <user> [-p <password>]] restore <filename>
mapadmin [<computer>] [-u <user> [-p <password>]] adddomainmap -d <WindowsDomain> {-y <<NISdomain>> | -f <path>}
mapadmin [<computer>] [-u <user> [-p <password>]] removedomainmap -d <WindowsDomain> -y <<NISdomain>>
mapadmin [<computer>] [-u <user> [-p <password>]] removedomainmap -all
mapadmin [<computer>] [-u <user> [-p <password>]] listdomainmaps

Description

The mapadmin command-line utility administers User Name Mapping on the local or remote computer running Microsoft Services for Network File System. If you are logged on with an account that does not have administrative credentials, you can specify a user name and password of an account that does.

In addition to specific command arguments, mapadmin accepts the following arguments and options:

<computer>

Specifies the remote computer running the User Name Mapping service that you want to administer. You can specify the computer using a Windows Internet Name Service (WINS) name or a Domain Name System (DNS) name, or by Internet Protocol (IP) address.

-u <user>

Specifies the user name of the user whose credentials are to be used. It might be necessary to add the domain name to the user name in the form domain\user name.

-p <password>

Specifies the password of the user. If you specify the -u option but omit the -p option, you are prompted for the user's password.

The specific action that mapadmin performs depends on the command argument you specify:

Parameters

start

Starts the User Name Mapping service.

stop

Stops the User Name Mapping service.

config

Specifies general settings for User Name Mapping. The following options are available with this command argument:

-r <dddd>:<hh>:<mm> - Specifies the refresh interval for updating from the Windows and NIS databases in days, hours, and minutes. The minimum interval is 5 minutes.

-i {yes | no} - Turns simple mapping on (yes) or off (no). By default, simple mapping is on.

add - Creates a new mapping for a user or group. The following options are available with this command argument:

Option | Definition
-wu <name> | Specifies the name of the Windows user for which a new mapping is being created.
-uu <name> | Specifies the name of the UNIX user for which a new mapping is being created.
-wg <group> | Specifies the name of the Windows group for which a new mapping is being created.
-ug <group> | Specifies the name of the UNIX group for which a new mapping is being created.
-setprimary | Specifies that the new mapping is the primary mapping.

setprimary - Specifies which mapping is the primary mapping for a UNIX user or group with multiple mappings. The following options are available with this command argument:

Option | Definition
-wu <name> | Specifies the Windows user of the primary mapping. If more than one mapping for the user exists, use the -uu option to specify the primary mapping.
-uu <name> | Specifies the UNIX user of the primary mapping.
-wg <group> | Specifies the Windows group of the primary mapping. If more than one mapping for the group exists, use the -ug option to specify the primary mapping.
-ug <group> | Specifies the UNIX group of the primary mapping.

delete - Removes the mapping for a user or group. The following options are available for this command argument:

Option | Definition
-wu <user> | The Windows user for which the mapping will be deleted, specified as <WindowsDomain>\<User Name>. You must specify either the -wu or the -uu option, or both. If you specify both options, the particular mapping identified by the two options will be deleted. If you specify only the -wu option, all mappings for the specified user will be deleted.
-wg <group> | The Windows group for which the mapping will be deleted, specified as <WindowsDomain>\<groupname>. You must specify either the -wg or the -ug option, or both. If you specify both options, the particular mapping identified by the two options will be deleted. If you specify only the -wg option, all mappings for the specified group will be deleted.
-uu <user> | The UNIX user for whom the mapping will be deleted, specified as <User Name>. You must specify either the -wu or the -uu option, or both. If you specify both options, the particular mapping identified by the two options will be deleted. If you specify only the -uu option, all mappings for the specified user will be deleted.
-ug <group> | The UNIX group for which the mapping will be deleted, specified as <groupname>. You must specify either the -wg or the -ug option, or both. If you specify both options, the particular mapping identified by the two options will be deleted. If you specify only the -ug option, all mappings for the specified group will be deleted.

list - Displays information about user and group mappings. The following options are available with this command argument:

Option | Definition
-all | Lists both simple and advanced mappings for users and groups.
-simple | Lists all simple mapped users and groups.
-advanced | Lists all advanced mapped users and groups. Maps are listed in the order in which they are evaluated. Primary maps, marked with an asterisk (*), are listed first, followed by secondary maps, which are marked with a carat (^).
-wu <name> | Lists the mapping for a specified Windows user.
-wg <group> | Lists the mapping for a Windows group.
-uu <name> | Lists the mapping for a UNIX user.
-ug <group> | Lists the mapping for a UNIX group.

backup - Saves User Name Mapping configuration and mapping data to the file specified by <filename>.

restore - Replaces configuration and mapping data with data from the file (specified by <filename>) that was created using the backup command argument.

adddomainmap - Adds a simple map between a Windows domain and an NIS domain or password and group files. The following options are available for this command argument:

Option | Definition
-d <WindowsDomain> | Specifies the Windows domain to be mapped.
-y <NISdomain> | Specifies the NIS domain to be mapped. -n <nisServer> Specifies the NIS server for the NIS domain specified with the -y option.
-f <path> | Specifies the fully qualified path of directory containing the password and group files to be mapped. The files must be located on the computer being managed, and you cannot use mapadmin to manage a remote computer to set up maps based on password and group files.

removedomainmap - Removes a simple map between a Windows domain and an NIS domain. The following options and argument are available for this command argument:

Option | Definition
-d <WindowsDomain> | Specifies the Windows domain of the map to be removed.
-y <NISdomain> | Specifies the NIS domain of the map to be removed.
-all | Specifies that all simple maps between Windows and NIS domains are to be removed. This will also remove any simple map between a Windows domain and password and group files.

listdomainmaps - Lists the Windows domains that are mapped to NIS domains or password and group files.

Notes

  • If you do not specify a command argument, mapadmin displays the current settings for User Name Mapping.

  • For all options that specify a user or group name, the following formats can be used:

  • For Windows users, use the form <domain>\<user name>, \\<computer>\<user name>, \<computer>\<user name>, or <computer>\<user name>

  • For Windows groups, use the form <domain>\<<groupname>>, \\<computer>\<<groupname>>, \<computer>\<<groupname>>, or <computer>\<<groupname>>

  • For UNIX users, use the form <NISdomain>\<user name>, <user name>@<NISdomain>, user <name>@PCNFS, or PCNFS\<user name>

  • For UNIX groups, use the form <NISdomain>\<groupname>, <groupname>@<NISdomain>, <groupname>@PCNFS, or PCNFS\<groupname>

Additional references

Command-Line Syntax Key


Md

Applies To: Windows Server 2008,Windows Vista

Creates a directory or subdirectory.

Note
This command is the same as the mkdir command.

For examples of how to use this command, see Examples.

Syntax

Copy Code
md [<Drive>:]<Path>
mkdir [<Drive>:]<Path>

Parameters

Parameter | Description
<Drive>: | Specifies the drive on which you want to create the new directory.
<Path> | Required. Specifies the name and location of the new directory. The maximum length of any single path is determined by the file system.
/? | Displays help at the command prompt.

Remarks

Command extensions, which are enabled by default, allow you to use a single md command to create intermediate directories in a specified path.

Examples

To create a directory named Directory1 within the current directory, type:

Copy Code
md Directory1

To create the directory tree Taxes\Property\Current within the root directory, with command extensions enabled, type:

Copy Code
md \Taxes\Property\Current

To create the directory tree Taxes\Property\Current within the root directory as in the previous example, but with command extensions disabled, type the following sequence of commands:

Copy Code
md \Taxes
cd \Taxes
md Property
cd Property
md Current

Additional references

Command-Line Syntax Key

Cmd


Mkdir

Applies To: Windows Server 2008,Windows Vista

This command is the same as the md command. See Md for syntax and parameters.


Mklink

Applies To: Windows Vista,Windows Server 2008

Creates a symbolic link.

For examples of how to use this command, see Examples.

Syntax

Copy Code
mklink [[/d] | [/h] | [/j]] <Link> <Target>

Parameters

Parameter | Description
/d | Creates a directory symbolic link. By default, mklink creates a file symbolic link.
/h | Creates a hard link instead of a symbolic link.
/j | Creates a Directory Junction.
<Link> | Specifies the name of the symbolic link that is being created.
<Target> | Specifies the path (relative or absolute) that the new symbolic link refers to.
/? | Displays help at the command prompt.

Examples

To create a symbolic link named MyDocs from the root directory to the \Users\User1\Documents directory, type:

Copy Code
mklink /d \MyDocs \Users\User1\Documents


Mode

Applies To: Windows Server 2008,Windows Vista

Displays system status, changes system settings, or reconfigures ports or devices. If used without parameters, mode displays all the controllable attributes of the console and the available COM devices.

You can use mode to perform the following tasks—each task uses a different syntax:

  • To configure a serial communications port

  • To display the status of all devices or of a single device

  • To redirect output from a parallel port to a serial communications port

  • To select, refresh, or display the numbers of the code pages for the console

  • To change the size of the command prompt screen buffer

  • To set the keyboard typematic rate

To configure a serial communications port

Syntax
Copy Code
mode com<M>[:] [baud=<B>] [parity=<P>] [data=<D>] [stop=<S>] [to={on|off}] [xon={on|off}] [odsr={on|off}] [octs={on|off}] [dtr={on|off|hs}] [rts={on|off|hs|tg}] [idsr={on|off}]
Parameters

Parameter Description

Com<M>[:]

Specifies the number of the async Prncnfg.vbshronous communications port.

baud=<B>

Specifies the transmission rate in bits per second. The following table lists valid abbreviations for B and their related rates.

  • 11 = 110 baud

  • 15 = 150 baud

  • 30 = 300 baud

  • 60 = 600 baud

  • 12 = 1200 baud

  • 24 = 2400 baud

  • 48 = 4800 baud

  • 96 = 9600 baud

  • 19 = 19,200 baud

parity=<P>

Specifies how the system uses the parity bit to check for transmission errors. The following table lists valid values for P. The default value is e. Not all computers support the values m and s.

  • n = none

  • e = even

  • o = odd

  • m = mark

  • s = space

data=<D>

Specifies the number of data bits in a character. Valid values for d are in the range 5 through 8. The default value is 7. Not all computers support the values 5 and 6.

stop=<S>

Specifies the number of stop bits that define the end of a character: 1, 1.5, or 2. If the baud rate is 110, the default value is 2. Otherwise, the default value is 1. Not all computers support the value 1.5.

to={on | off}

Specifies whether infinite time-out processing is on or off. The default is off.

xon={on | off}

Specifies whether the xon or xoff protocol for data-flow control is on or off.

odsr={on | off}

Specifies whether output handshaking that uses the Data Set Ready (DSR) circuit is on or off.

octs={on | off}

Specifies whether output handshaking that uses the Clear To Send (CTS) circuit is on or off.

dtr={on | off | hs}

Specifies whether the Data Terminal Ready (DTR) circuit is on or off or set to handshake.

rts={on | off | hs | tg}

Specifies whether the Request To Send (RTS) circuit is set to on, off, handshake, or toggle.

idsr={on | off}

Specifies whether the DSR circuit sensitivity is on or off.

/?

Displays help at the command prompt.

To display the status of all devices or of a single device

Syntax
Copy Code
mode [<Device>] [/status]
Parameters

Parameter | Description
<Device> | Specifies the name of the device for which you want to display the status.
/status | Requests the status of any redirected parallel printers. You can abbreviate the /status command-line option as /sta.
/? | Displays help at the command prompt.
Remarks

If used without parameters, mode displays the status of all devices that are installed on your system.

To redirect output from a parallel port to a serial communications port

Syntax
Copy Code
mode lpt<N>[:]=com<M>[:]
Parameters

Parameter | Description
lpt<N>[:] | Required. Specifies the parallel port. Valid values for N are in the range 1 through 3.
com<M>[:] | Required. Specifies the serial port. Valid values for M are in the range 1 through 4.
/? | Displays help at the command prompt.
Remarks

You must be a member of the Administrators group to redirect printing.

Examples

To set up your system so that it sends parallel printer output to a serial printer, you must use the mode command twice. The first time, use mode to configure the serial port. The second time, use mode to redirect parallel printer output to the serial port you specified in the first mode command.

For example, if your serial printer operates at 4800 baud with even parity, and it is connected to the COM1 port (the first serial connection on your computer), type:

Copy Code
mode com1 48,e,,,b
mode lpt1=com1

If you redirect parallel printer output from LPT1 to COM1, but then you decide that you want to print a file by using LPT1, type the following command before you print the file:

Copy Code
mode lpt1

This command prevents the redirection the file from LPT1 to COM1.

To select, refresh, or display the numbers of the code pages for the console

Syntax
Copy Code
mode <Device> codepage select=<YYY>
mode <Device> codepage [/status]
Parameters

Parameter | Description
<Device> | Required. Specifies the device for which you want to select a code page. CON is the only valid name for a device.
codepage select= | Required. Specifies which code page to use with the specified device. You can abbreviate codepage select as cp sel.
<YYY> | Required. Specifies the number of the code page to select. The following list shows each code page that is supported and its country/region or language. 437: United States 850: Multilingual (Latin I) 852: Slavic (Latin II) 855: Cyrillic (Russian) 857: Turkish 860: Portuguese 861: Icelandic 863: Canadian-French 865: Nordic 866: Russian 869: Modern Greek
codepage | Required. Displays the numbers of the code pages (if any) that are selected for the specified device.
/status | Displays the numbers of the current code pages selected for the specified device. You can abbreviate /status to /sta. Whether or not you specify /status, mode codepage displays the numbers of the code pages that are selected for the specified device.
/? | Displays help at the command prompt.

To change the size of the command prompt screen buffer

Syntax
Copy Code
mode con[:] [cols=<C>] [lines=<N>]
Parameters

Parameter | Description
con[:] | Required. Indicates that the change applies to the Command Prompt window.
cols=<C> | Specifies the number of columns in the command prompt screen buffer.
lines=<N> | Specifies the number of lines in the command prompt screen buffer.
/? | Displays help at the command prompt.

To set the keyboard typematic rate

Syntax
Copy Code
mode con[:] [rate=<R> delay=<D>]
Parameters

Parameter | Description
con[:] | Required. Refers to the keyboard.
rate=<R> | Specifies the rate at which a character is repeated on the screen when you hold down a key.
delay=<D> | Specifies the amount of time that will elapse after you press and hold down a key before the character output repeats.
/? | Displays help at the command prompt.
Remarks
  • The typematic rate is the rate at which a character repeats when you hold down the key for that character. The typematic rate has two components, the rate and the delay. Some keyboards do not recognize this command.

  • Using rate=R

    Valid values are in the range 1 through 32. These values are equal to approximately 2 to 30 characters per second. The default value is 20 for IBM AT-compatible keyboards, and 21 for IBM PS/2-compatible keyboards. If you set the rate, you must also set the delay.

  • Using delay=D

    Valid values for D are 1, 2, 3, and 4 (representing 0.25, 0.50, 0.75, and 1 second). The default value is 2. If you set the delay, you must also set the rate.

Additional references

Command-Line Syntax Key


More

Applies To: Windows Vista,Windows Server 2008

Displays one screen of output at a time.

For examples of how to use this command, see Examples.

Syntax

Copy Code
<Command> | more [/c] [/p] [/s] [/t<N>] [+<N>]
more [[/c] [/p] [/s] [/t<N>] [+<N>]] < [<Drive>:][<Path>]<FileName>
more [/c] [/p] [/s] [/t<N>] [+<N>] [<Files>]

Parameters

Parameter | Description
<Command> | Specifies a command for which you want to display the output.
/c | Clears the screen before displaying a page.
/p | Expands form-feed characters.
/s | Displays multiple blank lines as a single blank line.
/t<N> | Displays tabs as the number of spaces specified by N.
+<N> | Displays the first file beginning at the line specified by N.
[<Drive>:] [<Path>]<FileName> | Specifies the location and name of a file to display.
<Files> | Specifies a list of files to display. Separate file names with a space.
/? | Displays help at the command prompt.

Remarks

  • The following subcommands are accepted at the more prompt (-- More --).

    Key Action

    SPACEBAR

    Displays the next page.

    ENTER

    Displays the next line.

    f

    Displays the next file.

    q

    Quits the more command.

    =

    Shows the line number.

    p <N>

    Displays the next N lines.

    s <N>

    Skips the next N lines.

    ?

    Shows the commands that are available at the more prompt.

  • When using the redirection character (<), you must specify a file name as the source. When using the pipe (|), you can use such commands as dir, sort, and type.

  • The more command, with different parameters, is available from the Recovery Console.

Examples

To view the first screen of information of a file named Clients.new, type one of the following commands:

Copy Code
more < clients.new
type clients.new | more

The more command displays the first screen of information from Clients.new, and then displays the following prompt:

Copy Code
-- More --

You can then press the SPACEBAR to see the next screen of information.

To clear the screen and remove all extra blank lines before displaying the file Clients.new, type one of the following commands:

Copy Code
more /c /s < clients.new
type clients.new | more /c /s

The more command displays the first screen of information from Clients.new, and then displays the following prompt:

Copy Code
-- More --

Using more subcommands

The following examples can be used at the more prompt (-- More --).

  • To display the file one line at a time, press ENTER at the more prompt.

  • To display the next screen, press the SPACEBAR at the more prompt.

  • To display the next file listed on the command line, type f at the more prompt.

  • To show the available commands, type ? at the more prompt.

  • To quit more, type q at the more prompt.

  • To display the current line number, type = at the more prompt. The current line number is added to the more prompt as follows:

    Copy Code
    -- More [Line: 24] --
  • To display a specific number of lines, type p at the more prompt. More prompts you for the number of lines to display as follows:

    Copy Code
    -- More -- Lines:
    Type the number of lines to display, and then press ENTER. More displays the specified number of lines.

  • To skip a specific number of lines, type s at the more prompt. More prompts you for the number of lines to skip as follows:

    Copy Code
    -- More -- Lines:
    Type the number of lines to skip, and then press ENTER. More skips the specified number of lines and displays the next screen of information.

Additional references

Command-Line Syntax Key


Mount
See Also

Applies To: Windows Server 2008,Windows Vista

You can use mount to mount Network File System (NFS) network shares.

Syntax

mount [-o <Option>[...]] [-u:<UserName>] [-p:{<Password> | *}] {\\<ComputerName>\<ShareName> | <ComputerName>:/<ShareName>} {<DeviceName> | *}

Description

The mount command-line utility mounts the file system identified by ShareName exported by the NFS server identified by ComputerName and associates it with the drive letter specified by DeviceName or, if an asterisk (*) is used, by the first available driver letter. Users can then access the exported file system as though it were a drive on the local computer. When used without options or arguments, mount displays information about all mounted NFS file systems.

The mount utility is available only if Client for NFS is installed.

The following options and arguments can be used with the mount utility.

Term Definition

-o rsize=<buffersize>

Sets the size in kilobytes of the read buffer. Acceptable values are 1, 2, 4, 8, 16, and 32; the default is 32 KB.

-o wsize=<buffersize>

Sets the size in kilobytes of the write buffer. Acceptable values are 1, 2, 4, 8, 16, and 32; the default is 32 KB.

-o timeout=<seconds>

Sets the time-out value in seconds for a remote procedure call (RPC). Acceptable values are 0.8, 0.9, and any integer in the range 1-60; the default is 0.8.

-o retry=<number>

Sets the number of retries for a soft mount. Acceptable values are integers in the range 1-10; the default is 1.

-o mtype={soft | hard}

Sets the mount type (default is soft). Regardless of the mount type, mount will return if it cannot immediately mount the share. Once the share has been successfully mounted, however, if the mount type is hard, Client for NFS will continue to try to access the share until it is successful. As a result, if the NFS server is unavailable, any Windows program trying to access the share will appear to stop responding, or "hang," if the mount type is hard.

-o anon

Mounts as an anonymous user.

-o nolock

Disables locking (default is enabled).

-o casesensitive

Forces file lookups on the server to be case sensitive.

-o fileaccess=<mode>

Specifies the default permission mode of new files created on the NFS share. Specify mode as a three-digit number in the form ogw, where o, g, and w are each a digit representing the access granted the file's owner, group, and the world, respectively. The digits must be in the range 0-7 with the following meaning:

  • 0: No access

  • 1: x (execute access)

  • 2: w (write access)

  • 3: wx

  • 4: r (read access)

  • 5: rx

  • 6: rw

  • 7: rwx

-o lang={euc-jp|euc-tw|euc-kr|shift-jis|big5|ksc5601|gb2312-80|ansi}

Specifies the default encoding used for file and directory names and, if used, must be set to one of the following:

  • ansi

  • big5 (Chinese)

  • euc-jp (Japanese)

  • euc-kr (Korean)

  • euc-tw (Chinese)

  • gb2312-80 (Simplified Chinese)

  • ksc5601 (Korean)

  • shift-jis (Japanese)

If this option is set to ansi on systems configured for non-English locales, the encoding scheme is set to the default encoding scheme for the locale. The following are the default encoding schemes for the indicated locales:

  • Japanese: SHIFT-JIS

  • Korean: KS_C_5601-1987

  • Simplified Chinese: GB2312-80

  • Traditional Chinese: BIG5

-u:<UserName>

Specifies the user name to use for mounting the share. If username is not preceded by a backslash (\), it is treated as a UNIX user name.

-p:<Password>

The password to use for mounting the share. If you use an asterisk (*), you will be prompted for the password.

Note
If you make a persistent connection with mount, you must use Umount to delete the connection. Neither the net use command nor Microsoft Windows Explorer will delete these connections.

See Also

Concepts

Umount


Mountvol

Applies To: Windows Vista,Windows Server 2008

Creates, deletes, or lists a volume mount point.

For examples of how to use this command see Examples.

Syntax

Copy Code
mountvol [<Drive>:]<Path VolumeName>
mountvol [<Drive>:]<Path> /d
mountvol [<Drive>:]<Path> /l
mountvol [<Drive>:]<Path> /p
mountvol /r
mountvol [/n | /e]
mountvol <Drive>: /s

Parameters

Parameter Description

[<Drive>:]<Path>

Specifies the existing NTFS directory where the mount point will reside.

<VolumeName>

Specifies the volume name that is the target of the mount point. The volume name uses the following syntax, where GUID is a globally unique identifier:

Copy Code
\\?\Volume\{GUID}\

The brackets { } are required.

/d

Removes the volume mount point from the specified folder.

/l

Lists the mounted volume name for the specified folder.

/p

Removes the volume mount point from the specified directory, dismounts the basic volume, and takes the basic volume offline, making it unmountable. If other processes are using the volume, mountvol closes any open handles before dismounting the volume.

/r

Removes volume mount point directories and registry settings for volumes that are no longer in the system, preventing them from being automatically mounted and given their former volume mount point(s) when added back to the system.

/n

Disables automatic mounting of new basic volumes. New volumes are not mounted automatically when added to the system.

/e

Re-enables automatic mounting of new basic volumes.

/s

Mounts the EFI system partition on the specified drive. Available on Itanium-based computers only.

/?

Displays help at the command prompt.

Remarks

  • Mountvol allows you to link volumes without requiring a drive letter.

  • Volumes that are dismounted by using /p are listed in the volumes list as "NOT MOUNTED UNTIL A VOLUME MOUNT POINT IS CREATED." If the volume has more than one mount point, use /d to remove the additional mount points before using /p. You can make the basic volume mountable again by assigning a volume mount point.

  • If you need to expand your volume space without reformatting or replacing a hard drive, you can add a mount path to another volume. The benefit of using one volume with several mount paths is that you can access all local volumes by using a single drive letter (such as C:). You do not need to remember which volume corresponds to which drive letter—although you can still mount local volumes and assign them drive letters.

Examples

To create a mount point, type:

Copy Code
mountvol \sysmount \\?\Volume\{2eca078d-5cbc-43d3-aff8-7e8511f60d0e}\

Additional references

Command-Line Syntax Key


Move

Applies To: Windows Server 2008,Windows Vista

Moves one or more files from one directory to another directory.

For examples of how to use this command, see Examples.

Syntax

Copy Code
move [{/y | /-y}] [<Source>] [<Target>]

Parameters

Parameter | Description
/y | Suppresses prompting to confirm that you want to overwrite an existing destination file.
/-y | Causes prompting to confirm that you want to overwrite an existing destination file.
<Source> | Specifies the path and name of the file or files to move. If you want to move or rename a directory, Source should be the current directory path and name.
<Target> | Specifies the path and name to move files to. If you want to move or rename a directory, Target should be the desired directory path and name.
/? | Displays help at the command prompt.

Remarks

  • The /y command-line option might be preset in the COPYCMD environment variable. You can override this with /-y on the command line. The default is to prompt before overwriting files unless the copy command is run from within a batch script.

  • Moving encrypted files to a volume that does not support Encrypting File System (EFS) results in an error. Decrypt the files first or move the files to a volume that supports EFS.

Examples

To move all files with the .xls extension from the \Data directory to the \Second_Q\Reports directory, type:

Copy Code
move \data\*.xls \second_q\reports\

Additional references

Command-Line Syntax Key


Msg

Applies To: Windows Vista,Windows Server 2008

Sends a message to a user on a terminal server.

For examples of how to use this command, see Examples.

Syntax

Copy Code
msg {<UserName> | <SessionName> | <SessionID>| @<FileName> | *} [/server:<ServerName>] [/time:<Seconds>] [/v] [/w] [<Message>]

Parameters

Parameter | Description
<UserName> | Specifies the name of the user that you want to receive the message.
<SessionName> | Specifies the name of the session that you want to receive the message.
<SessionID> | Specifies the numeric ID of the session whose user you want to receive a message.
@<FileName> | Identifies a file containing a list of user names, session names, and session IDs that you want to receive the message.
* | Sends the message to all user names on the system.
/server:<ServerName> | Specifies the terminal server whose session or user you want to receive the message. If unspecified, /server uses the server to which you are currently logged on.
/time:<Seconds> | Specifies the amount of time that the message you sent is displayed on the user's screen. After the time limit is reached, the message disappears. If no time limit is set, the message remains on the user's screen until the user sees the message and clicks OK.
/v | Displays information about the actions being performed.
/w | Waits for an acknowledgement from the user that the message has been received. Use this parameter with /time:<Seconds> to avoid a possible long delay if the user does not immediately respond. Using this parameter with /v is also helpful.
<Message> | Specifies the text of the message that you want to send. If no message is specified, you will be prompted to enter a message. To send a message that is contained in a file, type the less than (<) symbol followed by the file name.
/? | Displays help at the command prompt.

Remarks

  • If you do not specify a user or a session, msg displays an error message. When specifying a session, it must be an active one.

  • The user must have Message special access permission to send a message.

Examples

  • To send the message entitled "Let's meet at 1PM today" to all sessions for User1, type:

    Copy Code
    msg User1 Let's meet at 1PM today
  • To send the same message to session MODEM02, type:

    Copy Code
    msg modem02 Let's meet at 1PM today
  • To send the message to session 12, type:

    Copy Code
    msg 12 Let's meet at 1PM today
  • To send the message to all sessions contained in the file USERLIST, type:

    Copy Code
    msg @userlist Let's meet at 1PM today
  • To send the message to all users who are logged on, type:

    Copy Code
    msg * Let's meet at 1PM today
  • To send the message to all users, with an acknowledgment time-out (for example, 10 seconds), type:

    Copy Code
    msg * /TIME:10 Let's meet at 1PM today

Additional references

Command-Line Syntax Key

Terminal Services Command Reference


Msiexec

Applies To: Windows Server 2008

Msiexec

Provides the means to install, modify, and perform operations on Windows Installer from the command line.

For the syntax and examples of how to use this command, see Msiexec.


Mstsc

Applies To: Windows Server 2008,Windows Vista

Creates connections to terminal servers or other remote computers, edits an existing Remote Desktop Connection (.rdp) configuration file, and migrates legacy connection files that were created with Client Connection Manager to new .rdp connection files.

For examples of how to use this command, see Examples.

Syntax

Copy Code
mstsc.exe [<Connection File>] [/v:<Server>[:<Port>]] [/admin] [/f] [/w:<Width> /h:<Height>] [/public] [/span]

mstsc.exe /edit <Connection File>

mstsc.exe /migrate

Parameters

Parameter | Description
<Connection File> | Specifies the name of an .rdp file for the connection.
/v:<Server[:<Port>] | Specifies the remote computer and, optionally, the port number to which you want to connect.
/admin | Connects you to a session for administering the server.
/f | Starts Remote Desktop Connection in full-screen mode.
/w:<Width> | Specifies the width of the Remote Desktop window.
/h:<Height> | Specifies the height of the Remote Desktop window.
/public | Runs Remote Desktop in public mode. In public mode, passwords and bitmaps are not cached.
/span | Matches the Remote Desktop width and height with the local virtual desktop, spanning across multiple monitors if necessary.
/edit <Connection File> | Opens the specified .rdp file for editing.
/migrate | Migrates legacy connection files that were created with Client Connection Manager to new .rdp connection files.
/? | Displays help at the command prompt.

Remarks

  • Default.rdp is stored for each user as a hidden file in the user's Documents folder. User created .rdp files are saved by default in the user's Documents folder but can be saved anywhere.

  • To span across monitors, the monitors must use the same resolution and must be aligned horizontally (that is, side by side). There is currently no support for spanning multiple monitors vertically on the client system.

Examples

  • To connect to a session in full-screen mode, type:

    Copy Code
    mstsc /f
  • To open a file called filename.rdp for editing, type:

    Copy Code
    mstsc /edit filename.rdp

Additional references

Command-Line Syntax Key

Terminal Services Command Reference


Nbtstat
See Also

Applies To: Windows Server 2008,Windows Server 2008 R2

Nbtstat

Displays NetBIOS over TCP/IP (NetBT) protocol statistics, NetBIOS name tables for both the local computer and remote computers, and the NetBIOS name cache. Nbtstat allows a refresh of the NetBIOS name cache and the names registered with Windows Internet Name Service (WINS). Used without parameters, nbtstat displays help.
Syntax

nbtstat[-a RemoteName] [-A IPAddress] [-c] [-n] [-r] [-R] [-RR] [-s] [-S] [Interval]

Parameters
-a RemoteName

Displays the NetBIOS name table of a remote computer, where RemoteName is the NetBIOS computer name of the remote computer. The NetBIOS name table is the list of NetBIOS names that corresponds to NetBIOS applications running on that computer.

-A IPAddress

Displays the NetBIOS name table of a remote computer, specified by the IP address (in dotted decimal notation) of the remote computer.

-c

Displays the contents of the NetBIOS name cache, the table of NetBIOS names and their resolved IP addresses.

-n

Displays the NetBIOS name table of the local computer. The status of Registered indicates that the name is registered either by broadcast or with a WINS server.

-r

Displays NetBIOS name resolution statistics. On a computer running Windows XP or a Windows Server 2003 operating system that is configured to use WINS, this parameter returns the number of names that have been resolved and registered using broadcast and WINS.

-R

Purges the contents of the NetBIOS name cache and then reloads the #PRE-tagged entries from the Lmhosts file.

-RR

Releases and then refreshes NetBIOS names for the local computer that is registered with WINS servers.

-s

Displays NetBIOS client and server sessions, attempting to convert the destination IP address to a name.

-S

Displays NetBIOS client and server sessions, listing the remote computers by destination IP address only.

Interval

Redisplays selected statistics, pausing the number of seconds specified in Interval between each display. Press CTRL+C to stop redisplaying statistics. If this parameter is omitted, nbtstat prints the current configuration information only once.

/?

Displays help at the command prompt.

Remarks
  • Nbtstat command-line parameters are case-sensitive.

  • The following table describes the column headings that are generated by nbtstat.

    Heading Description

    Input

    The number of bytes received.

    Output

    The number of bytes sent.

    In/Out

    Whether the connection is from the computer (outbound) or from another computer to the local computer (inbound).

    Life

    The remaining time that a name table cache entry will live before it is purged.

    Local Name

    The local NetBIOS name associated with the connection.

    Remote Host

    The name or IP address associated with the remote computer.

    <03>

    The last byte of a NetBIOS name converted to hexadecimal. Each NetBIOS name is 16 characters long. This last byte often has special significance because the same name might be present several times on a computer, differing only in the last byte. For example, <20> is a space in ASCII text.

    Type

    The type of name. A name can either be a unique name or a group name.

    Status

    Whether the NetBIOS service on the remote computer is running (Registered) or a duplicate computer name has registered the same service (Conflict).

    State

    The state of NetBIOS connections.
  • The following table describes the possible NetBIOS connection states.

    State Description

    Connected

    A session has been established.

    Associated

    A connection endpoint has been created and associated with an IP address.

    Listening

    This endpoint is available for an inbound connection.

    Idle

    This endpoint has been opened but cannot receive connections.

    Connecting

    A session is in the connecting phase and the name-to-IP address mapping of the destination is being resolved.

    Accepting

    An inbound session is currently being accepted and will be connected shortly.

    Reconnecting

    A session is trying to reconnect (it failed to connect on the first attempt).

    Outbound

    A session is in the connecting phase and the TCP connection is currently being created.

    Inbound

    An inbound session is in the connecting phase.

    Disconnecting

    A session is in the process of disconnecting.

    Disconnected

    The local computer has issued a disconnect and it is waiting for confirmation from the remote system.
  • This command is available only if the Internet Protocol (TCP/IP) protocol is installed as a component in the properties of a network adapter in Network Connections.

Examples

To display the NetBIOS name table of the remote computer with the NetBIOS computer name of CORP07, type:

nbtstat -a CORP07

To display the NetBIOS name table of the remote computer assigned the IP address of 10.0.0.99, type:

nbtstat -A 10.0.0.99

To display the NetBIOS name table of the local computer, type:

nbtstat -n

To display the contents of the local computer NetBIOS name cache, type:

nbtstat -c

To purge the NetBIOS name cache and reload the #PRE-tagged entries in the local Lmhosts file, type:

nbtstat -R

To release the NetBIOS names registered with the WINS server and re-register them, type:

nbtstat -RR

To display NetBIOS session statistics by IP address every five seconds, type:

nbtstat -S 5

Formatting legend

Format | Meaning
Italic | Information that the user must supply
Bold | Elements that the user must type exactly as shown
Ellipsis (...) | Parameter that can be repeated several times in a command line
Between brackets ([]) | Optional items
Between braces ({}); choices separated by pipe (|). Example: {even|odd} | Set of choices from which the user must choose only one
Courier font | Code or program output

See Also

Command-line reference A-ZCommand shell overviewNetBIOS name resolution


Netdom

Applies To: Windows Server 2003,Windows Server 2003 R2,Windows Server 2003 with SP1,Windows Server 2008 R2,Windows Server 2008

Enables administrators to manage Active Directory domains and trust relationships from the command prompt.

Netdom is a command-line tool that is built into Windows Server 2008 and Windows Server 2008 R2. It is available if you have the Active Directory Domain Services (AD DS) server role installed. It is also available if you install the Active Directory Domain Services Tools that are part of the Remote Server Administration Tools (RSAT). For more information, see How to Administer Microsoft Windows Client and Server Computers Locally and Remotely (http://go.microsoft.com/fwlink/?LinkID=177813).

To use netdom, you must run the netdom command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

You can use netdom to:

  • Join a computer that runs Windows XP Professional, Windows Vista, or Windows 7 to a Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows 2000, or Windows NT 4.0 domain.

    • Provide an option to specify the organizational unit (OU) for the computer account.

    • Generate a random computer password for an initial Join operation.

  • Manage computer accounts for domain member workstations and member servers. Management operations include:

    • Add, Remove, Query.

    • An option to specify the OU for the computer account.

    • An option to move an existing computer account for a member workstation from one domain to another while maintaining the security descriptor on the computer account.

  • Establish one-way or two-way trust relationships between domains, including the following kinds of trust relationships:

    • From a Windows 2000, Windows Server 2003, Windows Server 2008, or Windows Server 2008 R2 domain to a Windows NT 4.0 domain.

    • From a Windows 2000, Windows Server 2003, Windows Server 2008, or Windows Server 2008 R2 domain to a Windows 2000, Windows Server 2003, Windows Server 2008, or Windows Server 2008 R2 domain in another enterprise.

    • Between two Windows 2000, Windows Server 2003, Windows Server 2008, or Windows Server 2008 R2 domains in an enterprise (a shortcut trust).

    • The Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, or Windows 2000 Server half of an interoperable Kerberos protocol realm.

  • Verify or reset the secure channel for the following configurations:

    • Member workstations and servers.

    • Backup domain controllers (BDCs) in a Windows NT 4.0 domain.

    • Specific Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, or Windows 2000 replicas.

  • Manage trust relationships between domains, including the following operations:

    • Enumerate trust relationships (direct and indirect).

    • View and change some attributes on a trust.

      Note
      You must run netdom from an elevated command prompt.

Syntax

Netdom uses the following general syntaxes:

Copy Code
NetDom <Operation> [<Computer>] [{/d: | /domain:} <Domain>] [<Options>]
NetDom help <Operation>

Commands

Command | Description
Netdom add | Adds a workstation or server account to the domain.
Netdom computername | Manages the primary and alternate names for a computer. This command can safely rename Active Directory domain controllers as well as member servers.
Netdom join | Joins a workstation or member server to a domain. The act of joining a computer to a domain creates an account for the computer on the domain, if it does not already exist.
Netdom move | Moves a workstation or member server to a new domain. The act of moving a computer to a new domain creates an account for the computer on the domain, if it does not already exist.
Netdom query | Queries the domain for information such as membership and trust.
Netdom remove | Removes a workstation or server from the domain.
Netdom movent4bdc | Renames a Windows NT 4.0 backup domain controller to reflect a domain name change. This can assist in Windows NT 4.0 domain renaming efforts.
Netdom renamecomputer | Renames a domain computer and its corresponding domain account. Use this command to rename domain workstations and member servers only. To rename domain controllers, use the netdom computername command.
Netdom reset | Resets the secure connection between a workstation and a domain controller.
Netdom resetpwd | Resets the computer account password for a domain controller.
Netdom trust | Establishes, verifies, or resets a trust relationship between domains.
Netdom verify | Verifies the secure connection between a workstation and a domain controller.

Remarks

  • A trust relationship is a defined affiliation between domains that enables pass-through authentication.

  • A one-way trust relationship between two domains means that one domain (the trusting domain) allows users who have accounts on the other domain (the trusted domain), access to its resources.

  • The one-way trust relationship described here is helpful in master domain models, but it is not the only kind of trust relationship. When two one-way trusts are established between domains, it is known as a two-way trust. In two-way trusts, each domain treats the users from the trusted (and trusting) domain as its own users.

  • By default, only the result of an operation is reported. For example, if you use the Join operation, you see output similar to the following:

    Copy Code
    success: mywksta joined to mycompany domain
  • If you specify the /verbose parameter, the output lists the success or failure of each transaction that is necessary to perform the operation. For example, this time when you use the Join operation, you see output similar to the following:

    Copy Code
    success: adding machine account for mywksta to mycompany domain
success: configuring lsa on mywksta
success: mywksta joined to mycompany domain
  • The /reboot parameter specifies that the computer being acted upon by the specified netdom operation is shut down and automatically rebooted after the completion of the operation. When you specify the /reboot parameter, the following message and a countdown timer display on the workstation screen, prior to the Restart operation:

    Copy Code
    The system is shutting down. Please save
all work in progress and logoff. Any unsaved changes
will be lost. This shutdown was initiated because the
domain which this machine belongs to was changed by
nnn.
  • For nnn, netdom substitutes the name of the administrator that you enter by using the /uo parameter.

  • The default delay before the computer restarts is 20 seconds.

Additional references

Command-Line Syntax Key


Netdom add

Applies To: Windows Server 2008,Windows Server 2008 R2

Adds a workstation or server account to the domain.

Netdom is a command-line tool that is built into Windows Server 2008 and Windows Server 2008 R2. It is available if you have the Active Directory Domain Services (AD DS) server role installed. It is also available if you install the Active Directory Domain Services Tools that are part of the Remote Server Administration Tools (RSAT). For more information, see How to Administer Microsoft Windows Client and Server Computers Locally and Remotely (http://go.microsoft.com/fwlink/?LinkID=177813).

To use netdom, you must run the netdom command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
netdom add <Computer> {/d: | /domain:} <Domain> [{/ud: | /userd:}[ <Domain>\]<User> {/pd: | /passwordd:}{ <Password>|*}] [{/s: | /server:} <Server>] [/ou: <OUPath>] [/dc] [/help | /?]

Parameters

Parameter | Description
<Computer> | Specifies the name of the computer that you want to add.
{/d: | /domain:} <Domain> | Specifies the domain in which to create the account. If you do not specify this parameter, then netdom add uses the domain that the current computer belongs to.
{/ud: | /userd:}[ <Domain>\] <User> | Specifies the user account that makes the connection with the domain that you specify in the /d or /domain parameter. If you do not specify this parameter, netdom add uses the current user account.
{/pd: | /passwordd:}{ <Password>|*} | Specifies the password of the user account that you specify in the /ud or /userd parameter. If you specify the value of this parameter as a wildcard character (*), this parameter prompts you for the password.
{/s: | /server:} <Server> | Specifies the name of a domain controller that performs the Add operation.
/ou: <OUPath> | Specifies the organizational unit (OU) under which to create the account. You must use the full RFC 1779 distinguished name of the OU. If you do not specify this parameter, netdom add creates the account under the default OU for computer objects for that domain.
dc | Specifies that a domain controller's machine account is to be created. This makes it possible for the computer accounts for new AD DS domain controllers, and new Windows NT 4.0 backup domain controllers (BDCs) to be pre-created. If installing a new Windows NT 4.0 BDC into an existing Windows 2000 or Windows Server 2003 domain, the computer account must be pre-created. This parameter cannot be used with the /ou parameter.
{/help | /?} | Displays help at the command prompt.

Examples

To add the workstation mywksta to the Windows NT 4.0 domain reskita, type the following command at the command prompt:

Copy Code
netdom add /d:reskita mywksta /ud:mydomain\admin /pd:password

To add the workstation mywksta to the Windows Server 2003 domain devgroup.example.com in the OU Dsys/workstations, type the following command at the command prompt:

Copy Code
netdom add/d:devgroup.example.com mywksta /OU:OU=Dsys,OU=Workstations,DC=contoso,DC=com
Note
If you do not specify the /ou parameter, netdom creates the account in the Computers container.

Additional references

Command-Line Syntax Key

Netdom

Netdom add

Netdom computername

Netdom join

Netdom move

Netdom query

Netdom remove

Netdom movent4bdc

Netdom renamecomputer

Netdom reset

Netdom resetpwd

Netdom trust

Netdom verify


Netdom computername

Applies To: Windows Server 2008 R2,Windows Server 2008

Manages the primary and alternate names for a computer. This command can safely rename Active Directory domain controllers as well as member servers.

Netdom is a command-line tool that is built into Windows Server 2008and Windows Server 2008 R2. It is available if you have the Active Directory Domain Services (AD DS) server role installed. It is also available if you install the Active Directory Domain Services Tools that are part of the Remote Server Administration Tools (RSAT). For more information, see How to Administer Microsoft Windows Client and Server Computers Locally and Remotely (http://go.microsoft.com/fwlink/?LinkID=177813).

To use netdom, you must run the netdom command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
netdom computername <Computer> [usero:<User> [/passwordo:[<Password>|*]] [userd:<User> [/passwordd:[<Password>|*]] {/add:<NewAltDNSName> | /remove:<AltDNSName> | /makeprimary:<ComputerDNSName> | /enumerate[:{ALTERNATENAMES | PRIMARYNAME | ALLNAMES}] | /verify | {/help | /?}}

Parameters

Parameter Description

<Computer>

Specifies the name of the computer that you want to add.

/usero:[<domain>\]<UserName>

Specifies the user account that you want to use for the originating domain.

/passwordo:[<Password> | *]

Specifies the password that you want to use for the originating domain. If you specify the value of this parameter as a wildcard character (*), this parameter prompts you for the password.

/userd:[<Domain\]<UserName>

Specifies the user account that you want to use for the destination domain.

/passwordd:[<Password> | *]

Specifies the password that you want to use for the destination domain. If you specify the value of this parameter as a wildcard character (*), this parameter prompts you for the password..

/add:<NewAltDNSName>

Specifies to create a new alternate name. You must specify a fully qualified domain name, which is the computer name followed by the primary Domain Name System (DNS) suffix, such as comp1.example.com.

/remove:<AltDNSName>

Specifies to delete an existing alternate name. You must specify fully qualified domain name, which is the computer name followed by the primary DNS suffix, such as comp1.example.com.

/makeprimary:<ComputerDNSName>

Specifies to make an existing alternate name into the primary name. You must specify a fully qualified domain name, which is the computer name followed by the primary DNS suffix, such as comp1.example.com.

/enumerate[:{ALTERNATENAMES | PRIMARYNAME | ALLNAMES}]

Lists the primary name or any alternate names. You can specify any of the following values:

  • ALTERNATENAMES: Lists the alternate names only.

  • PRIMARYNAME: Lists the primary name only.

  • ALLNAMES: Lists the primary and any alternate names. This is the default.

/verify

Checks if there is a DNS record and a service principal name (SPN) for each computer name.

{/help | /?}

Displays help at the command prompt.

Examples

To give an alternate name for the domain controller DC in the example.com domain, use the following syntax:

Copy Code
netdom computername dc /add:altDC.example.com

Before you can make a name the primary name of a computer, that name must exist as an alternate.

To rename the domain controller DC to altDC in the example.com domain, type the following command at the command prompt:

Copy Code
netdom computername dc /makeprimary:altdc.example.com

To rename a member server, you must use one of the existing alternate names for the computer as the new primary name.

Additional references

Command-Line Syntax Key

Netdom

Netdom add

Netdom join

Netdom move

Netdom query

Netdom remove

Netdom movent4bdc

Netdom renamecomputer

Netdom reset

Netdom resetpwd

Netdom trust

Netdom verify


Netdom join

Applies To: Windows Server 2008,Windows Server 2008 R2

Joins a workstation or member server to a domain. The act of joining a computer to a domain creates an account for the computer on the domain, if it does not already exist.

Netdom is a command-line tool that is built into Windows Server 2008and Windows Server 2008 R2. It is available if you have the Active Directory Domain Services (AD DS) server role installed. It is also available if you install the Active Directory Domain Services Tools that are part of the Remote Server Administration Tools (RSAT). For more information, see How to Administer Microsoft Windows Client and Server Computers Locally and Remotely (http://go.microsoft.com/fwlink/?LinkID=177813).

To use netdom, you must run the netdom command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
netdom join <Computer> {/d: | /domain:}<Domain> [/ou:<OUPath>] [{/ud: | /userd:}[<Domain>\]<User> [{/pd: | /passwordd:}{<Password>|*}]] [{/uo: | /usero}<User> [{/po: | /passwordo}{<Password>|*}] [/reboot[:,Delay>]] [/help | /?]

Parameters

Note
When you join a computer running Windows NT 4.0 or earlier to the domain, the operation is not transacted. This means that a failure during the operation might leave the computer in an undetermined state with respect to the domain to which you intended to join it.

Parameter | Description
<Computer> | Specifies the name of the computer that you want to join to the domain.
{/d: | /domain:}<Domain> | Specifies the domain that you want to join the computer to. If you do not specify this parameter, then netdom join uses the domain to which the current computer belongs.
/ou:<OUPath> | Specifies the organizational unit (OU) under which you want to create the account. You must specify the full RFC 1779 distinguished name of the OU. If you do not specify this parameter, netdom join creates the account under the default OU for computer objects for that domain.
{/ud: | /userd:}[<Domain>\]<User> | Specifies the user account that makes the connection with the domain that you specify in the /d or /domain parameter. If you do not specify this parameter, netdom join uses the current user account.
{/pd: | /passwordd:}{<Password>|*} | Specifies the password of the user account that you specify in the /ud or /userd parameter. If you specify the value of this parameter as a wildcard character (*), this parameter prompts you for the password.
{/uo: | /usero}<User> | Specifies the user account that makes the connection with the computer that you want to join to the domain. If you do not specify this parameter, netdom join uses the current user account.
{/po: | /passwordo}{<Password>|*} | Specifies the password of the user account that you specify in the /uo or /usero parameter. If you specify the value of this parameter as a wildcard character (*), this parameter prompts you for the password.
/reboot[:<Delay>] | Specifies to shut down the computer and automatically reboot after the join operation has completed. The Delay value is the number of seconds before automatic shutdown occurs. The default Delay value is 20 seconds.
{/help | /?} | Displays help at the command prompt.

Examples

To join mywksta to the devgroup.contoso.com domain in the Dsys/workstations OU, type the following command at the command prompt:

Copy Code
netdom join /d:devgroup.contoso.com mywksta /OU:OU=Dsys,OU=Workstations,DC=devgroup,DC=contoso,DC=com

Besides adding the computer account to the domain, this command modifies the workstation to contain the appropriate shared secret to complete the Join operation.

Additional references

Command-Line Syntax Key

Netdom

Netdom add

Netdom computername

Netdom move

Netdom query

Netdom remove

Netdom movent4bdc

Netdom renamecomputer

Netdom reset

Netdom resetpwd

Netdom trust

Netdom verify


Netdom move

Applies To: Windows Server 2008 R2,Windows Server 2008

Moves a workstation or member server to a new domain. The act of moving a computer to a new domain creates an account for the computer on the domain, if it does not already exist.

Netdom is a command-line tool that is built into Windows Server 2008and Windows Server 2008 R2. It is available if you have the Active Directory Domain Services (AD DS) server role installed. It is also available if you install the Active Directory Domain Services Tools that are part of the Remote Server Administration Tools (RSAT). For more information, see How to Administer Microsoft Windows Client and Server Computers Locally and Remotely (http://go.microsoft.com/fwlink/?LinkID=177813).

To use netdom, you must run the netdom command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
netdom move <Computer> {/d: | /domain:}<Domain> [/ou:<OUPath>] [{/ud: | /userd}[<Domain>\]<User> [{/pd: | /passwordd}{<Password>|*}] [{/uo: | /usero}[<Domain>\]<User> [{/po: | /passwordo}{<Password>|*}]] [{/uf: | /userf}[<Domain>\]<User> [{/pf: | /passwordf}{<Password>|*}]] [/reboot[:<Delay>]] [{/help | /?}]

Parameters

Note
When you move a computer running Windows NT 4.0 or earlier to a domain, the operation is not transacted. This means that a failure during the operation might leave the computer in an undetermined state with respect to the domain to which you intended to move it.

Note
When you move a computer to a new domain, netdom move does not delete its computer account in the former domain. However, if you supply credentials for the former domain, netdom move disables the old computer account.

Note
The act of moving a computer to a new domain creates an account for the computer on the domain, if one does not already exist.

Parameter | Description
<Computer> | Specifies the name of the computer that you want to move.
{/d: | /domain:}<Domain> | Specifies the domain to which you want to move the account. If you do not specify the parameter, then netdom move uses the domain to which the current computer belongs.
/ou:<OUPath> | Specifies the organizational unit (OU) under which to create the account. This must be the full RFC 1779 distinguished name of the OU. If you do not specify this parameter, netdom move creates the account under the default OU for computer objects for that domain.
{/ud: | /userd}[<Domain>\]<User> | Specifies the user account that makes the connection with the domain that you specify in the /d or /domain parameter. If you do not specify this parameter, netdom move uses the current user account.
{/pd: | /passwordd}{<Password>|*} | Specifies the password of the user account that you specify in the /ud or /userd parameter. If you specify the value of this parameter as a wildcard character (*), this parameter prompts you for the password.
{/uo: | /usero}<User>r | Specifies the user account to make the connection with the computer that you want to move. If you do not specify this parameter, netdom move uses the current user account.
{/po: | /passwordo}{<Password>|*} | Specifies the password of the user account that you specify in the /uo or /usero parameter. If you specify the value of this parameter as a wildcard character (*), this parameter prompts you for the password.
{/uf: | /userf}<User> | Specifies the user account to make the connection with the computer's former domain (of which the computer had been a member prior to the move). This parameter is used to disable the old computer account.
{/pf: | /passwordf}{<Password>|*} | Specifies the password of the user account that you specify in the /uf or /userf parameter. If you specify the value of this parameter as a wildcard character (*), this parameter prompts you for the password.
/reboot[:<Delay>] | Specifies to shut down and automatically restart the computer after the move has completed. The Delay value is the number of seconds before automatic shutdown occurs. The default Delay value is 20 seconds.
{/help | /?} | Displays help at the command prompt.

Examples

To move mywksta from its current domain into the mydomain domain, type the following command at the command prompt:

Copy Code
netdom move /d:mydomain mywksta /ud:mydomain\admin /pd:password

If the destination is an AD DS domain, this command updates the Security ID history (SIDHistory) for the workstation, retaining the security permissions that the computer account had previously.

Additional references

Command-Line Syntax Key

Netdom

Netdom add

Netdom computername

Netdom join

Netdom query

Netdom remove

Netdom movent4bdc

Netdom renamecomputer

Netdom reset

Netdom resetpwd

Netdom trust

Netdom verify


Netdom query

Applies To: Windows Server 2008 R2,Windows Server 2008

Queries the domain for information such as membership and trust.

Netdom is a command-line tool that is built into Windows Server 2008 and Windows Server 2008 R2. It is available if you have the Active Directory Domain Services (AD DS) server role installed. It is also available if you install the Active Directory Domain Services Tools that are part of the Remote Server Administration Tools (RSAT). For more information, see How to Administer Microsoft Windows Client and Server Computers Locally and Remotely (http://go.microsoft.com/fwlink/?LinkID=177813).

To use netdom, you must run the netdom command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
netdom query {/d: | /domain:}<Domain> [{/s: | /server:}<Server>] [{/ud: | /userd:}[<Domain>\]<User> {/pd: | /passwordd}{<Password>|*}] [/verify] [/reset] [/direct] {WORKSTATION|SERVER|DC|OU|PDC|FSMO|TRUST} [{/help | /?}]

Parameters

Parameter Description

{/d: | /domain:}<Domain>

Specifies the domain to query for the information. If you do not specify this parameter, then netdom query uses the domain to which the current computer belongs.

{/s: | /server:}<Server>

Specifies the name of the domain controller that performs the query.

{/ud: | /userd:}[<Domain>\]<User>

Specifies the user account that makes the connection with the domain that you specify in the /d or /domain parameter. If you do not specify this parameter, netdom query uses the current user account.

{/pd: | /passwordd}{<Password>|*}

Specifies the password of the user account that you specify in the /ud or /userd parameter. If you specify the value of this parameter as a wildcard character (*), this parameter prompts you for the password.

/verify

Specifies verification of the secure channel secrets for all enumerated memberships or trusts, and then displays them. Only users who are enterprise-level administrators can verify all secure channel secrets.

/reset

Specifies resynchronization of the secure channel secrets for all enumerated memberships or trusts that are currently broken. The /reset parameter implies the /verify parameter. Unless the user is an enterprise-level administrator, the user might not be able to reset all enumerated trusts or memberships.

/direct

Indicates that the query for trust relationships returns only direct trust relationships, rather than direct and indirect relationships. This parameter is valid only when you specify Domain in the /d parameter.

WORKSTATION|SERVER|DC|OU|PDC|FSMO|TRUST

Specifies the type of list to generate. The following list shows the possible objects:

  • WORKSTATION: Queries the domain for the list of workstations.

  • SERVER: Queries the domain for the list of servers.

  • DC: Queries the domain for the list of domain controllers.

  • OU: Queries the domain for the list of OUs under which the user that you specify can create a computer object.

  • PDC: Queries the domain for the current primary domain controller.

  • FSMO: Queries the domain for the current list of operations master role holders. These role holders are also known as flexible single master operations (FSMO).

  • TRUST: Queries the domain for the list of its trusts.

{/help | /?}

Displays help at the command prompt.

Examples

To list all the workstations in the domain Northamerica, type the following command at the command prompt:

Copy Code
netdom query /d:Northamerica WORKSTATION

To list all the servers in Northamerica, type the following command at the command prompt:

Copy Code
netdom query /d:Northamerica SERVER

To list all the domain controllers in the domain Northamerica, type the following command at the command prompt:

Copy Code
netdom query /d:Northamerica DC

To list all the OUs in devgroup.example.com, type the following command at the command prompt:

Copy Code
netdom query /d:devgroup.example.com OU

To list the PDC for Northamerica, type the following command at the command prompt:

Copy Code
netdom query /d:Northamerica PDC

To list the current PDC emulator for devgroup.example.com, type the following command at the command prompt:

Copy Code
netdom query /d:devgroup.example.com FSMO

You can use the Query operation with the /verify and /reset parameters to perform the Verify and Reset operations together. You can pipe the output of the Query operation to the netdom Verify or netdom Reset operation.

To list all servers and verify secure channel secret, type the following command at the command prompt:

Copy Code
netdom query /d:Northamerica SERVER /verify

To list all workstations and reset any unsynchronized secure channel secrets, type the following command at the command prompt:

Copy Code
netdom query /d:Northamerica WORKSTATION /reset

To list all the direct trust relationships for the domain Northamerica, type the following command at the command prompt:

Copy Code
netdom query /d:Northamerica /Ud:Northamerica\admin DOMAIN /Direct

To list all the direct and indirect trust relationships for the domain Northamerica, type the following command at the command prompt:

Copy Code
netdom query /d:Northamerica /Ud:Northamerica\admin DOMAIN

To list all trust relationships and check their status, type the following command at the command prompt:

Copy Code
netdom query /d:devgroup.example.com DOMAIN /verify

Additional references

Command-Line Syntax Key

Netdom

Netdom add

Netdom computername

Netdom join

Netdom move

Netdom remove

Netdom movent4bdc

Netdom renamecomputer

Netdom reset

Netdom resetpwd

Netdom trust

Netdom verify


Netdom remove

Applies To: Windows Server 2008,Windows Server 2008 R2

Removes a workstation or server from the domain.

Netdom is a command-line tool that is built into Windows Server 2008 and Windows Server 2008 R2. It is available if you have the Active Directory Domain Services (AD DS) server role installed. It is also available if you install the Active Directory Domain Services Tools that are part of the Remote Server Administration Tools (RSAT). For more information, see How to Administer Microsoft Windows Client and Server Computers Locally and Remotely (http://go.microsoft.com/fwlink/?LinkID=177813).

To use netdom, you must run the netdom command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
netdom remove <Computer> {/d: | /domain:}<Domain> [{/ud: | /userd:}[<Domain>\]<User> [{/pd: | /passwordd}{<Password>|*}]] [{/uo: | /usero}<User> [{/po: |/passwordo}{<Password>|*}]] [/reboot[:<Delay>]] [{/help | /?}]

Parameters

Parameter | Description
<Computer> | Specifies the name of the computer that you want to remove.
{/d: | /domain:}<Domain> | Specifies the domain from which you want to remove the computer. If you do not specify this parameter, then netdom remove uses the domain that the current computer belongs to.
{/ud: | /userd:}[ <Domain>\]<User> | Specifies the user account that makes the connection with the domain that you specify in the /d or /domain parameter. If you do not specify this parameter, then netdom remove uses the current user account.
{/pd: | /passwordd}{<Password>|*} | Specifies the password of the user account that you specify in the /ud or /userd parameter. If you specify the value of this parameter as a wildcard character (*), this parameter prompts you for the password.
{/uo: | /usero}<User> | Specifies the user account to make the connection with the computer that you want to remove. If you do not specify this parameter, then netdom remove uses the current user account.
{/po: |/passwordo}{<Password>|*} | Specifies the password of the user account that you specify in the /uo or /usero parameter. If you specify the value of this parameter as a wildcard character (*), this parameter prompts you for the password.
/reboot[:<Delay>] | Specifies to shut down and automatically restart the computer after the remove operation completes. The Delay value is the number of seconds before automatic shutdown occurs. The default Delay value is 20 seconds.
{/help | /?} | Displays help at the command prompt.

Examples

To remove mywksta from the mydomain domain and make the workstation a part of a workgroup, type the following command at the command prompt:

Copy Code
netdom remove /d:mydomain mywksta /ud:mydomain\admin /pd:password

Additional references

Command-Line Syntax Key

Netdom

Netdom add

Netdom computername

Netdom join

Netdom move

Netdom query

Netdom movent4bdc

Netdom renamecomputer

Netdom reset

Netdom resetpwd

Netdom trust

Netdom verify


Netdom movent4bdc

Applies To: Windows Server 2008,Windows Server 2008 R2

Renames a Windows NT 4.0 backup domain controller to reflect a domain name change. This can assist in Windows NT 4.0 domain renaming efforts.

Netdom is a command-line tool that is built into Windows Server 2008and Windows Server 2008 R2. It is available if you have the Active Directory Domain Services (AD DS) server role installed. It is also available if you install the Active Directory Domain Services Tools that are part of the Remote Server Administration Tools (RSAT). For more information, see How to Administer Microsoft Windows Client and Server Computers Locally and Remotely (http://go.microsoft.com/fwlink/?LinkID=177813).

To use netdom, you must run the netdom command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
netdom movent4bdc <Computer> [{/d: | /domain:}<Domain>] [/reboot[:<Delay>]] [{/help | /?}]

Parameters

Parameter | Description
<Computer> | Specifies the name of the backup domain controller that you want to rename.
{/d: | /domain:}<Domain> | Specifies the new name of the domain.
/reboot[:<Delay>] | Specifies to shut down and automatically restart the computer after the rename operation completes. The Delay value is the number of seconds before automatic shutdown occurs. The default Delay value is 20 seconds.
{/help | /?} | Displays help at the command prompt.

Examples

To join myBDC to the Windows NT 4.0 domain reskita, type the following command at the command prompt:

Copy Code
netdom mybdc moveNT4BDC /domain:reskita

Additional references

Command-Line Syntax Key

Netdom

Netdom add

Netdom computername

Netdom join

Netdom move

Netdom query

Netdom renamecomputer

Netdom reset

Netdom resetpwd

Netdom trust

Netdom verify


Netdom renamecomputer

Applies To: Windows Server 2008 R2,Windows Server 2008

Renames a domain computer and its corresponding domain account. Use this command to rename domain workstations and member servers only. To rename domain controllers, use the netdom computername command.

Netdom is a command-line tool that is built into Windows Server 2008 and Windows Server 2008 R2. It is available if you have the Active Directory Domain Services (AD DS) server role installed. It is also available if you install the Active Directory Domain Services Tools that are part of the Remote Server Administration Tools (RSAT). For more information, see How to Administer Microsoft Windows Client and Server Computers Locally and Remotely (http://go.microsoft.com/fwlink/?LinkID=177813).

To use netdom, you must run the netdom command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
netdom renamecomputer <Computer> /newname:<NewComputerName> /userd:[<Domain>\]<UserName> [/passwordd:[<Password> | *]] /usero:[<Domain>\]<UserName> [/passwordo:[<Password> | *]] [/reboot[:<Delay>]] [{/help | /?}]

Parameters

Parameter | Description
<Computer> | Specifies the name of the computer that you want to rename.
/newname:<NewComputerName> | Specifies the new name of the computer.
/userd:[<domain\]<UserName> | Specifies the user account that you want to use for the destination domain.
/passwordd:[<password> | *] | Specifies the password of the user account that you specify in the /ud or /userd parameter. If you specify the value of this parameter as a wildcard character (*), this parameter prompts you for the password.
/usero:[<domain>\]<UserName> | Specifies the user account that you want to use for the originating domain.
/passwordo:[<password>| *] | Specifies the password of the user account that you specify for the /uo or /usero parameter. If you specify the value of this parameter as a wildcard character (*), this parameter prompts you for the password.
/force[:<Delay>] | The user will be prompted for confirmation unless the /force parameter is specified.
/reboot[:<Delay>] | Specifies to shut down and automatically restart the computer after the rename operation completes. The Delay value is the number of seconds before automatic shutdown occurs. The default Delay value is 20 seconds.
{/help | /?} | Displays help at the command prompt.
Note
Do not use the netdom renamecomputer command to rename AD DS domain controllers. Doing so may cause the domain controller to no longer function as a domain controller on the network. To rename AD DS servers and domain controllers, use netdom computername.

Examples

To rename the member server member to member1, type the following command at the command prompt:

Copy Code
netdom renamecomputer member /newname:member1.contoso.com /userd:administrator

Additional references

Command-Line Syntax Key

Netdom

Netdom add

Netdom computername

Netdom join

Netdom move

Netdom query

Netdom remove

Netdom movent4bdc

Netdom reset

Netdom resetpwd

Netdom trust

Netdom verify


Netdom reset

Applies To: Windows Server 2008,Windows Server 2008 R2

Resets the secure connection between a workstation and a domain controller.

Netdom is a command-line tool that is built into Windows Server 2008 and Windows Server 2008 R2. It is available if you have the Active Directory Domain Services (AD DS) server role installed. It is also available if you install the Active Directory Domain Services Tools that are part of the Remote Server Administration Tools (RSAT). For more information, see How to Administer Microsoft Windows Client and Server Computers Locally and Remotely (http://go.microsoft.com/fwlink/?LinkID=177813).

To use netdom, you must run the netdom command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
netdom reset <Computer> {/d: | /domain:}<Domain> [{/s: | /server:}<Server>] [{/uo: | /usero:}<User> {/po: | /passwordo}{<Password>|*}] [{/help | /?}]

Parameters

Parameter | Description
<Computer> | Specifies the name of the computer whose secure connection you want to reset.
{/d: | /domain:}<Domain> | Specifies the domain with which to establish the secure connection. If you do not specify this parameter, then netdom reset uses the domain to which the current computer belongs.
{/s: | /server:}<Server> | Specifies the domain controller to use to establish the secure connection.
{/uo: | /usero:}<User> | Specifies the user account to use to make the secure connection with the computer that you want to reset. If you do not specify this parameter, then netdom reset uses the current user account.
{/po: | /passwordo}{<Password>|*} | Specifies the password of the user account that you specify in the /uo or /usero parameter. If you specify the value of this parameter as a wildcard character (*), this parameter prompts you for the password.
{/help | /?} | Displays help at the command prompt.

Examples

To reset the secure channel secret that is maintained between mywksta and devgroup.contoso.com (regardless of OU), type the following command at the command prompt:

Copy Code
netdom reset /d:devgroup.contoso.com mywksta

To reset the secure channel between the Windows NT 4.0 primary domain controller (PDC) for Northamerica and the backup domain controller NABDC, type the following command at the command prompt:

Copy Code
netdom reset /d:Northamerica NABDC

Member servers often establish secure channel sessions with non-local domain controllers. To force a secure channel session between a member server and a specific domain controller by using the /server parameter with the Reset operation, type the following command at the command prompt:

Copy Code
netdom reset /d:devgroup.contoso.com mywksta /Server:mylocalbdc

Additional references

Command-Line Syntax Key

Netdom

Netdom add

Netdom computername

Netdom join

Netdom move

Netdom query

Netdom remove

Netdom movent4bdc

Netdom resetpwd

Netdom trust

Netdom verify


Netdom resetpwd

Applies To: Windows Server 2008 R2,Windows Server 2008

Resets the computer account password for a domain controller.

Netdom is a command-line tool that is built into Windows Server 2008 and Windows Server 2008 R2. It is available if you have the Active Directory Domain Services (AD DS) server role installed. It is also available if you install the Active Directory Domain Services Tools that are part of the Remote Server Administration Tools (RSAT). For more information, see How to Administer Microsoft Windows Client and Server Computers Locally and Remotely (http://go.microsoft.com/fwlink/?LinkID=177813).

To use netdom, you must run the netdom command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

Syntax

Copy Code
netdom resetpwd {/s: | /server:}<Server> {/ud: | /userd:}[<Domain>\]<User> {/pd: | /passwordd:}{<Password>|*}] [{/help | /?}]

Parameters

Parameter | Description
{/s: | /server:}<Server> | Specifies the domain controller to use to set the computer account password.
{/ud: | /userd:}[<Domain>\]<User> | Specifies the user account to use to make the secure connection with the domain that you specify in the /s parameter. You must specify the user account in the Domain\User format. If you do not specify this parameter, then netdom resetpwd uses the current user account.
{/pd: | /passwordd:}{<Password>|*} | Specifies the password of the user account that you specify in the /ud parameter. If you specify the value of this parameter as a wildcard character (*), this parameter prompts you for the password.
{/help | /?} | Displays help at the command prompt.

Additional references

Command-Line Syntax Key

Netdom

Netdom add

Netdom computername

Netdom join

Netdom move

Netdom query

Netdom remove

Netdom movent4bdc

Netdom renamecomputer

Netdom reset

Netdom trust

Netdom verify


Netdom trust

Applies To: Windows Server 2008,Windows Server 2008 R2

Establishes, verifies, or resets a trust relationship between domains.

Netdom is a command-line tool that is built into Windows Server 2008 and Windows Server 2008 R2. It is available if you have the Active Directory Domain Services (AD DS) server role installed. It is also available if you install the Active Directory Domain Services Tools that are part of the Remote Server Administration Tools (RSAT). For more information, see How to Administer Microsoft Windows Client and Server Computers Locally and Remotely (http://go.microsoft.com/fwlink/?LinkID=177813).

To use netdom, you must run the netdom command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Important
Netdom cannot be used to create a forest trust between two AD DS forests. To create a cross forest trust between two AD DS forests, you can either use a scripting solution or the Active Directory Domains and Trusts snap-in.

Syntax

Copy Code
netdom trust <TrustingDomainName> {/d: | /domain:} <TrustedDomainName> [{/ud: | /userd:}[<Domain>\]<User> [{/pd: | /passwordd:}{<Password>|*}] [{/uo: | /usero:}<User>] [{/po: | /passwordo:}{<Password>|*}] [/verify] [/reset] [/passwordt:<NewRealmTrustPassword>] [/add [/realm]] [/remove [/force]] [/twoway] [/kerberos] [/transitive[:{YES|NO}]] [/oneside:{TRUSTED | TRUSTING}] [/force] [/quarantine[:{YES | NO}]] [/namesuffixes:<TrustName> [/togglesuffix:#]] [/EnableSIDHistory] [/ForestTRANsitive] [/SelectiveAUTH][/AddTLN][/AddTLNEX][/RemoveTLN] [/RemoveTLNEX][{/help | /?}]

Parameters

Parameter Description

<TrustingDomainName>

Specifies the name of the trusting domain.

{/d: | /domain:}<TrustedDomainName>

Specifies the name of the trusted domain. If you do not specify this parameter, then netdom trust uses the domain to which the current computer belongs.

{/ud: | /userd:}[<Domain>\]<User>]

Specifies the user account to use to make the connection with the domain that you specify in the /d or /domain parameter. If you do not specify this parameter, then netdom trust uses the current user account.

/pd:{<Password>|*}

Specifies the password of the user account that you specify in the /ud or /userd: parameter. If you specify the value of this parameter as a wildcard character (*), this parameter prompts you for the password.

{/uo: | /usero:}<User>

Specifies the user account to use to make the connection with the trusting domain. If you do not specify this parameter, then netdom trust uses the current user account.

{/po: | /passwordo:}{<Password>|*}

Specifies the password of the user account that you specify in the /uo or /usero parameter. If you specify the value of this parameter as a wildcard character (*), this parameter prompts you for the password.

/verify

Verifies the secure channel secrets upon which a specific trust relationship is based.

/reset

Resets the trust secret between trusted domains or between the domain controller and the workstation.

/passwordt:<NewRealmTrustPassword>

Specifies a new trust password. This parameter is valid only if you specify the /add parameter, and only if one of the domains that you specify is a non-Windows, Kerberos realm. You set the trust password on the Windows domain only, which means that you do not need credentials for the non-Windows domain.

/add

Specifies to create a trust.

/realm

Specifies to create the trust for a non-Windows, Kerberos realm. This parameter is valid only if you specify the /add and /passwordt parameters.

/remove

Specifies to break a trust.

/force

Removes from the forest both the trusted domain object and the cross-reference object for the domain that you specify. You use this parameter to clean up decommissioned domains that you no longer use and that you cannot remove by using the Active Directory Installation Wizard. This problem can occur if the domain controller for a decommissioned domain is disabled or damaged and there are no additional domain controllers, or if you cannot recover a decommissioned domain controller from backup media. This parameter is valid only if you specify the /remove parameter.

/twoway

Specifies to establish a two-way trust relationship rather than a one-way trust relationship.

/kerberos

Specifies to exercise the Kerberos protocol between a workstation and a destination domain. This parameter is valid only if you specify the /verify parameter.

/transitive[:{YES|NO}]

Specifies to set either a transitive or non-transitive trust. This parameter is valid only for a non-Windows, Kerberos realm. Netdom trust creates non-Windows, Kerberos trusts that are non-transitive. If you do not specify a value for this parameter, then netdom trust displays the current transitivity state. The following list shows the values that you can specify.

  • YES: Sets the realm to a transitive trust.

  • NO: Sets the realm to a non-transitive trust.

/oneside:{TRUSTED| TRUSTING}

Specifies to create or remove the trust object on only one domain. The following list shows the values that you can specify.

  • TRUSTED: Specifies to create or remove the trust object on the trusted domain that you specify in the /d or /domain parameter.

  • TRUSTING: Specifies to create or remove the trust object on the trusting domain. This value is valid only if you specify the /add or /remove parameter. The /passwordt parameter is required when you use the /add or /remove parameter.

/quarantine[:{YES | NO}]

Sets or clears the domain quarantine attribute. If you do not specify a value for this parameter, then netdom trust displays the current quarantine state. The following list shows the values that you can specify.

  • YES: Specifies to accept only security identifiers (SIDs) from the directly-trusted domain for authorization data that netdom trust returns during authentication. Netdom trust removes SIDS from any other domains.

  • NO: Specifies to accept any SID for authorization data that netdom trust returns during authentication. This is the default value.

/namesuffixes:<TrustName>

Lists the routed name suffixes for TrustName on the domain that TrustingDomainName names. You can use the /usero and /passwordo parameters for authentication. The /domain parameter is not required.

/togglesuffix:#

Changes the status of a name suffix. Used with the /namesuffixes parameter. The number of the name entry specified by the /namesuffixes parameter must be provided to indicate which name will have its status changed. Names that are in conflict cannot have their status changed until the name in the conflicting trust is disabled. Always precede this command with the /namesuffixes parameter because LSA will not always return the names in the same order.

/EnableSIDhistory

Specifying yes allows users who migrate to the trusted forest from any other forest to use SID history to access resources in this forest. Valid only for an outbound forest trust.

Note Allow migrated users to use SID history only if you can trust the trusted forest administrators to specify SIDs of this forest in the SID history attribute of their users appropriately.

Specifying no would disable the ability of the migrated users in the trusted forest to use SID history to access resources in this forest. Specifying /EnableSIDHistory without yes or no will display the current state.

/ForestTRANsitive

Specifying yes marks this trust as forest transitive. Specifying no marks this trust as not forest transitive. Specifying /ForestTRANsitive without yes or no will display the current state of this trust attribute. Valid only for non-Windows realm trusts and can only be performed on the root domain for a forest.

/SelectiveAUTH

Specifying no disables selective authentification across this trust. Specifying /SelectiveAUTH without yes or no displays the currrent state of this trust attribute. Specifying yes enables selective authentification across this trust. Valid only on outbound forest and external trusts.

/AddTLN

Adds the specified top level name (DNS name suffix) to the forest trust info for the specified trust. Valid only for a forest transitive non-Windows realm trust and can only be performed on the root domain for a forest. Refer to the /NameSuffixes operation for a list of name suffixes.

/AddTLNEX

Adds the specified top level name exclusion(DNS name suffix) to the forest trust info for the specified trust. Valid only for a forest transitive non-Windows realm trust and can only be performed on the root domain for a forest. Refer to the /NameSuffixes operation for a list of name suffixes.

/RemoveTLN

Removes the specified top level name (DNS name suffix) from the forest trust info from the specified trust. Valid only for a forest transitive non-Windows realm trust and can only be performed on the root domain for a forest. Refer to the /NameSuffixes operation for a list of name suffixes.

/RemoveTLNEX

Removes the specified top level name exclusion (DNS Name Suffix) from the forest trust info from the specified trust. Valid only for a forest transitive non-Windows realm trust and can only be performed on the root domain for a forest. Refer to the /NameSuffixes operation for a list of name suffixes.

{/help | /?}

Displays help at the command prompt.

Examples

When used with the Trust operation, the /d: parameter always refers to the trusted domain.

To set the Windows NT 4.0 resource domain USA-Chicago to trust the Windows NT 4.0 account domain Northamerica, type the following command at the command prompt:

Copy Code
netdom trust /d:Northamerica USA-Chicago /add /Ud:Northamerica\admin /Pd:* /Uo:USA-Chicago\admin /Po:*

When you press ENTER, you see the following prompt:

Copy Code
Password for Northamerica\admin:

Enter the password for Northamerica\admin. When you press ENTER, you see the following prompt:

Copy Code
Password for USA-Chicago\admin:

Type the password for USA-Chicago\admin, and then press ENTER.

The user must have credentials for both domains. You can use the /pd parameter to specify the password for Northamerica\admin and the /po parameter to specify the password for USA-Chicago\admin. If the user does not provide passwords at the command prompt, the user is prompted for both.

If you want to specify a two-way trust, type the following command at the command prompt

Copy Code
netdom trust /d:marketing.contoso.com engineering.contoso.com /add /twoway /Uo:admin@engineering.contoso.com /Ud:admin@marketing.contoso.com

To establish a one-way trust where Northamerica trusts the non-Windows, Kerberos realm ATHENA, type the following command at the command prompt:

Copy Code
netdom trust /d:ATHENA Northamerica /add /PT:password /realm

The /d parameter specifies the trusted domain and the /realm parameter indicates that this is a non-Windows, Kerberos realm. The order of the domains is not important. You can supply credentials to the Windows 2000 domain, if needed.

Note
Verifying a specific trust relationship requires credentials unless the user has domain administrator privileges on both domains.

If you want to set the Kerberos realm ATHENA to trust the Northamerica domain, type the following command at the command prompt:

Copy Code
netdom trust /d:Northamerica ATHENA /add
Note
To establish a two-way trust, you can specify the /twoway parameter.

Non-Windows Kerberos trusts are created as non-transitive. If you want to change the trust from ATHENA to Northamerica as transitive, type the following command at the command prompt:

Copy Code
netdom trust Northamerica /d:ATHENA /trans:yes

To display the transitive state, type the following command at the command prompt:

Copy Code
netdom trust Northamerica /d:ATHENA /trans

The order of these two domains is not important. Either can be the non-Windows, Kerberos domain.

To undo the trust that USA-Chicago has for Northamerica, type the following command at the command prompt:

Copy Code
netdom trust /d:Northamerica USA-Chicago /remove

To break a two-way trust relationship, type the following command at the command prompt:

Copy Code
netdom trust /d:marketing.contoso.com Engineering.contoso.com /remove /twoway /Uo:admin@engineering.contoso.com /Ud:admin@marketing.contoso.com

To verify the one-way trust that USA-Chicago has for Northamerica, type the following command at the command prompt:

Copy Code
netdom trust /d:Northamerica USA-Chicago /verify

To verify a two-way trust between the Northamerica and Europe domains, type the following command at the command prompt:

Copy Code
netdom trust /d:Northamerica EUROPE /verify /twoway

The /verify parameter checks that the appropriate shared secrets are synchronized between the two domains involved in the trust.

To reset the secure channel for the one-way trust between Northamerica and USA-Chicago, type the following command at the command prompt:

Copy Code
netdom trust /d:Northamerica USA-Chicago /Ud:Northamerica\admin /reset

The /reset parameter synchronizes the appropriate shared secrets if they are not already synchronized.

To verify that Kerberos authentication occurs successfully between a workstation and a service that is located in the domain devgroup.example.com, type the following command at the command prompt:

Copy Code
netdom trust /d:devgroup.example.com /verify /KERBEROS

When you use the netdom Trust operation with the /verify /kerberos parameters, the trust operation searches for a session ticket for the Kerberos Admin service in the target domain. If the search operation is successful, you can conclude that all Kerberos operations, such as KDC referrals, operate correctly between the workstation and the target domain.

Note
You cannot run this trust operation from a remote location. You must run the operation on the workstation that you want to test.

To list the routed name suffixes for the trust between contoso and the trustpartnerdomain, type the following command at the command prompt:

Copy Code
netdom trust contoso /namesuffixes:trustpartnerdomain
Note
The /d parameter is not needed for this operation which is an exception from other Trust operations.

This lists all the routed name suffixes for the trust relationship between contoso and the trustpartnerdomain. The trust relationship must be either a Forest Trust relationship or a Non-Windows Realm trust with the Forest Transitive attribute set.

The following is sample output:

Copy Code
C:\nt\ds\netapi\netdom\obj\i386>netdom trust shasandom2 /namesuffixes:powermatic

   Name, Type, Status, Notes

1. *.treyresearch.net, Name Suffix, Enabled

2. *.powermatic.nttest.contoso.com, Name Suffix, Enabled

3. *.adatum.com, Name Suffix, Enabled

4. *.cpandl.com, Name Suffix, Conflicting, With shasandom2.nttest.contoso.com

5. unisaw.powermatic.nttest.contoso.com, Domain DNS name, Enabled

6. UNISAW, Domain NetBIOS name, Enabled, For unisaw.powermatic.nttest.contoso.

com

7. s-1-5-21-1550512861-723516995-420396236, Domain SID, Enabled, For unisaw.powermatic.nttest.contoso.com

8. powermatic.nttest.contoso.com, Domain DNS name, Enabled

9. POWERMATIC, Domain NetBIOS name, Enabled, For powermatic.nttest.contoso.com

10. s-1-5-21-1390067357-1757981266-527237240, Domain SID, Enabled, For powermati

c.nttest.contoso.com

The command completed successfully.

To enable or disable the first routed name suffix in the list generated by the previous command, type the following command at the command prompt:

Copy Code
netdom trust myTestDomain /namesuffixes:foresttrustpartnerdomain /togglesuffix:1
Note
You must use the /ToggleSuffix parameter with the /NameSuffixes parameter. Use /NameSuffixes immediately before you use /ToggleSuffix because the order in which the name suffixes are listed may change.

The following is sample output:

Note
The output reflects the routed name suffix list after the Toggling operation.

Copy Code
C:\nt\ds\netapi\netdom\obj\i386>netdom trust shasandom2 /ns:powermatic /ts:1

   Name, Type, Status, Notes

1. *. Treyresearch.net, Name Suffix, Admin-Disabled

2. *.powermatic.nttest.contoso.com, Name Suffix, Enabled

3. *. adatum.com, Name Suffix, Enabled

4. *. cpandl.com, Name Suffix, Conflicting, With shasandom2.nttest.contoso.com

5. unisaw.powermatic.nttest.contoso.com, Domain DNS name, Enabled

6. UNISAW, Domain NetBIOS name, Enabled, For unisaw.powermatic.nttest.contoso.

com

7. s-1-5-21-1550512861-723516995-420396236, Domain SID, Enabled, For unisaw.powermatic.nttest.contoso.com

8. powermatic.nttest.contoso.com, Domain DNS name, Enabled

9. POWERMATIC, Domain NetBIOS name, Enabled, For powermatic.nttest.contoso.com

10. s-1-5-21-1390067357-1757981266-527237240, Domain SID, Enabled, For powermatic.nttest.contoso.com

The command completed successfully.

To add the DNS name suffix contoso.com to the Forest Trust Info with trustpartnerdomain, type the following command at the command prompt:

Copy Code
Netdom trust myTestDomain /d:trustPartnerDomain /AddTln:contoso.com

Adding the DNS name suffix is only allowed for a trust with a Forest Transitive, Non-Windows Realm Trust. This is also true for the following commands:

  • Netdom trust myTestDomain /d:trustPartnerDomain /RemoteTln:contoso.com

  • Netdom trust myTestDomain /d:trustPartnerDomain /AddTLNEx:something.contoso.com

    This must have a TLN entry present for the parent naming context, in this case, contoso.com, otherwise the operation is disallowed.)

  • Netdom trust myTestDomain /d:trustPartnerDomain /RemoveTLNEx:something.contoso.com

The following code lists the name suffixes on a Non-Windows Realm Trust:

Copy Code
C:\nt\ds\netapi\netdom\obj\i386>netdom trust shasandom2 /ns:server.mit.org

   Name, Type, Status, Notes

1. *.cpandl.com, Name Suffix, Enabled

2. *.adatum.com, Name Suffix, Enabled

The command completed successfully.

The following code adds another TLN:

Copy Code
C:\nt\ds\netapi\netdom\obj\i386>netdom trust shasandom2 /d:domain.mit.org /addtln:dude.com

The TLN or Exclusion was successfully added to the Forest Trust Info.

The command completed successfully.

The following code adds an invalid TLN exclusion:

Copy Code
C:\nt\ds\netapi\netdom\obj\i386>netdom trust shasandom2 /d:domain.mit.org /addtlnex:dude.com

The Forest Trust Info for the specified trust could not be stored.

The parameter is incorrect.

Try "netdom HELP" for more information.

The following code adds a valid TLN exclusion:

Copy Code
C:\nt\ds\netapi\netdom\obj\i386>netdom trust shasandom2 /d:domain.mit.org /addtlnex:child.contoso.com

The TLN or Exclusion was successfully added to the Forest Trust Info.

The command completed successfully.

The following code shows the result of previous operations:

Copy Code
C:\nt\ds\netapi\netdom\obj\i386>netdom trust shasandom2 /ns:server.mit.org

   Name, Type, Status, Notes

1. *.child.contoso.com, Exclusion

2. *.cpandl.com, Name Suffix, Enabled

3. *.adatum.com, Name Suffix, Enabled

4. *.contoso.com, Name Suffix, Enabled

The command completed successfully.

Additional references

Command-Line Syntax Key

Netdom

Netdom add

Netdom computername

Netdom join

Netdom move

Netdom query

Netdom remove

Netdom movent4bdc

Netdom renamecomputer

Netdom reset

Netdom resetpwd

Netdom verify


Netdom verify

Applies To: Windows Server 2008 R2,Windows Server 2008

Verifies the secure connection between a workstation and a domain controller.

Netdom is a command-line tool that is built into Windows Server 2008 and Windows Server 2008 R2. It is available if you have the Active Directory Domain Services (AD DS) server role installed. It is also available if you install the Active Directory Domain Services Tools that are part of the Remote Server Administration Tools (RSAT). For more information, see How to Administer Microsoft Windows Client and Server Computers Locally and Remotely (http://go.microsoft.com/fwlink/?LinkID=177813).

To use netdom, you must run the netdom command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
netdom verify <Computer> {/d: | /domain:}<Domain> [{/uo: | usero}<User> {/po: | /passwordo}{<Password>|*}] [{/help | /?}]

Parameters

Parameter | Description
<Computer> | Specifies the name of the computer whose secure connection you want to verify.
{/d: | /domain:}<Domain> | Specifies the domain with which to verify the secure connection. If you do not specify this parameter, then netdom verify uses the domain to which the current computer belongs.
{/uo: | usero}<User> | Specifies the domain with which to verify the secure connection. If you do not specify this parameter, then netdom verify uses the current user account.
{/po: | /passwordo}{<Password>|*} | Specifies the password of the user account that you specify in the /uo or /usero parameter. If you specify the value of this parameter as a wildcard character (*), this parameter prompts you for the password.
{/help | /?} | Displays help at the command prompt.

Examples

To verify that netdom maintains the secure channel secret between mywksta and devgroup.contoso.com, type the following command at the command prompt:

Copy Code
netdom verify /d:devgroup.contoso.com mywksta

Additional references

Command-Line Syntax Key

Netdom

Netdom add

Netdom computername

Netdom join

Netdom move

Netdom query

Netdom remove

Netdom movent4bdc

Netdom renamecomputer

Netdom reset

Netdom resetpwd

Netdom trust


Netdiag

Applies To: Windows Server 2003

The Netdiag command-line diagnostic tool helps to isolate networking and connectivity problems by performing a series of tests to determine the state of your network client. These tests and the key network status information that they expose give network administrators and support personnel a more direct means of identifying and isolating network problems. Moreover, because this tool does not require parameters or switches to be specified, support personnel and network administrators can focus on analyzing the output rather than on training users how to use the tool. For examples of how this command can be used, see Examples.

Syntax

Copy Code
netdiag [/q] [/v] [/l] [/debug] [/d:DomainName] [/fix] [/DcAccountEnum] [/test:TestName] [/skip:TestName] [/?]

Parameters

Parameter Description

/q

Specifies quiet output (errors only).

/v

Specifies verbose output.

/l

Sends output to Netdiag.log. This log file is created in the same directory where Netdiag.exe was run.

/debug

Specifies even more verbose output. With this parameter, NetDiag takes a few minutes to complete.

/d: DomainName

Finds a domain controller in the specified domain.

/fix

Fixes minor problems.

/DcAccountEnum

Enumerates domain controller computer accounts.

/test: TestName

Runs only the listed test(s). TCP/IP must be bound to one or more adapters before running any of the tests. Nonskippable tests are still run.

Valid TestName values are:

  • Autonet - Automatic Private IP Addressing (APIPA) address test. Tests whether APIPA is in use for the network adapters.

  • Bindings - Bindings test. Lists all bindings, including interface name, lower module name, upper module name, whether the binding is currently enabled, and the owner of the binding.

  • Browser - Redirector and Browser test. Lists the protocols bound to the Browser service and the redirector.

  • DcList - Domain controller list test. Obtains a list of domain controllers for the domain.

  • DefGw - Default gateway test. Attempts to contact each configured default gateway.

  • DNS - DNS test. Tests the availability of the configured DNS servers and verifies the current client's DNS registrations.

  • DsGetDc - Domain controller discovery test. First finds a generic domain controller from directory service, then finds the primary domain controller. Then, finds a Windows 2000 domain controller (DC). If the tested domain is the primary domain, checks whether the domain GUID stored in Local Security Authority (LSA) is the same as the domain GUID stored in the DC. If not, the test returns a fatal error; if the /fix option is on, DsGetDC tries to fix the GUID in LSA.

  • IpConfig - IP address configuration test. Enumerates the TCP/IP configuration information for each network adapter.

  • IpLoopBk - IP address loopback ping test. Pings the IP loopback address of 127.0.0.1 for each adapter.

  • IPsec – Internet Protocol Security (IPsec) test. Tests whether IPsec is enabled and displays a list of active IPsec policies for the computer.

  • IPX - IPX test. Lists statistics for the IPX protocol installed on the computer.

  • Kerberos - Kerberos test. Checks whether the Kerberos package information is up-to-date.

  • Ldap - Lightweight Directory Access Protocol (LDAP) test. Contacts all available domain controllers and determines which LDAP authentication protocol is in use.

  • Member - Domain membership test. Checks to confirm details of the primary domain, including computer role, domain name, and domain GUID. Checks to see if NetLogon service is started, adds the primary domain to the domain list, and queries the primary domain security identifier (SID).

  • Modem - Modem diagnostics test. Lists configuration information for each modem found.

  • NbtNm - NetBT name test. Similar to the nbtstat -n command. It checks that the workstation service name <00> is equal to the computer name. It also checks that the messenger service name <03>, and server service name <20> are present on all interfaces and that none of these names are in conflict.

  • Ndis - Netcard queries test. Lists the network adapter configuration details, including the adapter name, configuration, media, globally unique identifier (GUID), and statistics. If this test shows an unresponsive network adapter, the remaining tests are aborted.

  • NetBTTransports - NetBT transports test. Lists the transport protocols that are bound to NetBT.

  • Netstat - Netstat information test. Lists protocol statistics and current TCP/IP connections.

  • Netware - Netware test. Queries the nearest Netware server for current login information.

  • Route - Routing table test. Lists static routes and whether they are persistent.

  • Trust - Trust relationship test. Tests trust relationships to the primary domain only if the computer is a member workstation, member server, or a Backup Domain Controller (BDC) domain controller that is not a PDC emulator. Checks that the primary domain security identifier (SID) is correct. Contacts an active DC. Connects to the SAM server on the DC. Uses the domain SID to open the domain to verify whether the domain SID is correct. Queries info of the secure channel for the primary domain. If the computer is a BDCDC, reconnects to the PDC emulator. If the computer is a member workstation or server, sets secure channel to each DC on the DC list for this domain.

  • WAN - Wide Area Network (WAN) configuration test. Lists settings and status on each COM port currently in use.

  • WINS - Windows Internet Name Service (WINS) service test. Tests the availability of the configured WINS server and the validity of the client registrations.

  • Winsock - Winsock test. Lists protocols and ports available to the WinSock service.

/skip: TestName

Skips the test specified by TestName. Nonskippable tests will still run.

Valid TestName values are:

  • Autonet - Automatic Private IP Addressing (APIPA) address test.

  • Bindings - Bindings test.

  • Browser - Redir and Browser test.

  • DcList - Domain controller list test.

  • DefGw - Default gateway test.

  • DNS - DNS test.

  • DsGetDc - Domain controller discovery test.

  • IpConfig - IP address configuration test.

  • IpLoopBk - IP address loopback ping test.

  • IPX - IPX test.

  • Kerberos - Kerberos test.

  • Ldap - Lightweight Directory Access Protocol (LDAP) test.

  • Modem - Modem diagnostics test.

  • NbtNm - NetBT name test.

  • Netstat - Netstat information test.

  • Netware - Netware test.

  • Route - Routing table test.

  • Trust - Trust relationship test.

  • WAN - Wide Area Network (WAN) configuration test.

  • WINS - Windows Internet Name Service (WINS) test.

  • Winsock - Winsock test.

Remarks

The NetDiag tool:

  • Gathers static network information and tests the network driver, protocol driver, send/receive capability, and well-known target accessibility.

  • Can be used by network administrators in conjunction with the Scheduler Service, to generate reports at regularly scheduled intervals.

Examples

If you have a problem connecting to a network resource and you only receive a “Network path not found” error message you can type the following at a command prompt:

Copy Code
netdiag

When executed in this scenario, NetDiag performs tests on each network adapter, and a set of global tests. The tests on the network adapters are performed in the following order:

  • Netcard queries test

  • IpConfig test

  • Autoconfiguration test (APIPA)

  • Default gateway test

  • NetBT name test

  • WINS Service test

Next in this example NetDiag performs a set of global tests in the following order:

  • Domain membership test

  • NetBT transports test

  • Autonet address test (APIPA)

  • IP loopback ping test

  • Default gateway test

  • NetBT name test

  • Winsock test

  • DNS test

  • Redir and Browser test

  • DC discovery test

  • DC list test

  • Trust relationship test

  • Kerberos test

  • LDAP test

  • Bindings test

  • WAN configuration test

  • Modem configuration test

  • IP Security test

The results of these tests show that the network adapter protocol, bindings, and IP address tests succeed. The DNS ping test fails and reports that the DNS server cannot be contacted.

With this information, the administrator knows that either the DNS server address is incorrect, or the DNS server is not responding. Because the DNS address is also displayed as output, you can easily verify whether it is correct.

After the problem is isolated, the administrator can perform additional troubleshooting to determine why the DNS server is down.

Sample NetDiag Output:

Copy Code
Computer Name: RKSRVR-2
    DNS Host Name: rksrvr-2.reskita.microsoft.com
    System info : Windows 2000 Server (Build 2467)
    Processor : x86 Family 6 Model 6 Stepping 0, GenuineIntel
    List of installed hotfixes :
        Q147222

Netcard queries test . . . . . . . : Passed
    [WARNING] The net card 'Intel(R) PRO/100+ Management Adapter' may not be working.

Per interface results:

    Adapter : Local Area Connection

        Netcard queries test . . . : Passed

        Host Name. . . . . . . . . : rksrvr-2
        IP Address . . . . . . . . : 10.10.1.51
        Subnet Mask. . . . . . . . : 255.255.255.0
        Default Gateway. . . . . . :
        Dns Servers. . . . . . . . : 10.10.1.77

        AutoConfiguration results. . . . . . : Passed

        Default gateway test . . . : Skipped
            [WARNING] No gateways defined for this adapter.

        NetBT name test. . . . . . : Passed

        WINS service test. . . . . : Skipped
            There are no WINS servers configured for this interface.

    Adapter : Local Area Connection 2

        Netcard queries test . . . : Failed
        NetCard Status:          DISCONNECTED
            Some tests will be skipped on this interface.

        Host Name. . . . . . . . . : rksrvr-2
        Autoconfiguration IP Address : 169.254.74.217
        Subnet Mask. . . . . . . . : 255.255.0.0
        Default Gateway. . . . . . :
        Dns Servers. . . . . . . . :

Global results:

Domain membership test . . . . . . : Passed

NetBT transports test. . . . . . . : Passed
    List of NetBt transports currently configured:
        NetBT_Tcpip_{A2D04C22-3BB8-4FA0-B7DA-414DC1DD08A7}
        NetBT_Tcpip_{56079E37-8246-4712-8B36-F503FF6F9873}
    2 NetBt transports currently configured.

Autonet address test . . . . . . . : Passed

IP loopback ping test. . . . . . . : Passed

Default gateway test . . . . . . . : Failed

    [FATAL] NO GATEWAYS ARE REACHABLE.
    You have no connectivity to other network segments.
    If you configured the IP protocol manually then
    you need to add at least one valid gateway.

NetBT name test. . . . . . . . . . : Passed

Winsock test . . . . . . . . . . . : Passed

DNS test . . . . . . . . . . . . . : Failed
          [WARNING] Cannot find a primary authoritative DNS server for the name
            'bdover.reskita.microsoft.com.'. [ERROR_TIMEOUT]
            The name 'bdover.reskita.microsoft.com.' may not be registered in DNS.

       [WARNING] The DNS entries for this DC cannot be verified right now on DNS
 server 10.10.1.77, ERROR_TIMEOUT.
    [FATAL] No DNS servers have the DNS records for this DC registered.

Redir and Browser test . . . . . . : Passed
    List of NetBt transports currently bound to the Redir
        NetBT_Tcpip_{A2D04C22-3BB8-4FA0-B7DA-414DC1DD08A7}
        NetBT_Tcpip_{56079E37-8246-4712-8B36-F503FF6F9873}
    The redir is bound to 2 NetBt transports.

    List of NetBt transports currently bound to the browser
        NetBT_Tcpip_{A2D04C22-3BB8-4FA0-B7DA-414DC1DD08A7}
        NetBT_Tcpip_{56079E37-8246-4712-8B36-F503FF6F9873}
    The browser is bound to 2 NetBt transports.

DC discovery test. . . . . . . . . : Passed

DC list test . . . . . . . . . . . : Passed

Trust relationship test. . . . . . : Failed
    Secure channel for domain 'RESKITA' is to '\\a-dcp.reskita.microsoft.com'.
    [FATAL] Cannot set secure channel for domain 'RESKITA' to PDC emulator. [ERR
OR_NO_LOGON_SERVERS]

Kerberos test. . . . . . . . . . . : Passed

LDAP test. . . . . . . . . . . . . : Passed
    [WARNING] Failed to query SPN registration on DC 'a-dcp.reskita.microsoft.com'.
    [WARNING] Failed to query SPN registration on DC 'a-dc1.reskita.microsoft.com'.
    [WARNING] Failed to query SPN registration on DC 'a-dc3.reskita.microsoft.com'.

Bindings test. . . . . . . . . . . : Passed

WAN configuration test . . . . . . : Skipped
    No active remote access connections.

Modem diagnostics test . . . . . . : Passed

IP Security test . . . . . . . . . : Passed
    Service status  is: Started
    Service startup is: Automatic
    IPSec service is available, but no policy is assigned or active

    Note: run "ipseccmd /?" for more detailed information

The command completed successfully

Additional references

  • Command-Line Syntax Key


Netsh

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Server 2003 R2,Windows Server 2003

Netsh is a command-line scripting utility that allows you to, either locally or remotely, display or modify the network configuration of a currently running computer.

There are functional differences between netsh commands on Windows Server® 2003, Windows Server® 2008, and Windows Server® 2008 R2:

  • For more information about netsh commands on Windows Server 2003, see Netsh.

  • For more information about netsh commands for Windows Server 2008 and Windows Server 2008 R2, see Netsh Technical Reference.


Netstat
See Also

Applies To: Windows Server 2008 R2,Windows Server 2008

Netstat

Displays active TCP connections, ports on which the computer is listening, Ethernet statistics, the IP routing table, IPv4 statistics (for the IP, ICMP, TCP, and UDP protocols), and IPv6 statistics (for the IPv6, ICMPv6, TCP over IPv6, and UDP over IPv6 protocols). Used without parameters, netstat displays active TCP connections.
Syntax

netstat[-a] [-e] [-n] [-o] [-p Protocol] [-r] [-s] [Interval]

Parameters
-a

Displays all active TCP connections and the TCP and UDP ports on which the computer is listening.

-e

Displays Ethernet statistics, such as the number of bytes and packets sent and received. This parameter can be combined with -s.

-n

Displays active TCP connections, however, addresses and port numbers are expressed numerically and no attempt is made to determine names.

-o

Displays active TCP connections and includes the process ID (PID) for each connection. You can find the application based on the PID on the Processes tab in Windows Task Manager. This parameter can be combined with -a, -n, and -p.

-p Protocol

Shows connections for the protocol specified by Protocol. In this case, the Protocol can be tcp, udp, tcpv6, or udpv6. If this parameter is used with -s to display statistics by protocol, Protocol can be tcp, udp, icmp, ip, tcpv6, udpv6, icmpv6, or ipv6.

-s

Displays statistics by protocol. By default, statistics are shown for the TCP, UDP, ICMP, and IP protocols. If the IPv6 protocol is installed, statistics are shown for the TCP over IPv6, UDP over IPv6, ICMPv6, and IPv6 protocols. The -p parameter can be used to specify a set of protocols.

-r

Displays the contents of the IP routing table. This is equivalent to the route print command.

Interval

Redisplays the selected information every Interval seconds. Press CTRL+C to stop the redisplay. If this parameter is omitted, netstat prints the selected information only once.

/?

Displays help at the command prompt.

Remarks
  • Parameters used with this command must be prefixed with a hyphen (-) rather than a slash (/).

  • Netstat provides statistics for the following:

    • Proto

      The name of the protocol (TCP or UDP).

    • Local Address

      The IP address of the local computer and the port number being used. The name of the local computer that corresponds to the IP address and the name of the port is shown unless the -n parameter is specified. If the port is not yet established, the port number is shown as an asterisk (*).

    • Foreign Address

      The IP address and port number of the remote computer to which the socket is connected. The names that corresponds to the IP address and the port are shown unless the -n parameter is specified. If the port is not yet established, the port number is shown as an asterisk (*).

    • (state)

      Indicates the state of a TCP connection. The possible states are as follows:

      CLOSE_WAIT

      CLOSED

      ESTABLISHED

      FIN_WAIT_1

      FIN_WAIT_2

      LAST_ACK

      LISTEN

      SYN_RECEIVED

      SYN_SEND

      TIMED_WAIT

      For more information about the states of a TCP connection, see RFC 793.

  • This command is available only if the Internet Protocol (TCP/IP) protocol is installed as a component in the properties of a network adapter in Network Connections.

Examples

To display both the Ethernet statistics and the statistics for all protocols, type:

netstat -e -s

To display the statistics for only the TCP and UDP protocols, type:

netstat -s -p tcp udp

To display active TCP connections and the process IDs every 5 seconds, type:

netstat -o 5

To display active TCP connections and the process IDs using numerical form, type:

netstat -n -o

Formatting legend

Format | Meaning
Italic | Information that the user must supply
Bold | Elements that the user must type exactly as shown
Ellipsis (...) | Parameter that can be repeated several times in a command line
Between brackets ([]) | Optional items
Between braces ({}); choices separated by pipe (|). Example: {even|odd} | Set of choices from which the user must choose only one
Courier font | Code or program output

See Also

Command-line reference A-ZCommand shell overview


Net computer

Applies To: Windows Server 2008,Windows Server 2003 with SP1,Windows Vista,Windows Server 2003,Windows Server 2000,Windows Server 2003 R2

Adds or deletes a computer from a domain database.

Net computer is a command-line tool that is built into Windows Vista. To run net computer, open a command prompt, type net computer with the appropriate parameter, and then press ENTER.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
net computer \\<ComputerName> {/add | /del}

Parameters

Parameter | Description
\\<ComputerName> | Specifies the computer to add or delete from the domain database for the domain in which you are currently logged on. You can specify only one computer. You cannot specify other domains.
{/add | /del} | Adds or deletes the specified computer from the domain database.
net help <Command> | Displays Help for the specified net command.

Remarks

  • When you run net computer from an administrative workstation, it forwards all computer additions and deletions to a domain controller.

Examples

The following command adds the computer Grizzlybear to the domain database:

Copy Code
net computer \\grizzlybear /add

Additional references

Command-Line Syntax Key


Net group

Applies To: Windows Server 2003 R2,Windows Server 2000,Windows Server 2003,Windows Vista,Windows Server 2003 with SP1,Windows Server 2008

Adds, displays, or modifies global groups in domains.

Net group is a command-line tool that is built into Windows Vista. To run net group, open a command prompt, type net group with the appropriate parameters, and then press ENTER.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
net group [<GroupName> [/comment:"<Text>"]] [/domain]
net group [<GroupName>{/add [/comment:"<Text>"] | /delete} [/domain]]
net group [<GroupName> <UserName>[ ...] {/add | /delete} [/domain]]

Parameters

Parameter | Description
<GroupName> | Specifies the name of the group to add, expand, or delete. Specify a group name to view a list of users in a group only.
/comment:"<Text>" | Adds a comment for a new or existing group. The comment can have as many as 48 characters. Enclose the text in quotation marks.
/domain | Performs the operation on the domain controller in the current domain. Otherwise, the operation is performed on the local computer.
/add | Adds a group, or adds a user name to a group. You must establish accounts for users that you add to a group with this command.
/delete | Removes a group, or removes a user name from a group.
<UserName>[ ...] | Lists one or more user names to add to or remove from a group. Separate multiple user names with a space.
net help <command> | Displays help for the specified net command.

Remarks

  • When you use net group without parameters, this command displays the name of a server and the names of groups on the server.

  • You can also type net groups to get the same output.

  • You can use net group to group users who use the network in the same or similar ways. When you assign rights to a group, each member of the group automatically has those rights. In the command output, net group precedes groups that include both users and groups with an asterisk (*).

    The net group output of groups on the server is similar to the following:

    Copy Code
    Group Accounts for \\PRODUCTION
----------------------------------------------
*Domain Admins           *Domain Users

Examples

This example lists all the groups on the local server:

Copy Code
net group

This example adds a group called Exec to the local user accounts database:

Copy Code
net group exec /add

This example adds a group called Exec to the domain database:

Copy Code
net group exec /add /domain

This example adds the existing user accounts estherv, ralfr, and stevent to the Exec group on the local computer:

Copy Code
net group exec estherv ralfr stevent /add

This example adds the existing user accounts estherv, ralfr, and stevent to the Exec group in the domain database:

Copy Code
net group exec estherv ralfr stevent /add /domain

This example displays users in the Exec group:

Copy Code
net group exec

This example adds a comment to the Exec group record:

Copy Code
net group exec /comment:"The executive staff"

Additional references

Command-Line Syntax Key


Net localgroup

Applies To: Windows Server 2008

Adds, displays, or modifies local groups. Used without parameters, net localgroup displays the name of the server and the names of local groups on the computer.

Net localgroup is a command-line tool that is built into Windows Vista. To run net localgroup, open a command prompt, type net localgroup with the appropriate parameters, and then press ENTER.

For examples of how to use this command, see Examples.

Syntax

Copy Code
net localgroup [<GroupName> [/comment:"<Text>"]] [/domain]
net localgroup [<GroupName> {/add [/comment:"<Text>"] | /delete} [/domain]
net localgroup [<GroupName> <Name> […] {/add |  /delete} [/domain]

Parameters

<GroupName>

Specifies the name of the local group to add, expand, or delete. Used without additional parameters, net localgroup <GroupName> displays a list of users or global groups in a local group.

/comment:"<Text>"

Adds a comment for a new or existing group. The comment can contain up to 256 characters. Enclose the text in quotation marks.

/domain

Performs the operation on the primary domain controller of the current domain. Otherwise, the operation is performed on the local computer.

<Name>[ ...]

Lists one or more user names or group names to add or remove from a local group.

/add

Adds a global group name or user name to a local group. You must first establish an account for users or global groups before you can add it to a local group with this command.

/delete

Removes a group name or user name from a local group.

net help <Command>

Displays help for the specified net command.

Remarks <optional section>

  • Using /domain

    /domain applies only to computers that are members of a domain. By default, server computers perform operations on the primary domain controller.

  • Using Name

    Separate multiple entries with a space. Names can be local users, users on other domains, or global groups, but not other local groups. If a user is from another domain, preface the user name with the domain name (for example, Sales\Ralphr).

  • Grouping users

    Use net localgroup to group users who use the computer or network in the same or similar ways. When you assign rights to a local group, each member of the local group automatically has the same rights.

Examples

The following example displays a list of all the local groups on the local server, type:

Copy Code
net localgroup

The following example adds a local group called Exec to the local user accounts database, type:

net localgroup exec /add

The following example adds a local group called Exec to the domain user accounts database, type:

net localgroup exec /add /domain

The following example adds the existing user accounts stevev, ralphr (from the Sales domain), and jennyt to the Exec local group on the local computer, type:

net localgroup exec stevev sales\ralphr jennyt /add

The following example adds the existing user accounts stevev, ralphr, and jennyt to the Exec group of a domain, type:

net localgroup exec stevev ralphr jennyt /add /domain

The following example displays users in the Exec local group, type:

net localgroup exec

The following example adds a comment to the Exec local group record, type:

net localgroup exec /comment:"The executive staff."

Additional references

Command-Line Syntax Key


Net print

Applies To: Windows Server 2008,Windows Vista

Displays information about a specified printer queue or a specified print job, or controls a specified print job.

For examples of how to use this command, see the Examples section of this document.

Note
This command has been deprecated in Windows 7 and Windows Server 2008 R2. However, you can perform many of the same tasks using Prnjobs.vbs, Windows Management Instrumentation (WMI), or Windows PowerShell cmdlets. For more information, see Prnjobs.vbs, Windows Management Instrumentation (http://go.microsoft.com/fwlink/?LinkID=29991), Windows PowerShell (http://go.microsoft.com/fwlink/?LinkID=128426), and the TechNet Script Center Gallery (http://go.microsoft.com/fwlink/?LinkId=164635).

Syntax

Copy Code
Net print {\\<ComputerName>\<ShareName> |
\\<ComputerName> <JobNumber> [/hold | /release | /delete]} [help]

Parameters

Parameters Description

\\<ComputerName>\<ShareName>

Specifies (by name) the computer and print queue about which you want to display information.

\\<ComputerName>

Specifies (by name) the computer that hosts the print job you want to control. If you do not specify a computer, the local computer is assumed. Requires the <JobNumber> parameter.

<JobNumber>

Specifies the number of the print job you want to control. This number is assigned by the computer that hosts the print queue where the print job is sent. After a computer assigns a number to a print job, that number is not assigned to any other print jobs in any queue hosted by that computer. Required when using the \\<ComputerName> parameter.

[/hold | /release | /delete]

Specifies the action to take with the print job.

  • The /hold parameter delays the job, allowing other print jobs to bypass it until it is released.

  • The /release parameter releases a print job that has been delayed.

  • The /delete parameter removes a print job from a print queue.

If you specify a job number, but do not specify any action, information about the print job is displayed.

help

Displays help for the Net print command.

Remarks

  • Net print \\<ComputerName> displays information about print jobs in a shared printer queue. The following is an example of a report for all print jobs in a queue for a shared printer named LASER:

    Copy Code
    Printers at \\PRODUCTION
Name              Job #      Size      Status
---------------------------------------------------------
LASER Queue       3 jobs               *Printer Active*
   USER1          84        93844      Printing
   USER2          85        12555      Waiting
   USER3          86        10222      Waiting
  • The following is an example of a report for a print job:

    Copy Code
    Job #            35
Status           Waiting
Size             3096
Remark
Submitting user  USER2
Notify           USER2
Job data type
Job parameters
Additional info

Examples

This example shows how to list the contents of the Dotmatrix print queue on the \\Production computer:

Copy Code
Net print \\Production\Dotmatrix

This example shows how to display information about job number 35 on the \\Production computer:

Copy Code
Net print \\Production 35

This example shows how to delay job number 263 on the \\Production computer:

Copy Code
Net print \\Production 263 /hold

This example shows how to release job number 263 on the \\Production computer:

Copy Code
Net print \\Production 263 /release

Additional references

Command-Line Syntax Key

Print Command Reference


Net user

Applies To: Windows Vista,Windows Server 2003,Windows Server 2000,Windows Server 2003 R2,Windows Server 2008,Windows Server 2003 with SP1

Adds or modifies user accounts, or displays user account information.

Net user is a command-line tool that is built into Windows Vista. To run net user, open a command prompt, type net user with the appropriate parameters, and then press ENTER.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
net user [<UserName> {<Password> | *} [<Options>]] [/domain]
net user [<UserName> {<Password> | *} /add [<Options>] [/domain]]
net user [<UserName> [/delete] [/domain]]

Parameters

Parameter | Description
<UserName> | Specifies the name of the user account to add, delete, modify, or view. The name of the user account can have as many as 20 characters.
<Password> | Assigns or changes a password for the user's account. Type an asterisk (*) to produce a prompt for the password. The password is not displayed when the user types it at the password prompt.
/domain | Performs the operation on the domain controller in the computer's primary domain.
<Options> | Specifies a command-line option. Refer to the next table for descriptions of the command-line option syntax.
net help <Command> | Displays help for the specified net command.

Command-line option syntax | Description
/active:{no | yes} | Enables or disables the user account. If the user account is not active, the user cannot access resources on the computer. The default is yes (that is, active).
/comment:"<Text>" | Provides a descriptive comment about the user's account. This comment can have as many as 48 characters. Enclose the text in quotation marks.
/countrycode:<NNN> | Uses the operating system Country/Region codes to implement the specified language files for a user's Help and error messages. A value of 0 signifies the default Country/Region code.
/expires:{{<MM/DD/YYYY> | <DD/MM/YYYY> | <mmm,dd,YYYY>} | never} | Causes the user account to expire if you specify the date. Expiration dates can be in [MM/DD/YYYY], [DD/MM/YYYY], or [mmm,dd,YYYY] formats, depending on the Country/Region code. Note that the account expires at the beginning of the specified date. For the month value, you can use numbers, spell it out, or use a three-letter abbreviation (that is, Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec). You can use two or four numbers for the year value. Use commas or slashes to separate parts of the date. Do not use spaces. If you omit <YYYY>, the next occurrence of the date (that is, according to your computer's date and time) is assumed. For example, the following entries are equivalent if entered between Jan. 10, 1994, and Jan. 8, 1995: jan,9 1/9/95 january,9,1995 1/9
/fullname:"<Name>" | Specifies a user's full name rather than a user name. Enclose the name in quotation marks.
/homedir:<Path> | Sets the path for the user's home directory. The path must exist.
/passwordchg:{yes | no} | Specifies whether users can change their own password. The default is yes.
/passwordreq:{yes | no} | Specifies whether a user account must have a password. The default is yes.
/profilepath:[<Path>] | Sets a path for the user's logon profile. This path points to a registry profile.
/scriptpath:<Path> | Sets a path for the user's logon script. <Path> cannot be an absolute path. <Path> is relative to %systemroot%\System32\Repl\Import\Scripts.
/times:{<Day>[<-Day>][,<Day>[-<Day>]],<Time>[-<Time>][,<Time>[-<Time>]][;] | all} | Specifies the times that users are allowed to use the computer. <Time> is limited to one-hour increments. For the <Day> values, you can spell out the names of the days or use abbreviations (that is, M,T,W,Th,F,Sa,Su). You can use 12-hour or 24-hour notation for hours. If you use 12-hour notation, use AM and PM, or A.M. and P.M. The value all means a user can always log on. A null value (blank) means a user can never log on. Separate day and time with commas, and separate units of day and time with semicolons (for example, M,4AM-5PM;T,1PM-3PM). Do not use spaces when you designate times.
/usercomment:"<Text>" | Specifies that an administrator can add or change the "User comment" for the account. Enclose the text in quotation marks.
/workstations:{<ComputerName>[,...] | *} | Lists as many as eight workstations from which a user can log on to the network. Separate multiple entries in the list with commas. If /workstations has no list or if the list is an asterisk (*), users can log on from any computer.

Remarks

  • When you use net user without parameters, it displays a list of the user accounts on the computer. You can also type net users.

  • A password must satisfy the minimum password length value that is set with the net accounts /minpwlen command. A password can have as many as 127 characters.

Examples

The following example displays a list of all user accounts for the local computer:

Copy Code
net user

The following example displays information about the user account tommyh:

Copy Code
net user tommyh

The following example adds a user account for a user whose full name is Jay Jamison and whose user account name is jayj, with logon rights from 8 A.M. to 5 P.M., Monday through Friday (no spaces in time designations), a mandatory password (Cyk4^g3B), and the user's full name:

Copy Code
net user jayj Cyk4^g3B /add /passwordreq:yes /times:monday-friday,8am-5pm /fullname:"Jay Jamison"

The following example sets the logon time (8 A.M. to 5 P.M.) for miked by using 24-hour notation:

Copy Code
net user miked /time:M-F,08:00-17:00

The following example sets the logon time (8 A.M. to 5 P.M.) for miked by using 12-hour notation:

Copy Code
net user miked /time:M-F,8AM-5PM

The following example specifies logon hours of 4 A.M. until 5 P.M. on Monday, 1 P.M. until 3 P.M. on Tuesday, and 8 A.M. until 5 P.M. Wednesday through Friday for anibals:

Copy Code
net user anibals /time:M,4AM-5PM;T,1PM-3PM;W-F,8:00-17:00

Additional references

Command-Line Syntax Key


Nfsadmin

Applies To: Windows Server 2008,Windows Vista

You can use nfsadmin to manage Server for NFS and Client for NFS.

Syntax

nfsadmin server [ComputerName] [-u UserName[-p Password]] -l

nfsadmin server [ComputerName] [-u UserName [-p Password]] -r {client | all}

nfsadmin server [ComputerName] [-u UserName [-p Password]] {start | stop}

nfsadmin server [ComputerName] [-u UserName [-p Password]] config Option[...]

nfsadmin server [ComputerName] [-u UserName [-p Password]] creategroup Name

nfsadmin server [ComputerName] [-u UserName [-p Password]] listgroups

nfsadmin server [ComputerName] [-u UserName [-p Password]] deletegroup Name

nfsadmin server [ComputerName] [-u UserName [-p Password]] renamegroup OldName NewName

nfsadmin server [ComputerName] [-u UserName [-p Password]] addmembers Name Host[...]

nfsadmin server [ComputerName] [-u UserName [-p Password]] listmembers

nfsadmin server [ComputerName] [-u UserName [-p Password]] deletemembers Group Host[...]

nfsadmin client [ComputerName] [-u UserName [-p Password]] {start | stop}

nfsadmin client [ComputerName] [-u UserName [-p Password]] config Option[...]

Description

The nfsadmin command-line utility administers Server for NFS or Client for NFS on the local or remote computer running Microsoft Services for Network File System (NFS). If you are logged on with an account that does not have the required privileges, you can specify a user name and password of an account that does. The action performed by nfsadmin depends on the command arguments you supply.

In addition to service-specific command arguments and options, nfsadmin accepts the following:

ComputerName

Specifies the remote computer you want to administer. You can specify the computer using a Windows Internet Name Service (WINS) name or a Domain Name System (DNS) name, or by Internet Protocol (IP) address.

-u UserName

Specifies the user name of the user whose credentials are to be used. It might be necessary to add the domain name to the user name in the form domain\UserName

-p Password

Specifies the password of the user specified using the -u option. If you specify the -u option but omit the -p option, you are prompted for the user's password.

Administering Server for NFS

Use the nfsadmin server command to administer Server for NFS. The specific action that nfsadmin server takes depends on the command option or argument you specify:

-l

Lists all locks held by clients.

-r {client | all}

Releases the locks held by a client or, if all is specified, by all clients.

start

Starts the Server for NFS service.

stop

Stops the Server for NFS service.

config

Specifies general settings for Server for NFS. You must supply at least one of the following options with the config command argument:

mapsvr=server

Sets server as the User Name Mapping server for Server for NFS. Although this option continues to be supported for compatibility with previous versions, you should use the sfuadmin utility instead.

auditlocation={eventlog | file | both | none}

Specifies whether events will be audited and where the events will be recorded. One of the following arguments is required.

eventlog

Specifies that audited events will be recorded only in the Event Viewer application log.

file

Specifies that audited events will be recorded only in the file specified by config fname.

both

Specifies that audited events will be recorded in the Event Viewer application log as well as the file specified by config fname.

none

Specifies that events will not be audited.

fname=file

Sets the file specified by file as the audit file. The default is %sfudir%\log\nfssvr.log

fsize==size

Sets size as the maximum size in megabytes of the audit file. The default maximum size is 7 MB.

audit=[+|-]mount [+|-]read [+|-]write [+|-]create [+|-]delete [+|-]locking [+|-]all

Specifies the events to be logged. To start logging an event, type a plus sign (+) before the event name; to stop logging an event, type a minus sign (-) before the event name. If the sign is omitted, the plus sign is assumed. Do not use all with any other event name.

lockperiod=seconds

Specifies the number of seconds that Server for NFS will wait to reclaim locks after a connection to Server for NFS has been lost and then reestablished or after the Server for NFS service has been restarted.

Portmapprotocol={TCP | UDP | TCP+UDP

Specifies which transport protocols Portmap supports. The default setting is TCP+UDP.

mountprotocol={TCP | UDP | TCP+UDP}

Specifies which transport protocols mount supports. The default setting is TCP+UDP.

nfsprotocol={TCP | UDP | TCP+UDP}

Specifies which transport protocols Network File System (NFS) supports. The default setting is TCP+UDP

nlmprotocol={TCP | UDP | TCP+UDP}

Specifies which transport protocols Network Lock Manager (NLM) supports. The default setting is TCP+UDP.

nsmprotocol={TCP | UDP | TCP+UDP}

Specifies which transport protocols Network Status Manager (NSM) supports. The default setting is TCP+UDP.

enableV3={yes | no}

Specifies whether NFS version 3 protocols will be supported. The default setting is yes.

renewauth={yes | no}

Specifies whether client connections will be required to be reauthenticated after the period specified by config renewauthinterval. The default setting is no.

renewauthinterval=seconds

Specifies the number of seconds that elapse before a client is forced to be reauthenticated if config renewauth is set to yes. The default value is 600 seconds.

dircache=size

Specifies the size in kilobytes of the directory cache. The number specified as size must be a multiple of 4 between 4 and 128. The default directory-cache size is 128 KB.

translationfile=[file]

Specifies a file containing mapping information for replacing characters in the names of files when moving them from Windows-based to UNIX-based file systems. If file is not specified, then file name character translation is disabled. If the value of translationfile is changed, you must restart the server for the change to take effect.

dotfileshidden={yes | no}

Specifies whether files that are created with names beginning with a period (.) will be marked as hidden in the Windows file system and consequently hidden from NFS clients. The default setting is no.

casesensitivelookups={yes | no}

Specifies whether directory lookups will be case sensitive (requiring exact matching of character case).

You also need to disable Windows kernel case-insensitivity in order for Server for NFS to support case-sensitive file names. You can disable Windows kernel case-insensitivity by clearing the following registry key to 0:

HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\kernel

DWORD “obcaseinsensitive”

ntfscase={lower | upper | preserve}

Specifies whether the case of characters in the names of files in the NTFS file system will be returned in lowercase, uppercase, or in the form stored in the directory. The default setting is preserve. This setting cannot be changed if casesensitivelookups is set to yes.

creategroup name

Creates a new client group, giving it the specified name.

listgroups

Displays the names of all client groups.

deletegroup name

Removes the client group specified by name.

renamegroup OldName NewName

Changes the name of the client group specified by OldName to NewName

addmembers Name Host[...]

Adds Host to the client group specified by Name.

listmembers Name

Lists the host computers in the client group specified by Name.

deletemembers Group Host[...]

Removes the client specified by Host from the client group specified by Group.

If you do not specify a command option or argument, nfsadmin server displays the current Server for NFS configuration settings.

Administering Client for NFS

Use the nfsadmin client command to administer Client for NFS. The specific action that nfsadmin client takes depends on the command argument you specify:

start

Starts the Client for NFS service.

stop

Stops the Client for NFS service.

config

Specifies general settings for Client for NFS. You must supply at least one of the following options with the config command argument:

fileaccess=mode

  • Specifies the default permission mode for files created on Network File System (NFS) servers. The mode argument consists of a three digits from 0 to 7 (inclusive) representing the default permissions granted the user, group, and others (respectively). The digits translate to UNIX-style permissions as follows: 0=none, 1=x, 2=w, 3=wx, 4=r, 5=rx, 6=rw, and 7=rwx. For example, fileaccess=750 gives rwx permission to the owner, rx permission to the group, and no access permission to others.

mapsvr=server

Sets server as the User Name Mapping server for Client for NFS. Although this option continues to be supported for compatibility with previous versions, you should use the sfuadmin utility instead.

mtype={hard | soft}

Specifies the default mount type. For a hard mount, Client for NFS continues to retry a failed RPC until it succeeds. For a soft mount, Client for NFS returns failure to the calling application after retrying the call the number of times specified by the retry option.

retry=number

Specifies the number of times to try to make a connection for a soft mount. This value must be from 1 to 10, inclusive. The default is 1.

timeout=seconds

Specifies the number of seconds to wait for a connection (remote procedure call). This value must be 0.8, 0.9, or an integer from 1 to 60, inclusive. The default is 0.8.

Protocol={TCP | UDP | TCP+UDP}

Specifies which transport protocols the client supports. The default setting is TCP+UDP

rsize=size

Specifies the size, in kilobytes, of the read buffer. This value can be 0.5, 1, 2, 4, 8, 16, or 32. The default is 32.

wsize=size

Specifies the size, in kilobytes, of the write buffer. This value can be 0.5, 1, 2, 4, 8, 16, or 32. The default is 32.

perf=default

Restores the following performance settings to default values:

  • mtype

  • retry

  • timeout

  • rsize

  • wsize

fileaccess=mode

Specifies the default permission mode for files created on Network File System (NFS) servers. The mode argument consists of a three digits from 0 to 7 (inclusive) representing the default permissions granted the user, group, and others (respectively). The digits translate to UNIX-style permissions as follows: 0=none, 1=x, 2=w, 3=wx, 4=r, 5=rx, 6=rw, and 7=rwx. For example, fileaccess=750 gives rwx permission to the owner, rx permission to the group, and no access permission to others.

If you do not specify a command option or argument, nfsadmin client displays the current Client for NFS configuration settings.


Nfsshare
See Also

Applies To: Windows Vista,Windows Server 2008

You can use nfsshare to control Network File System (NFS) shares.

Syntax

nfsshare <ShareName>=<Drive:Path> [-o <Option=value>...]

nfsshare {<ShareName> | <Drive>:<Path> | * } /delete

Description

Without arguments, the nfsshare command-line utility lists all Network File System (NFS) shares exported by Server for NFS. With ShareName as the only argument, nfsshare lists the properties of the NFS share identified by ShareName. When ShareName and Drive:Path are provided, nfsshare exports the folder identified by Drive:Path as ShareName. When the /delete option is used, the specified folder is no longer made available to NFS clients.

Options

The nfsshare command accepts the following options and arguments:

Term Definition

-o anon={yes | no}

Specifies whether anonymous (unmapped) users can access the shared directory. The default is no.

-o rw[=<Host>[:<Host>]...]

Provides read-write access to the shared directory by the hosts or client groups specified by Host. Separate host and group names with a colon (:). If Host is not specified, all hosts and client groups (except those specified with the ro option) have read-write access. If neither the ro nor the rw option is set, all clients have read-write access to the shared directory.

-o ro[=<Host>[:<Host>]...]

Provides read-only access to the shared directory by the hosts or client groups specified by Host. Separate host and group names with a colon (:). If Host is not specified, all clients (except those specified with the rw option) have read-only access. If the ro option is set for one or more clients, but the rw option is not set, only the clients specified with the ro option have access to the shared directory.

-o encoding={big5|euc-jp|euc-kr|euc-tw|gb2312-80|ksc5601|shift-jis}

Specifies the default encoding used for file and directory names and, if used, must be set to one of the following:

  • big5 (Chinese)

  • euc-jp (Japanese)

  • euc-kr (Korean)

  • euc-tw (Chinese)

  • gb2312-80 (Simplified Chinese)

  • ksc5601 (Korean)

  • shift-jis (Japanese)

If this is option is not set, the default encoding scheme is ANSI or, on systems configured for non-English locales, the default encoding scheme for the locale. The following are the default encoding schemes for the indicated locales:

  • Japanese: SHIFT-JIS

  • Korean: KS_C_5601-1987

  • Simplified Chinese: GB2312-80

Traditional Chinese: BIG5

-o anongid=<gid>

Specifies that anonymous (unmapped) users will access the share directory using gid as their group identifier (GID). The default is -2. The anonymous GID will be used when reporting the owner of a file owned by an unmapped user, even if anonymous access is disabled.

-o anonuid=<uid>

Specifies that anonymous (unmapped) users will access the share directory using uid as their user identifier (UID). The default is -2. The anonymous UID will be used when reporting the owner of a file owned by an unmapped user, even if anonymous access is disabled.

-o root[=<Host>[:<Host>]...]

Provides root access to the shared directory by the hosts or client groups specified by Host. Separate host and group names with a colon (:). If Host is not specified, all clients have root access. If the root option is not set, no clients have root access to the shared directory.

/delete

If ShareName or Drive:Path is specified, deletes the specified share. If * is specified, deletes all NFS shares.

Note
To view the complete syntax for this command, at a command prompt, type:

nfsshare /?

See Also

Concepts

Services for Network File System Command Reference


Nfsstat

Applies To: Windows Server 2008,Windows Vista

You can use nfsstat to display or reset counts of calls made to Server for NFS.

Syntax

nfsstat [-z]

Description

When used without the -z option, the nfsstat command-line utility displays the number of NFS V2, NFS V3, and Mount V3 calls made to the server since the counters were set to 0, either when the service started or when the counters were reset using nfsstat -z.


Nlb

Applies To: Windows Server 2008,Windows Server 2008 R2

After you have installed and configured Network Load Balancing (NLB), you can control its operations and modify parameter settings using the NLB control program, nlb.exe. To simplify and centralize system administration, you can run nlb.exe either on the cluster hosts or on any remote computer running Windows Server® 2008 that can access the cluster over a local or wide area network. However, certain actions, such as modifying parameters, can be performed only on the cluster hosts.

In order to run nlb.exe from a remote computer, remote control must be enabled. The NLB remote control option presents many security risks, including the possibility of data tampering, denial of service and information disclosure. You should only use remote control on a secure computer within your firewall. Because of the many security risks remote control presents, it is strongly recommended that you do not enable the remote control feature and instead use other remote management tools such as NLB Manager or Windows Management Instrumentation (WMI).

If you choose to enable remote control it is vital that you restrict access by specifying a strong remote control password. It is recommended that you use a firewall to protect the NLB UDP control ports (the ports receiving remote control commands) in order to shield them from outside intrusion. By default, these are ports 1717 and 2504 at the cluster IP address.

Because it is a shell-based program, nlb.exe program can be incorporated into administrative scripts.

Syntax

Copy Code
nlb Command [Remote Options][/h]

Parameters

Command. Specifies the Network Load Balancing action to perform. The following table lists the possible values.

Parameter Description

help

Displays the online Help.

suspend [{Cluster[:Host] | all {local | global}}]

Suspends all cluster operations until the resume command is issued. Suspend temporarily stops cluster operations if they were previously started. The purpose of this command is to override any remote control commands that might be issued. All subsequent cluster-control commands except resume and query are ignored. The optional parameters allow the command to address a specific cluster, a specific cluster on a specific host, all clusters on the local computer, or all global computers that are part of the cluster.

resume [{Cluster[:Host] | all {local | global}}]

Resumes cluster operations after a previous suspend command. This does not restart cluster operations, but enables use of cluster-control commands, including remote control commands. The optional parameters allow the command to address a specific cluster, a specific cluster on a specific host, all clusters on the local computer, or all global computers that are part of the cluster.

start [{Cluster[:Host] | all {local | global}}]

Starts cluster operations on the specified hosts. This enables all ports that might have been previously disabled. The optional parameters allow the command to address a specific cluster, a specific cluster on a specific host, all clusters on the local computer, or all global computers that are part of the cluster.

stop [{Cluster[:Host] | all {local | global}}]

Stops cluster operations on the specified hosts. The optional parameters allow the command to address a specific cluster, a specific cluster on a specific host, all clusters on the local computer, or all global computers that are part of the cluster.

drainstop [{Cluster[:Host] | all {local | global}}]

Disables all new traffic handling on the specified hosts. While draining, hosts continue to service opened connections and stop their cluster operations when there are no more active connections. Draining mode can be terminated by explicitly stopping cluster mode with the stop command or by restarting new traffic handling with the start command. The optional parameters allow the command to address a specific cluster, a specific cluster on a specific host, all clusters on the local computer, or all global computers that are part of the cluster.

enable {vip[{:Port | :all}] | all[{:Port | :all}]} {Cluster[:{Host]| all {local | global}}}

Enables traffic handling for the rule whose port range contains the specified port. The first set of optional parameters allow the command to address every virtual IP address (vip), or specific vips on a specific port rule or on all ports. The second set of optional parameters allow the command to address a specific cluster, a specific cluster on a specific host, all clusters on the local computer, or all global computers that are part of the cluster. All ports specified by the port rule are affected. If all is specified for the port, this command is applied to the ports covered by all port rules. This command has no effect if the specified hosts have not started cluster operations.

disable {vip[{:Port | :all}] | all[{:Port | :all}]} {Cluster[:{Host]| all {local | global}}}

Disables and immediately blocks all traffic handling for the rule whose port range contains the specified port. The first set of optional parameters allow the command to address every virtual IP address (vip), or specific vips on a specific port rule or on all ports. The second set of optional parameters allow the command to address a specific cluster, a specific cluster on a specific host, all clusters on the local computer, or all global computers that are part of the cluster. All ports specified by the port rule are affected. If all is specified for the port, this command is applied to the ports covered by all port rules. All active connections on the specified hosts are blocked. To maintain active connections, use the drain function instead. This has no effect if the specified hosts have not started cluster operations.

drain {vip[{:Port | :all}] | all[{:Port | :all}]} {Cluster[:{Host]| all {local | global}}}

Disables new traffic handling for the rule whose port range contains the specified port. The first set of optional parameters allow the command to address every virtual IP address (vip), or specific vips on a specific port rule or on all ports. The second set of optional parameters allow the command to address a specific cluster, a specific cluster on a specific host, all clusters on the local computer, or all global computers that are part of the cluster. All ports specified by the port rule are affected. If all is specified for the port, this command is applied to the ports covered by all port rules. New connections to the specified hosts are not allowed, but all active connections are maintained. To disable active connections, use the disable command instead. This command has no effect if the specified hosts have not started cluster operations.

query [{Cluster[:Host]| all {local | global}}]

Displays the current cluster state and the list of host priorities for the current members of the cluster. The possible states are: Unknown. The responding host has not started cluster operations and cannot determine the cluster's state. Converging. The cluster is currently attempting to converge to a consistent state. Prolonged convergence usually indicates a problem with cluster parameters. If this occurs, check the event logs on the cluster hosts for Network Load Balancing messages warning you about the source of the problem. Draining. The cluster has converged, and the responding host is draining active connections in response to a drainstop command. Converged as default. The cluster has converged, and the responding host is the current default (the highest priority host without a drainstop command in progress). The default host handles network traffic for all of the TCP/UDP ports not covered by the port rules. Converged. The cluster has converged, and the responding host is not the default host.

The optional parameters allow the command to address a specific cluster, a specific cluster on a specific host, all clusters on the local computer, or all global computers that are part of the cluster.

queryport [{vip:]Port [Cluster[:Host] | all [{local | global}]}]

Displays information about a given port rule. The first parameter specifies which port rule to query. Specify the port rule by using a port number that is within the range of the port rule that you want to query. If necessary, you can also specify a virtual IP address (VIP). The default is all VIPs. However, if a particular port rule is assigned to only a specific VIP (as opposed to all VIPs) you must specify the appropriate VIP in order for the port rule to be found by this command.

The second set of optional parameters allow the command to address a specific cluster, a specific cluster on a specific host, all clusters on the local computer, or all global computers that are part of the cluster.

The information returned includes information regarding if the port rule was found or an indication that the port rule was not found, the state of the port rule (Enabled, Disabled or Draining), and a count of packets accepted and dropped on that port rule..

reload [{Cluster | all}] (local only)

Reloads the NLB driver's current parameters from the registry. Cluster operations on the local host are automatically stopped and restarted if necessary. If an error exists in the parameters, the host will not join the cluster, and a warning is displayed. If this should occur, open the NLB Properties dialog box to fix the problem.

display [{Cluster | all}] (local only)

Displays extensive information about your current NLB parameters, cluster state, and past cluster activity. The last several event log records produced by NLB are shown, including the binary data attached to those records. This command is designed to assist in technical support and debugging.

The registry information retrieved by the display command shows what the next state of NLB would be if a reload or some other operation that causes the driver to read the registry were to be performed. The registry information might or might not be the current state of NLB.

params [{Cluster | all}] (local only)

Displays information about your current NLB configuration. This command is similar to the display command, however, instead of retrieving the information from the registry, the params command queries directly from the kernel-mode driver. The information displayed is therefore the current state of NLB. (The registry information retrieved by the display command shows what the next state of NLB would be if a reload or some other operation that causes the driver to read the registry were to be performed. The registry information might or might not be the current state of NLB.) In addition to the configuration information, nlb params displays state variables from the kernel, including the current number of connections being maintained by NLB and the number of dynamic allocations that have been necessary for connection tracking.

ip2mac Cluster

Displays the media access control address corresponding to the specified cluster name or IP address. If multicast support is enabled, the multicast media access control address is used by NLB for cluster operations. Otherwise, the unicast media access control address is used. This command is useful for creating a static ARP entry in the router if necessary.

[remote options] Specifies the remote options when using remote control operations. The following table describes the possible options.

Parameter | Description
/PASSW Password | Specifies the remote control password.
/PORT Port | Specifies the cluster's remote control UDP port.
/local | Perform the operations only on the local computer.

Remarks

  • The cluster parameter can be either the cluster's full Internet name or the cluster's primary IP address. You can omit the cluster option when running nlb.exe directly on a cluster host. In this instance, the command applies only to the local cluster host. To address the cluster as a whole or a different host within the cluster, you must also specify the target cluster, or target cluster and specific host together.

  • The host parameter specifies which host within the cluster to which the command should be applied. If the host parameter is omitted, the command applies to all hosts within the cluster. You can specify host name using the internet host name, the IP address, or the unique host priorities assigned in the Network Load Balancing Properties dialog box. You can use the special host priority value 0 (zero) to refer to the default host within a cluster. You can omit the host option when running nlb.exe directly on a cluster host. In this instance, the command applies only to the local cluster host. To address the cluster as a whole or a different host within the cluster, you must also specify the target cluster, or target cluster and specific host together.

  • Some commands can be invoked only on the cluster hosts (designated above as local only).

  • NLB hosts can be configured to join the cluster automatically upon startup or to wait for the nlb start command by enabling the initial host state option in the Network Load Balancing Properties dialog box. You can use this command with the nlb stop command to change cluster parameters for the local host without taking the entire cluster offline.

  • You can modify the parameters (for example, to add a port rule) without disrupting the cluster's service to the clients. To do this, take a host out of the cluster, update its parameters, and then return it to the cluster. During this process, other cluster hosts will detect inconsistencies in the rules, and they will handle these inconsistencies in a manner that minimizes disruption of service to the clients.

  • You can use the nlb disable and nlb enable commands to customize your cluster responses to various failures. For example, if your SNMP monitoring program indicates that a Web server program on one of the hosts has failed, you can issue the command nlb disable 80 to prevent that host from accepting any further client requests to the specified Web server port, causing other cluster hosts to handle its load. After the Web server has been restarted, the nlb enable 80 command can be issued to allow the host to resume handling a portion of the cluster's network load for this port.


Nltest

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Server 2003 with SP1,Windows Server 2003,Windows Server 2003 R2

Performs network administrative tasks.

Nltest is a command-line tool that is built into Windows Server 2008 and Windows Server 2008 R2. It is available if you have the AD DS or the AD LDS server role installed. It is also available if you install the Active Directory Domain Services Tools that are part of the Remote Server Administration Tools (RSAT). For more information, see How to Administer Microsoft Windows Client and Server Computers Locally and Remotely (http://go.microsoft.com/fwlink/?LinkID=177813). To use nltest, you must run the nltest command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Nltest.exe

You can use nltest to:

  • Get a list of domain controllers

  • Force a remote shutdown

  • Query the status of trust

  • Test trust relationships and the state of domain controller replication in a Windows domain

  • Force a user-account database to synchronize on Windows NT version 4.0 or earlier domain controllers

Nltest can test and reset the secure channel that the NetLogon service establishes between clients and the domain controller that logs them on. Clients using Kerberos authentication cannot use this secure channel.

Note
You must run nltest from the command prompt.

Concepts

A discrete communication channel, known as the secure channel, exists between trusted domains in a Windows NT 4.0 environment and parent domains and their immediate children in an Active Directory environment. In a Windows NT 4.0 environment, nltest uses these channels to authenticate user accounts when a remote user connects to a network resource and the user account exists in a trusted domain. This is called pass-through authentication.

Nltest provides diagnostic features that you can use for troubleshooting Windows Server 2008 operating system configurations. However, because nltest is designed primarily for system administrators and support personnel, its output may be difficult to analyze. In this case, you can review the appropriate troubleshooting sections in the Windows Deployment and Resource Kits. Search for any of the keywords from the bulleted list in the nltest description above.

Syntax

Copy Code
nltest [/server:<servername>] [<operation>[<parameter>]
/server: <ServerName>

Runs nltest at a remote domain controller that you specify. If you do not specify this parameter, nltest runs on the local computer, which is the domain controller.

Parameters

Parameter Description

/query

Reports on the state of the secure channel the last time you used it. (The secure channel is the one that the NetLogon service established.)

/repl

Forces synchronization with the primary domain controller (PDC). Nltest synchronizes only changes that are not yet replicated to the backup domain controller (BDC). You can use this parameter for Windows NT 4.0 BDCs only, not for Active Directory replication. You must have administrative credentials to use this parameter.

/sync

Forces an immediate synchronization with the PDC of the entire Security Accounts Manager (SAM) database. You can use this parameter for Windows NT 4.0 BDCs only, not for Active Directory replication. You must have administrative credentials to use this parameter.

/pdc_repl

Forces the PDC to send a synchronization notification to all BDCs. You can use this parameter for Windows NT 4.0 PDCs only, not for Active Directory replication. You must have administrative credentials to use this parameter.

/sc_query: <DomainName>

Reports on the state of the secure channel the last time that you used it. (The secure channel is the one that the NetLogon service established.) This parameter lists the name of the domain controller that you queried on the secure channel, also.

/sc_reset:[ <DomainName>]

Removes, and then rebuilds, the secure channel that the NetLogon service established. You must have administrative credentials to use this parameter.

/sc_verify:[ <DomainName>]

Checks the status of the secure channel that the NetLogon service established. If the secure channel does not work, this parameter removes the existing channel, and then builds a new one. You must have administrative credentials to use this parameter. This parameter is only valid on domain controllers that run Windows 2000 with Service Pack 2 and later.

/sc_change_pwd:[ <DomainName>]

Changes the password for the trust account of a domain that you specify. If you run nltest on a domain controller, and an explicit trust relationship exists, then nltest resets the password for the interdomain trust account. Otherwise, nltest changes the computer account password for the domain that you specify. You can use this parameter only for computers that are running Windows 2000 and later.

/dclist:[ <DomainName>]

Lists all domain controllers in the domain. In a Windows NT 4.0 domain environment, this parameter uses the Browser service to retrieve the list of domains. In an Active Directory environment, this command first queries Active Directory for a list of domain controllers. If this query is unsuccessful, nltest then uses the Browser service.

/dcname:[ <DomainName>]

Lists the primary domain controller or the PDC emulator for DomainName.

/dsgetdc:[ <DomainName>]

Queries the Domain Name System (DNS) server for a list of domain controllers and their corresponding IP addresses. This parameter also contacts each domain controller to check for connectivity.

The following list shows the values that you can use to filter the list of domain controllers or specify alternate names types in the syntax.

  • /PDC: Returns only the PDC (Windows NT 4.0) or domain controller that you designate as the PDC emulator (Windows 2000 and later).

  • /DS: Returns only those domain controllers that are Windows 2000 and later.

  • /DSP: Returns only Windows 2000 and later domain controllers. If the query finds no such server, then this value returns Windows NT 4.0 domain controllers.

  • /GC: Returns only those domain controllers that you designate as global catalog servers.

  • /KDC: Returns only those domain controllers that you designate as Kerberos key distribution centers.

  • /TIMESERV: Returns only those domain controllers that you designate as time servers.

  • /GTTIMESERV: Returns only those domain controllers that you designate as master time servers.

  • /NetBIOS: Specifies computer names in the syntax as NetBIOS names. If you do not specify a return format, the domain controller can return either NetBIOS or DNS format.

  • /DNS: Specifies computer names in the syntax as fully qualified domain names (FQDNs). If you do not specify a return format, the domain controller can return either NetBIOS or DNS format.

  • /IP: Returns only domain controllers that have IP addresses. This value returns only domain controllers that use TCP/IP as their protocol stacks.

  • /FORCE: Forces the computer to run the command against the DNS server instead of looking in the cache for the information.

/dnsgetdc: <DomainName>

Queries the DNS server for a list of domain controllers and their corresponding IP addresses.

The following list shows the values that you can use to filter the list of domain controllers.

  • /PDC: Returns only those domain controllers that are PDCs (Windows NT 4.0) or designated as PDC emulators.

  • /GC: Returns only those domain controllers that you designate as global catalogs.

  • /KDC: Returns only those domain controllers that you designate as Kerberos key distribution centers.

  • /WRITABLE: Returns only those domain controllers that can accept changes to the directory database. This value returns all Active Directory domain controllers, but not Windows NT 4.0 BDCs.

  • /LDAPONLY: Returns servers that are running a Lightweight Directory Access Protocol (LDAP) application. The servers can include LDAP servers that are not domain controllers.

  • /FORCE: Forces the computer to run the command against the DNS server instead of looking in cache for the information.

  • /SITE Sitename: Sorts the returned records to list first the records that pertain to the site that you specify.

  • /SITESPEC: Filters the returned records to display only those records that pertain to the site that you specify. This operation can only be used with the /SITE parameter.

/dsgetfti: <DomainName>[ /UpdateTDO]

Returns information about interforest trusts. You use this parameter only for a Windows Server 2008 domain controller that is in the root of the forest. If no interforest trusts exist, this parameter returns an error.

The /UpdateTDO value updates the locally stored information on the interforest trust.

/dsgetsite

Returns the name of the site in which the domain controller resides.

/dsgetsitecov

Returns the name of the site that the domain controller covers. A domain controller can cover a site that has no local domain controller of its own.

/parentdomain

Returns the name of the parent domain of the server.

/dsregdns

Refreshes the registration of all DNS records that are specific to a domain controller that you specify.

/dsderegdns: <DnsHostName>

Deregisters DNS host records for the host that you specify in the DnsHostName parameter.

The following list shows the values that you can use to specify which records nltest deregisters.

  • /DOM: Specifies a DNS domain name for the host to use when you search for records on the DNS server. If you do not specify this value, nltest uses the DNS domain name as the suffix of the DnsHostName parameter.

  • /DSAGUID: Deletes Directory System Agent (DSA) records that are based on a GUID.

  • DOMGUID: Deletes DNS records that are based on a globally unique identifier (GUID).

/whowill: <Domain>/ <User>

Finds the domain controller that has the user account that you specify. You can use this parameter to determine whether nltest has replicated the account information to other domain controllers.

/finduser: <User>

Finds the directly-trusted domain that the user account that you specify belongs to. You can use this parameter to troubleshoot logon issues of older client operating systems.

/transport_notify

Flushes the negative cache to force the discovery of a domain controller. You can use this parameter for Windows NT 4.0 domain controllers only. This operation is done automatically when clients log on to Windows 2000 and Windows Server 2003 domain controllers.

/dbflag: <HexadecimalFlags>

Sets a new debug flag. For most purposes, use 0x2000FFFF as the value for HexadecimalFlags. The entry in the Windows Server 2003 registry for debug flags is HKLM\System\CurrentControlSet\Services\Netlogon\Parameters\DBFlag.

/user: <UserName>

Displays many of the attributes that you maintain in the SAM account database for the user that you specify. You cannot use this parameter for user accounts that are stored in an Active Directory database.

/time: <HexadecimalLSL> <HexadecimalMSL>

Converts Windows NT Greenwich Mean Time (GMT) time to ASCII. HexadecimalLSL is a hexadecimal value for least significant longword. HexadecimalMSL is a hexadecimal value for most significant longword.

/logon_query

Queries the cumulative number of NTLM logon attempts at a console or over a network.

/domain_trusts

Returns a list of trusted domains. /Primary /Forest /Direct_Out /Direct_In /All_Trusts /v.

The following list shows the values that you can use to filter the list of domains.

  • /Primary: Returns only the domain to which the computer account belongs.

  • /Forest: Returns only those domains that are in the same forest as the primary domain.

  • /Direct_Out: Returns only the domains that are explicitly trusted with the primary domain.

  • /Direct_In: Returns only the domains that explicitly trust the primary domain.

  • /All_Trusts: Returns all trusted domains.

  • /v: Displays verbose output, including any domain SIDs and GUIDs that are available.

/dsquerydns

Queries for the status of the last update for all DNS records that are specific to a domain controller that you specify.

/bdc_query: <DomainName>

Queries for a list of BDCs in DomainName, and then displays their state of synchronization and replication status. You can use this parameter only for Windows NT 4.0 domain controllers.

/sim_sync: <DomainName> <ServerName>

Simulates full synchronization replication. This is a useful parameter for test environments.

/list_deltas: <FileName>

Displays the contents of the FileName change log file, which lists changes to the user account database. Netlogon.chg is the default name for this log file, which resides only on Windows NT 4.0 BDCs.

/cdigest: <Message> /domain: <DomainName>

Displays the current digest that the client uses for the secure channel. (The digest is the calculation that nltest derives from the password.) This parameter displays the digest that is based on the previous password, also. Nltest uses the secure channel for logons between client computers and a domain controller, or for directory service replication between domain controllers. You can use this parameter in conjunction with the /sdigest parameter to check the synchronization of trust account passwords.

/sdigest: <Message> /rid: <RID_In_Hexadecimal>

Displays the current digest that the server uses for the secure channel. (The digest is the calculation that nltest derives from the password.) This parameter displays the digest for the previous password, also. If the digest from the server matches the digest from the client, then nltest synchronizes the passwords that it uses for the secure channel. If the digests do not match, then nltest might not have replicated the password change yet.

/shutdown: <Reason>[ <Seconds>]

Remotely shuts down the server that you specify in ServerName. You use a string to specify the reason for the shutdown in the Reason value., and you use an integer to specify the amount of time before the shutdown occurs in the Seconds value. For a complete description, see the Platform SDK documentation for InitiateSystemShutdown.

/shutdown_abort

Terminates a system shutdown.

{/help | /?}

Displays help at the command prompt.

Examples

Example 1: Verify domain controllers in a domain

The following example uses the /dclist parameter to create a list of domain controllers of the domain fourthcoffee.com

nltest /dclist:fourthcoffee

This command displays output similar to the following:

Copy Code
Get list of DCs in domain 'ntdev' from '\\fourthcoffee-dc-01'.
    fourthcoffee-dc-01.forthcoffee.com       [DS] Site: Rome
    fourthcoffee-dc-03.forthcoffee.com       [DS] Site: LasVegas
    fourthcoffee-dc-04.forthcoffee.com       [DS] Site: LA
    fourthcoffee-dc-09.forthcoffee.com       [DS] Site: NYC
    fourthcoffee-dc-12.forthcoffee.com       [DS] Site: Paris
    fourthcoffee-dc-24.forthcoffee.com       [DS] Site: Chattaroy
    fourthcoffee-dc-32.forthcoffee.com       [DS] Site: Haifa
    fourthcoffee-dc-99.forthcoffee.com       [DS] Site: Redmond
    fourthcoffee-dc-63.forthcoffee.com [PDC] [DS] Site: London
The command completed successfully

Example 2: Advanced information about users

The following example shows detailed information about a specific user.

nltest /user:"TestAdmin"

This command displays output similar to the following:

Copy Code
User: User1
Rid: 0x3eb
Version: 0x10002
LastLogon: 2ee61c9a 01c0e947 = 5/30/2001 13:29:10
PasswordLastSet: 9dad5428 01c0e577 = 5/25/2001 17:05:47
AccountExpires: ffffffff 7fffffff = 9/13/30828 19:48:05
PrimaryGroupId: 0x201
UserAccountControl: 0x210
CountryCode: 0x0
CodePage: 0x0
BadPasswordCount: 0x0
LogonCount: 0x33
AdminCount: 0x1
SecurityDescriptor: 80140001 0000009c 000000ac 00000014 00000044 00300002 000000
02 0014c002 01050045 00000101 01000000 00000000 0014c002 000f07ff 00000101 05000
000 00000007 00580012 00000003 00240000 00020044 00000501 05000000 00000015 22cd
b7b4 7112b3f1 2b3be507 000003eb 00180000 000f07ff 00000201 05000000 00000020 000
00220 00140000 0002035b 00000101 01000000 00000000 00000201 05000000 00000020 00
000220 00000201 05000000 00000020 00000220
AccountName: User1
Groups: 00000201 00000007
LmOwfPassword: fb890c9c 5c7e7e09 ee58593b d959c681
NtOwfPassword: d82759cc 81a342ac df600c37 4e58a478
NtPasswordHistory: 00011001
LmPasswordHistory: 00010011
The command completed successfully

Example 3: Verify trust relationship with a specific server

The following example verifies that the a-dc1 server has a valid trust relationship with the domain.

nltest.exe /server:fourthcoffee-dc-01 /sc_query:fourthcoffee

This command displays output similar to the following:

Copy Code
Flags: 30 HAS_IP  HAS_TIMESERV
Trusted DC Name \\fourthcoffee-dc-01.forthcoffee.com
Trusted DC Connection Status Status = 0 0x0 NERR_Success
The command completed successfully
Note
The DNS_DC and DNS_DOMAIN flags indicate the format of the information returned in the request (as opposed to a flag like GC or TIMESERV, which tell you something about the domain controller returning the information). Specifically, the presence of them indicates the returned domain controller name and domain name, respectively, were in DNS format. The absence of them indicates the returned domain controller name and domain name were in NetBIOS format.

Example 4: Determine the PDC emulator for a domain

The following example identifies the domain controller that Windows NT 4.0–based computers see as the PDC emulator for a domain.

nltest /dcname:fourthcoffee

This command displays output similar to the following:

Copy Code
PDC for Domain fourthcoffee is \\fourthcoffee-dc-01
The command completed successfully

You can see that a-dcp is the PDC emulator for your domain.

Example 5: Show trust relationships for a domain

The following example lists the established trust relationships for your domain.

nltest /domain_trusts

This command displays output similar to the following:

Copy Code
List of domain trusts:
    0: forthcoffee forthcoffee.com (NT 5) (Forest Tree Root) (Primary Domain)
The command completed successfully

This example shows that one domain trusts itself but not other domains.

Additional references

Command-Line Syntax Key


Nslookup
See Also

Applies To: Windows Server 2008 R2,Windows Server 2003 with SP1,Windows Server 2003 R2,Windows Server 2003,Windows Vista,Windows Server 2008

Displays information that you can use to diagnose Domain Name System (DNS) infrastructure. Before using this tool, you should be familiar with how DNS works. The Nslookup command-line tool is available only if you have installed the TCP/IP protocol.

Syntax

Copy Code
Nslookup [<-SubCommand ...>] [{<ComputerToFind> | -<Server>}]
Nslookup /exit
Nslookup /finger [<UserName>] [{[>] <FileName>|[>>] <FileName>}]
Nslookup /{help | ?}
Nslookup /ls [<Option>] <DNSDomain> [{[>] <FileName>|[>>] <FileName>}]
Nslookup /lserver <DNSDomain>
Nslookup /root
Nslookup /server <DNSDomain>
Nslookup /set <KeyWord>[=<Value>]
Nslookup /set all
Nslookup /set class=<Class>
Nslookup /set [no]d2
Nslookup /set [no]debug
Nslookup /set [no]defname
Nslookup /set domain=<DomainName>
Nslookup /set [no]ignore
Nslookup /set port=<Port>
Nslookup /set querytype=<ResourceRecordType>
Nslookup /set [no]recurse
Nslookup /set retry=<Number>
Nslookup /set root=<RootServer>
Nslookup /set [no]search
Nslookup /set srchlist=<DomainName>[/...]
Nslookup /set timeout=<Number>
Nslookup /set type=<ResourceRecordType>
Nslookup /set [no]vc
Nslookup /view <FileName>

Parameters

Parameter | Description
Nslookup /exit | Exits nslookup.
Nslookup /finger | Connects with the finger server on the current computer.
Nslookup /help | Displays a short summary of nslookup subcommands.
Nslookup /ls | Lists information for a DNS domain.
Nslookup /lserver | Changes the default server to the specified DNS domain.
Nslookup /root | Changes the default server to the server for the root of the DNS domain name space.
Nslookup /server | Changes the default server to the specified DNS domain.
Nslookup /set | Changes configuration settings that affect how lookups function.
Nslookup /set all | Prints the current values of the configuration settings.
Nslookup /set class | Changes the query class. The class specifies the protocol group of the information.
Nslookup /set d2 | Turns exhaustive Debugging Mode on or off. All fields of every packet are printed.
Nslookup /set debug | Turns Debugging Mode on or off.
Nslookup /set defname | Appends the default DNS domain name to a single component lookup request. A single component is a component that contains no periods.
Nslookup /set domain | Changes the default DNS domain name to the name specified.
Nslookup /set ignore | Ignores packet truncation errors.
Nslookup /set port | Changes the default TCP/UDP DNS name server port to the value specified.
Nslookup /set querytype | Changes the resource record type for the query.
Nslookup /set recurse | Tells the DNS name server to query other servers if it does not have the information.
Nslookup /set retry | Sets the number of retries.
Nslookup /set root | Changes the name of the root server used for queries.
Nslookup /set search | Appends the DNS domain names in the DNS domain search list to the request until an answer is received. This applies when the set and the lookup request contain at least one period, but do not end with a trailing period.
Nslookup /set srchlist | Changes the default DNS domain name and search list.
Nslookup /set timeout | Changes the initial number of seconds to wait for a reply to a request.
Nslookup /set type | Changes the resource record type for the query.
Nslookup /set vc | Specifies to use or not use a virtual circuit when sending requests to the server.
Nslookup /view | Sorts and lists the output of the previous ls subcommand or commands.

Remarks

  • If ComputerToFind is an IP address and the query is for an A or PTR resource record type, the name of the computer is returned. If ComputerToFind is a name and does not have a trailing period, the default DNS domain name is appended to the name. This behavior depends on the state of the following set subcommands: domain, srchlist, defname, and search.

  • If you type a hyphen (-) instead of ComputerToFind, the command prompt changes to nslookup interactive mode.

  • The command-line length must be less than 256 characters.

  • Nslookup has two modes: interactive and noninteractive.

    If you need to look up only a single piece of data, use noninteractive mode. For the first parameter, type the name or IP address of the computer that you want to look up. For the second parameter, type the name or IP address of a DNS name server. If you omit the second argument, nslookup uses the default DNS name server.

    If you need to look up more than one piece of data, you can use interactive mode. Type a hyphen (-) for the first parameter and the name or IP address of a DNS name server for the second parameter. Or, omit both parameters and nslookup uses the default DNS name server. Following are some tips about working in interactive mode:

    • To interrupt interactive commands at any time, press CTRL+B.

    • To exit, type exit.

    • To treat a built-in command as a computer name, precede it with the escape character (\).

    • An unrecognized command is interpreted as a computer name.

  • If the lookup request fails, nslookup prints an error message. The following table lists possible error messages.

    Error message Description

    Timed out

    The server did not respond to a request after a certain amount of time and a certain number of retries. You can set the time-out period with the set timeout subcommand. You can set the number of retries with the set retry subcommand.

    No response from server

    No DNS name server is running on the server computer.

    No records

    The DNS name server does not have resource records of the current query type for the computer, although the computer name is valid. The query type is specified with the set querytype command.

    Nonexistent domain

    The computer or DNS domain name does not exist.

    Connection refused

    -or-

    Network is unreachable

    The connection to the DNS name server or finger server could not be made. This error commonly occurs with ls and finger requests.

    Server failure

    The DNS name server found an internal inconsistency in its database and could not return a valid answer.

    Refused

    The DNS name server refused to service the request.

    Format error

    The DNS name server found that the request packet was not in the proper format. It may indicate an error in nslookup.

  • For more information about the nslookup command and DNS, see the following resources:

    • Lee, T., Davies, J. 2000. Microsoft Windows 2000 TCP/IP Protocols and Services Technical Reference. Redmond, Washington: Microsoft Press.

    • Albitz, P., Loukides, M. and C. Liu. 2001. DNS and BIND, Fourth Edition. Sebastopol, California: O'Reilly and Associates, Inc.

    • Larson, M. and C. Liu. 2001. DNS on Windows 2000. Sebastopol, California: O'Reilly and Associates, Inc.

Examples

Each command-line option consists of a hyphen (-) followed immediately by the command name and, in some cases, an equal sign (=) and then a value. For example, to change the default query type to host (computer) information and the initial time-out to 10 seconds, type:

nslookup -querytype=hinfo -timeout=10

See Also

Concepts

Command-Line Syntax Key


Nslookup /exit

Applies To: Windows Server 2008,Windows Server 2008 R2

Exits nslookup.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
Nslookup /exit

Parameters

Parameter | Description
{help | ?} | Displays a short summary of nslookup subcommands.

Remarks <optional section>

<Insert command-specific remarks here.>

Scripting <optional section>

<Here is where you discuss using the command within a script. You should also provide an FWLink to a specific page in the Script Center, if possible.>

Examples

<Here is where you put a detailed description of your example>:

Copy Code
This /is /the /example

<Here is where you put detailed descriptions of another example>:

Copy Code
This /is /a:"different" /example

Additional references

Command-Line Syntax Key


Nslookup /finger

Applies To: Windows Server 2008 R2,Windows Server 2008

Connects with the finger server on the current computer.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
finger [<UserName>] [{[>] <FileName>|[>>] <FileName>}]

Parameters

Parameter | Description
<UserName> | Specifies the name of the user to look up.
<FileName> | Specifies a file name in which to save the output. You can use the greater than (>) and double greater than (>>) characters to redirect the output in the usual manner.
{help | ?} | Displays a short summary of nslookup subcommands.

Remarks <optional section>

  • The current computer is defined when a previous lookup for a computer was successful and returned address information. For more information about the set querytype subcommand, see Additional references.

Scripting <optional section>

<Here is where you discuss using the command within a script. You should also provide an FWLink to a specific page in the Script Center, if possible.>

Examples

<Here is where you put a detailed description of your example>:

Copy Code
This /is /the /example

<Here is where you put detailed descriptions of another example>:

Copy Code
This /is /a:"different" /example

Additional references

Command-Line Syntax Key

Nslookup /set querytype


Nslookup /help

Applies To: Windows Server 2008,Windows Server 2008 R2

Displays a short summary of nslookup subcommands.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
{help | ?}

Parameters

Parameter | Description
{help | ?} | Displays a short summary of nslookup subcommands.

Scripting <optional section>

<Here is where you discuss using the command within a script. You should also provide an FWLink to a specific page in the Script Center, if possible.>

Examples

<Here is where you put a detailed description of your example>:

Copy Code
This /is /the /example

<Here is where you put detailed descriptions of another example>:

Copy Code
This /is /a:"different" /example

Additional references

Command-Line Syntax Key


Nslookup /ls

Applies To: Windows Server 2008 R2,Windows Server 2008

Lists information for a Domain Name System (DNS) domain.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
ls [<Option>] <DNSDomain> [{[>] <FileName>|[>>] <FileName>}]

Parameters

Parameter Description

<Option>

The following table lists valid options.

Option | Description
-t <QueryType> | Lists all records of the specified type. For a description of <QueryType>, see the setquerytype in Additional references.
-a | Lists aliases of computers in the DNS domain. This parameter is a synonym for -t CNAME.
-d | Lists all records for the DNS domain. This parameter is a synonym for -t ANY.
-h | Lists CPU and operating system information for the DNS domain. This parameter is a synonym for -t HINFO.
-s | Lists well-known services of computers in the DNS domain. This parameter is a synonym for -t WKS.

<DNSDomain>

Specifies the DNS domain for which you want information.

<FileName>

Specifies a file name in which to save the output. You can use the greater than (>) and double greater than (>>) characters to redirect the output in the usual manner.

{help | ?}

Displays a short summary of nslookup subcommands.

Remarks <optional section>

  • The default output contains computer names and their IP addresses. When output is directed to a file, hash marks are printed for every 50 records received from the server

Scripting <optional section>

<Here is where you discuss using the command within a script. You should also provide an FWLink to a specific page in the Script Center, if possible.>

Examples

<Here is where you put a detailed description of your example>:

Copy Code
This /is /the /example

<Here is where you put detailed descriptions of another example>:

Copy Code
This /is /a:"different" /example

Additional references

Command-Line Syntax Key

Nslookup /set querytype


Nslookup /lserver

Applies To: Windows Server 2008,Windows Server 2008 R2

Changes the default server to the specified Domain Name System (DNS) domain.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
lserver <DNSDomain>

Parameters

Parameter | Description
<DNSDomain> | Specifies the new DNS domain for the default server.
{help | ?} | Displays a short summary of nslookup subcommands.

Remarks

  • The lserver command uses the initial server to look up the information about the specified DNS domain. This is in contrast to the server command, which uses the current default server.

Scripting <optional section>

<Here is where you discuss using the command within a script. You should also provide an FWLink to a specific page in the Script Center, if possible.>

Examples

<Here is where you put a detailed description of your example>:

Copy Code
This /is /the /example

<Here is where you put detailed descriptions of another example>:

Copy Code
This /is /a:"different" /example

Additional references

Command-Line Syntax Key

Nslookup /server


Nslookup /root

Applies To: Windows Server 2008 R2,Windows Server 2008

Changes the default server to the server for the root of the Domain Name System (DNS) domain name space.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
root

Parameters

Parameter | Description
{help | ?} | Displays a short summary of nslookup subcommands.

Remarks

  • Currently, the ns.nic.ddn.mil name server is used. This command is a synonym for lserver ns.nic.ddn.mil. You can change the name of the root server with the set root command.

Scripting <optional section>

<Here is where you discuss using the command within a script. You should also provide an FWLink to a specific page in the Script Center, if possible.>

Examples

<Here is where you put a detailed description of your example>:

Copy Code
This /is /the /example

<Here is where you put detailed descriptions of another example>:

Copy Code
This /is /a:"different" /example

Additional references

Command-Line Syntax Key

Nslookup /set root


Nslookup /server

Applies To: Windows Server 2008,Windows Server 2008 R2

Changes the default server to the specified Domain Name System (DNS) domain.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
server <DNSDomain>

Parameters

Parameter | Description
<DNSDomain> | Required. Specifies the new DNS domain for the default server.
{help | ?} | Displays a short summary of nslookup subcommands.

Remarks

  • The server command uses the current default server to look up the information about the specified DNS domain. This is in contrast to the lserver command, which uses the initial server.

Scripting <optional section>

<Here is where you discuss using the command within a script. You should also provide an FWLink to a specific page in the Script Center, if possible.>

Examples

<Here is where you put a detailed description of your example>:

Copy Code
This /is /the /example

<Here is where you put detailed descriptions of another example>:

Copy Code
This /is /a:"different" /example

Additional references

Command-Line Syntax Key

Nslookup /lserver


Nslookup /set

Applies To: Windows Server 2008 R2,Windows Server 2008

Changes configuration settings that affect how lookups function.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
set <KeyWord>[=<Value>]

Parameters

Parameter | Description
<KeyWord> | Identifies subcommands that are derived from the set subcommand. For example, the subcommand set d2 has a keyword of [no]d2. For the list of subcommands that are derived from the set subcommand, see Additional references.
<Value> | Specifies the nslookup configuration setting value for each subcommand.
{help | ?} | Displays a short summary of nslookup subcommands.

Remarks

Use set all to see a listing of the current settings.

Scripting <optional section>

<Here is where you discuss using the command within a script. You should also provide an FWLink to a specific page in the Script Center, if possible.>

Examples

<Here is where you put a detailed description of your example>:

Copy Code
This /is /the /example

<Here is where you put detailed descriptions of another example>:

Copy Code
This /is /a:"different" /example

Additional references

Command-Line Syntax Key

Nslookup /set all


Nslookup /set all

Applies To: Windows Server 2008,Windows Server 2008 R2

Prints the current values of the configuration settings.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
set all

Parameters

Parameter | Description
{help | ?} | Displays a short summary of nslookup subcommands.

Remarks

  • Set all also prints information about the default server and computer (that is, the host).

Scripting <optional section>

<Here is where you discuss using the command within a script. You should also provide an FWLink to a specific page in the Script Center, if possible.>

Examples

<Here is where you put a detailed description of your example>:

Copy Code
This /is /the /example

<Here is where you put detailed descriptions of another example>:

Copy Code
This /is /a:"different" /example

Additional references

Command-Line Syntax Key


Nslookup /set class

Applies To: Windows Server 2008 R2,Windows Server 2008

Changes the query class. The class specifies the protocol group of the information.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
set class=<Class>

Parameters

Parameter Description

<Class>

The default class is IN. The following table lists the valid values for this command.

Value | Description
IN | Specifies the Internet class.
CHAOS | Specifies the Chaos class.
HESIOD | Specifies the MIT Athena Hesiod class.
ANY | Specifies any of the previously listed wildcards.

{help | ?}

Displays a short summary of nslookup subcommands.

Remarks

Scripting <optional section>

<Here is where you discuss using the command within a script. You should also provide an FWLink to a specific page in the Script Center, if possible.>

Examples

<Here is where you put a detailed description of your example>:

Copy Code
This /is /the /example

<Here is where you put detailed descriptions of another example>:

Copy Code
This /is /a:"different" /example

Additional references

Command-Line Syntax Key


Nslookup /set d2

Applies To: Windows Server 2008,Windows Server 2008 R2

Turns exhaustive Debugging Mode on or off. All fields of every packet are printed.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
set [no]d2

Parameters

Parameter | Description
nod2 | Turns off exhaustive Debugging Mode. The default syntax is nod2.
d2 | Turns on exhaustive Debugging Mode.
{help | ?} | Displays a short summary of nslookup subcommands.

Remarks

<Insert command-specific remarks here.>

Scripting <optional section>

<Here is where you discuss using the command within a script. You should also provide an FWLink to a specific page in the Script Center, if possible.>

Examples

<Here is where you put a detailed description of your example>:

Copy Code
This /is /the /example

<Here is where you put detailed descriptions of another example>:

Copy Code
This /is /a:"different" /example

Additional references

Command-Line Syntax Key


Nslookup /set debug

Applies To: Windows Server 2008 R2,Windows Server 2008

Turns Debugging Mode on or off.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
set [no]debug

Parameters

Parameter | Description
nodebug | Turns off Debugging Mode. The default syntax is nodebug.
debug | Turns on Debugging Mode.
{help | ?} | Displays a short summary of nslookup subcommands.

Remarks

  • With Debugging Mode turned on, more information is printed about the packet sent to the server and the resulting answer.

Scripting <optional section>

<Here is where you discuss using the command within a script. You should also provide an FWLink to a specific page in the Script Center, if possible.>

Examples

<Here is where you put a detailed description of your example>:

Copy Code
This /is /the /example

<Here is where you put detailed descriptions of another example>:

Copy Code
This /is /a:"different" /example

Additional references

Command-Line Syntax Key


Nslookup /set defname

Applies To: Windows Server 2008,Windows Server 2008 R2

Appends the default Domain Name System (DNS) domain name to a single component lookup request. A single component is a component that contains no periods.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
set [no]defname

Parameters

Parameter | Description
nodefname | Stops appending the default Domain Name System (DNS) domain name to a single component lookup request.
defname | Appends the default Domain Name System (DNS) domain name to a single component lookup request. The default syntax is defname.
{help | ?} | Displays a short summary of nslookup subcommands.

Remarks

<Insert command-specific remarks here.>

Scripting <optional section>

<Here is where you discuss using the command within a script. You should also provide an FWLink to a specific page in the Script Center, if possible.>

Examples

<Here is where you put a detailed description of your example>:

Copy Code
This /is /the /example

<Here is where you put detailed descriptions of another example>:

Copy Code
This /is /a:"different" /example

Additional references

Command-Line Syntax Key


Nslookup /set domain

Applies To: Windows Server 2008 R2,Windows Server 2008

Changes the default Domain Name System (DNS) domain name to the name specified.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
set domain=<DomainName>

Parameters

Parameter | Description
<DomainName> | Specifies a new name for the default DNS domain name. The default domain name is the host name.
{help | ?} | Displays a short summary of nslookup subcommands.

Remarks

  • The default DNS domain name is appended to a lookup request depending on the state of the defname and search options. The DNS domain search list contains the parents of the default DNS domain if it has at least two components in its name. For example, if the default DNS domain is mfg.widgets.com, the search list is named both mfg.widgets.com and widgets.com. Use the set srchlist command to specify a different list and the set all command to display the list.

Scripting <optional section>

<Here is where you discuss using the command within a script. You should also provide an FWLink to a specific page in the Script Center, if possible.>

Examples

<Here is where you put a detailed description of your example>:

Copy Code
This /is /the /example

<Here is where you put detailed descriptions of another example>:

Copy Code
This /is /a:"different" /example

Additional references

Command-Line Syntax Key

Nslookup /set srchlist

Nslookup /set all


Nslookup /set ignore

Applies To: Windows Server 2008,Windows Server 2008 R2

Ignores packet truncation errors.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
set [no]ignore

Parameters

Parameter | Description
noignore | Does not ignore packet truncation errors. The default setting is noignore.
ignore | Ignores packet truncation errors.
{help | ?} | Displays a short summary of nslookup subcommands.

Remarks

<Insert command-specific remarks here.>

Scripting <optional section>

<Here is where you discuss using the command within a script. You should also provide an FWLink to a specific page in the Script Center, if possible.>

Examples

<Here is where you put a detailed description of your example>:

Copy Code
This /is /the /example

<Here is where you put detailed descriptions of another example>:

Copy Code
This /is /a:"different" /example

Additional references

Command-Line Syntax Key


Nslookup /set port

Applies To: Windows Server 2008 R2,Windows Server 2008

Changes the default TCP/UDP Domain Name System (DNS) name server port to the value specified.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
set port=<Port>

Parameters

Parameter | Description
<Port> | Specifies the new value for the default TCP/UDP DNS name server port. The default port is 53.
{help | ?} | Displays a short summary of nslookup subcommands.

Remarks

<Insert command-specific remarks here.>

Scripting <optional section>

<Here is where you discuss using the command within a script. You should also provide an FWLink to a specific page in the Script Center, if possible.>

Examples

<Here is where you put a detailed description of your example>:

Copy Code
This /is /the /example

<Here is where you put detailed descriptions of another example>:

Copy Code
This /is /a:"different" /example

Additional references

Command-Line Syntax Key


Nslookup /set querytype

Applies To: Windows Server 2008,Windows Server 2008 R2

Changes the resource record type for the query.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
set querytype=<ResourceRecordType>

Parameters

Parameter Description

<ResourceRecordType>

Specifies a DNS resource record type. The default resource record type is A. The following table lists the valid values for this command.

Value | Description
A | Specifies a computer's IP address.
ANY | Specifies all types of data.
CNAME | Specifies a canonical name for an alias.
GID | Specifies a group identifier of a group name.
HINFO | Specifies a computer's CPU and type of operating system.
MB | Specifies a mailbox domain name.
MG | Specifies a mail group member.
MINFO | Specifies mailbox or mail list information.
MR | Specifies the mail rename domain name.
MX | Specifies the mail exchanger.
NS | Specifies a DNS name server for the named zone.
PTR | Specifies a computer name if the query is an IP address; otherwise, specifies the pointer to other information.
SOA | Specifies the start-of-authority for a DNS zone.
TXT | Specifies the text information.
UID | Specifies the user identifier.
UINFO | Specifies the user information.
WKS | Describes a well-known service.

{help | ?}

Displays a short summary of nslookup subcommands.

Remarks

  • The set type command performs the same function as the set querytype command.

  • For more information about resource record types, see Request For Comment (RFC) 1035.

Scripting <optional section>

<Here is where you discuss using the command within a script. You should also provide an FWLink to a specific page in the Script Center, if possible.>

Examples

<Here is where you put a detailed description of your example>:

Copy Code
This /is /the /example

<Here is where you put detailed descriptions of another example>:

Copy Code
This /is /a:"different" /example

Additional references

Command-Line Syntax Key

Nslookup /set type


Nslookup /set recurse

Applies To: Windows Server 2008 R2,Windows Server 2008

Tells the Domain Name System (DNS) name server to query other servers if it does not have the information.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
set [no]recurse

Parameters

Parameter | Description
norecurse | Stops the Domain Name System (DNS) name server from querying other servers if it does not have the information.
recurse | Tells the Domain Name System (DNS) name server to query other servers if it does not have the information. The default syntax is recurse.
{help | ?} | Displays a short summary of nslookup subcommands.

Remarks

<Insert command-specific remarks here.>

Scripting <optional section>

<Here is where you discuss using the command within a script. You should also provide an FWLink to a specific page in the Script Center, if possible.>

Examples

<Here is where you put a detailed description of your example>:

Copy Code
This /is /the /example

<Here is where you put detailed descriptions of another example>:

Copy Code
This /is /a:"different" /example

Additional references

Command-Line Syntax Key


Nslookup /set retry

Applies To: Windows Server 2008,Windows Server 2008 R2

Sets the number of retries.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
set retry=<Number>

Parameters

Parameter | Description
<Number> | Specifies the new value for the number of retries. The default number of retries is 4.
{help | ?} | Displays a short summary of nslookup subcommands.

Remarks

  • When a reply to a request is not received within a certain amount of time, the time-out period is doubled and the request is resent. The retry value controls how many times a request is resent before giving up. You can change the time-out period with the set timeout subcommand.

Scripting <optional section>

<Here is where you discuss using the command within a script. You should also provide an FWLink to a specific page in the Script Center, if possible.>

Examples

<Here is where you put a detailed description of your example>:

Copy Code
This /is /the /example

<Here is where you put detailed descriptions of another example>:

Copy Code
This /is /a:"different" /example

Additional references

Command-Line Syntax Key

Nslookup /set timeout


Nslookup /set root

Applies To: Windows Server 2008 R2,Windows Server 2008

Changes the name of the root server used for queries.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
set root=<RootServer>

Parameters

Parameter | Description
<RootServer> | Specifies the new name for the root server. The default value is ns.nic.ddn.mil.
{help | ?} | Displays a short summary of nslookup subcommands.

Remarks

  • The set root subcommand affects the root subcommand.

Scripting <optional section>

<Here is where you discuss using the command within a script. You should also provide an FWLink to a specific page in the Script Center, if possible.>

Examples

<Here is where you put a detailed description of your example>:

Copy Code
This /is /the /example

<Here is where you put detailed descriptions of another example>:

Copy Code
This /is /a:"different" /example

Additional references

Command-Line Syntax Key

Nslookup /root


Nslookup /set search

Applies To: Windows Server 2008,Windows Server 2008 R2

Appends the Domain Name System (DNS) domain names in the DNS domain search list to the request until an answer is received. This applies when the set and the lookup request contain at least one period, but do not end with a trailing period.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
set [no]search

Parameters

Parameter | Description
nosearch | Stops appending the Domain Name System (DNS) domain names in the DNS domain search list to the request.
search | Appends the Domain Name System (DNS) domain names in the DNS domain search list to the request until an answer is received. The default syntax is search.
{help | ?} | Displays a short summary of nslookup subcommands.

Remarks

<Insert command-specific remarks here.>

Scripting <optional section>

<Here is where you discuss using the command within a script. You should also provide an FWLink to a specific page in the Script Center, if possible.>

Examples

<Here is where you put a detailed description of your example>:

Copy Code
This /is /the /example

<Here is where you put detailed descriptions of another example>:

Copy Code
This /is /a:"different" /example

Additional references

Command-Line Syntax Key


Nslookup /set srchlist

Applies To: Windows Server 2008 R2,Windows Server 2008

Changes the default Domain Name System (DNS) domain name and search list.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
Set srchlist=<DomainName>[/...]

Parameters

Parameter | Description
<DomainName> | Specifies new names for the default DNS domain and search list. The default domain name value is based on the host name. You can specify a maximum of six names separated by slashes (/).
{help | ?} | Displays a short summary of nslookup subcommands.

Remarks

  • The set srchl command overrides the default DNS domain name and search list of the set domain command. Use the set all command to display the list.

Scripting <optional section>

<Here is where you discuss using the command within a script. You should also provide an FWLink to a specific page in the Script Center, if possible.>

Examples

The following example sets the DNS domain to mfg.widgets.com and the search list to the three names:

Copy Code
set srchlist=mfg.widgets.com/mrp2.widgets.com/widgets.com

<Here is where you put detailed descriptions of another example>:

Copy Code
This /is /a:"different" /example

Additional references

Command-Line Syntax Key

Nslookup /set domain

Nslookup /set all


Nslookup /set timeout

Applies To: Windows Server 2008,Windows Server 2008 R2

Changes the initial number of seconds to wait for a reply to a request.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
set timeout=<Number>

Parameters

Parameter | Description
<Number> | Specifies the number of seconds to wait for a reply. The default number of seconds to wait is 5.
{help | ?} | Displays a short summary of nslookup subcommands.

Remarks

  • When a reply to a request is not received within the specified time period, the time-out is doubled and the request is sent again. You can use the set retry command to control the number of retries.

Scripting <optional section>

<Here is where you discuss using the command within a script. You should also provide an FWLink to a specific page in the Script Center, if possible.>

Examples

<Here is where you put a detailed description of your example>:

Copy Code
This /is /the /example

<Here is where you put detailed descriptions of another example>:

Copy Code
This /is /a:"different" /example

Additional references

Command-Line Syntax Key

Nslookup /set retry


Nslookup /set type

Applies To: Windows Server 2008 R2,Windows Server 2008

Changes the resource record type for the query.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
set type=<ResourceRecordType>

Parameters

Parameter Description

<ResourceRecordType>

Specifies a DNS resource record type. The default resource record type is A. The following table lists the valid values for this command.

Value | Description
A | Specifies a computer's IP address.
ANY | Specifies all types of data.
CNAME | Specifies a canonical name for an alias.
GID | Specifies a group identifier of a group name.
HINFO | Specifies a computer's CPU and type of operating system.
MB | Specifies a mailbox domain name.
MG | Specifies a mail group member.
MINFO | Specifies mailbox or mail list information.
MR | Specifies the mail rename domain name.
MX | Specifies the mail exchanger.
NS | Specifies a DNS name server for the named zone.
PTR | Specifies a computer name if the query is an IP address; otherwise, specifies the pointer to other information.
SOA | Specifies the start-of-authority for a DNS zone.
TXT | Specifies the text information.
UID | Specifies the user identifier.
UINFO | Specifies the user information.
WKS | Describes a well-known service.

{help | ?}

Displays a short summary of nslookup subcommands.

Remarks

  • The set type command performs the same function as the set querytype command.

  • For more information about resource record types, see Request For Comment (RFC) 1035.

Scripting <optional section>

<Here is where you discuss using the command within a script. You should also provide an FWLink to a specific page in the Script Center, if possible.>

Examples

<Here is where you put a detailed description of your example>:

Copy Code
This /is /the /example

<Here is where you put detailed descriptions of another example>:

Copy Code
This /is /a:"different" /example

Additional references

Command-Line Syntax Key

Nslookup /set querytype


Nslookup /set vc

Applies To: Windows Server 2008,Windows Server 2008 R2

Specifies to use or not use a virtual circuit when sending requests to the server.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
set [no]vc

Parameters

Parameter | Description
novc | Specifies to never use a virtual circuit when sending requests to the server. The default is novc.
vc | Specifies to always use a virtual circuit when sending requests to the server.
{help | ?} | Displays a short summary of nslookup subcommands.

Remarks

<Insert command-specific remarks here.>

Scripting <optional section>

<Here is where you discuss using the command within a script. You should also provide an FWLink to a specific page in the Script Center, if possible.>

Examples

<Here is where you put a detailed description of your example>:

Copy Code
This /is /the /example

<Here is where you put detailed descriptions of another example>:

Copy Code
This /is /a:"different" /example

Additional references

Command-Line Syntax Key


Nslookup /view

Applies To: Windows Server 2008 R2,Windows Server 2008

Sorts and lists the output of the previous ls subcommand or commands.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
view <FileName>

Parameters

Parameter | Description
<FileName> | Specifies the name of the file containing output from the previous ls subcommand or commands.
{help | ?} | Displays a short summary of nslookup subcommands.

Remarks

<Insert command-specific remarks here.>

Scripting <optional section>

<Here is where you discuss using the command within a script. You should also provide an FWLink to a specific page in the Script Center, if possible.>

Examples

<Here is where you put a detailed description of your example>:

Copy Code
This /is /the /example

<Here is where you put detailed descriptions of another example>:

Copy Code
This /is /a:"different" /example

Additional references

Command-Line Syntax Key

Nslookup /ls


Ntbackup

Applies To: Windows Vista,Windows Server 2008

The ntbackup command is not available in Windows Vista or Windows Server 2008. Instead, you should use the wbadmin command and subcommands to back up and restore your computer and files from a command prompt.

You cannot recover backups that you created with ntbackup by using wbadmin. However, a version of ntbackup is available as a download for Windows Server 2008 and Windows Vista users who want to recover backups that they created using ntbackup. This downloadable version of ntbackup enables you to perform recoveries only of legacy backups, and it cannot be used on computers running Windows Server 2008 or Windows Vista to create new backups. To download this version of ntbackup, see http://go.microsoft.com/fwlink/?LinkId=82917.

Additional references

Command-Line Syntax Key

Wbadmin


Ntdsutil

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Server 2003 with SP1,Windows Server 2003,Windows Server 2003 R2

Ntdsutil.exe is a command-line tool that provides management facilities for Active Directory Domain Services (AD DS) and Active Directory Lightweight Directory Services (AD LDS). You can use the ntdsutil commands to perform database maintenance of AD DS, manage and control single master operations, and remove metadata left behind by domain controllers that were removed from the network without being properly uninstalled. This tool is intended for use by experienced administrators.

Ntdsutil.exe is built into Windows Server 2008 and Windows Server 2008 R2. It is available if you have the AD DS or the AD LDS server role installed. It is also available if you install the Active Directory Domain Services Tools that are part of the Remote Server Administration Tools (RSAT). For more information, see How to Administer Microsoft Windows Client and Server Computers Locally and Remotely (http://go.microsoft.com/fwlink/?LinkID=177813).

To use Ntdsutil.exe, you must run the ntdsutil command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

If you have the AD LDS server role installed but not the AD DS server role, you can use the dsdbutil.exe and dsmgmt.exe command-line tools to perform the same tasks that you can perform with ntdsutil.exe. For more information about the dsdbutil command, see Dsdbutil. For more information about the dsmgmt command, see Dsmgmt.

For most of the Ntdsutil commands, you only need to type the first few characters of the command name instead than the entire command. For example, you can type either of the following commands to activate an instance for AD DS:

Copy Code
activate instance ntds
ac i ntds

The short form for each command is listed in the following table.

Syntax

Copy Code
Ntdsutil [activate instance %s | authoritative restore | change service account %s1 %s2 | configurable settings | DS behavior | files | group membership evaluation | Help | ifm | ldap policies | ldap port %d | list instance | local roles | metadata cleanup | partition management | popups on | popups off | quit | roles | security account management | semantic database analysis | set DSRM password | snapshot | SSL port %d]

Commands

Command | Description
Activate instance %s short form: ac i %s | Sets NTDS or a specific AD LDS instance as the active instance.
authoritative restore Short form: au r | Authoritatively restores the Active Directory database or AD LDS instance.
Change service account %s1 %s2 | Changes the AD LDS service account to user name %s1 and password %s2. Use "NULL" for a blank password. Use * to prompt the user to enter a password.
configurable settings Short form: co s | Manages configurable settings.
DS behavior Short form: ds b | Views and modifies AD DS or AD LDS behavior.
files Short form: f | Manages AD DS or AD LDS database files.
group membership evaluation Short form: g m e | Evaluates security IDs (SIDs) in the token for a given user or group.
Help | Shows this help information.
ifm Short form: i | Creates installation media for writable (full) and read-only domain controllers (RODCs) and instances of AD LDS.
LDAP policies | Manages Lightweight Directory Access Protocol (LDAP) protocol policies.
Ldap port %d | Configures an LDAP port for an AD LDS instance.
List instances Short form: li i | Lists all AD LDS instances that are installed on a computer.
local roles Short form: lo r | Manages local administrative roles on an RODC.
metadata cleanup Short form: m c | Cleans up objects of decommissioned servers.
partition management Short form: pa m | Manages directory partitions.
Popups off Short form: po off | Disables popups.
Popups on Short form: po on | Enables popups.
Quit Short form: q | Quits the command.
roles Short form: r | Transfers and seizes operations master roles.
security account management Short form: sec a m | Manages SIDs.
semantic database analysis Short form: sem d a | Verifies integrity of AD DS or AD LDS database files with respect to Active Directory semantics.
set DSRM password Short form: set d p | Resets the Directory Services Restore Mode (DSRM) administrator password.
snapshot Short form: sn | Manages snapshots of the volumes that contain the Active Directory database and log files.
SSL port %d | Configures a Secure Sockets Layer (SSL) port for an AD LDS instance.


Openfiles

Applies To: Windows Vista,Windows Server 2008

Enables an administrator to query, display, or disconnect files and directories that have been opened on a system. Also enables or disables the system Maintain Objects List global flag.

This topic includes information about the following commands:

  • openfiles /disconnect

  • openfiles /query

  • openfiles /local

openfiles /disconnect

Enables an administrator to disconnect files and folders that have been opened remotely through a shared folder.
Syntax
Copy Code
openfiles /disconnect [/s <System> [/u [<Domain>\]<UserName> [/p [<Password>]]]] {[/id <OpenFileID>] | [/a <AccessedBy>] | [/o {read | write | read/write}]} [/op <OpenFile>]
Parameters

Parameter Description

/s <System>

Specifies the remote system to connect to (by name or IP address). Do not use backslashes. If you do not use the /s option, the command is executed on the local computer by default. This parameter applies to all files and folders that are specified in the command.

/u [<Domain>\]<UserName>

Executes the command by using the permissions of the specified user account. If you do not use the /u option, system permissions are used by default.

/p [<Password>]

Specifies the password of the user account that is specified in the /u option. If you do not use the /p option, a password prompt appears when the command is executed.

/id <OpenFileID>

Disconnects open files by the specified file ID. The wildcard character (*) can be used with this parameter.

Note
You can use the openfiles /query command to find the file ID.

/a <AccessedBy>

Disconnects all open files associated with the user name that is specified in the AccessedBy parameter. The wildcard character (*) can be used with this parameter.

/o {read | write | read/write}

Disconnects all open files with the specified open mode value. Valid values are Read, Write, or Read/Write. The wildcard character (*) can be used with this parameter.

/op <OpenFile>

Disconnects all open file connections that are created by a specific open file name. The wildcard character (*) can be used with this parameter.

/?

Displays help at the command prompt.

Examples

To disconnect all open files with the file ID 26843578, type:

Copy Code
openfiles /disconnect /id 26843578

To disconnect all open files and directories accessed by the user "hiropln," type:

Copy Code
openfiles /disconnect /a hiropln

To disconnect all open files and directories with read/write mode, type:

Copy Code
openfiles /disconnect /o read/write

To disconnect the directory with the Open File name "C:\TestShare\", regardless of who is accessing it, type:

Copy Code
openfiles /disconnect /a * /op "c:\testshare\"

To disconnect all open files on the remote computer "srvmain" that are being accessed by the user "hiropln," regardless of their ID, type:

Copy Code
openfiles /disconnect /s srvmain /u maindom\hiropln /id *

openfiles /query

Queries and displays all open files.
Syntax
Copy Code
openfiles /query [/s <System> [/u [<Domain>\]<UserName> [/p [<Password>]]]] [/fo {TABLE | LIST | CSV}] [/nh] [/v]
Parameters

Parameter | Description
/s <System> | Specifies the remote system to connect to (by name or IP address). Do not use backslashes. If you do not use the /s option, the command is executed on the local computer by default. This parameter applies to all files and folders that are specified in the command.
/u [<Domain>\]<UserName> | Executes the command by using the permissions of the specified user account. If you do not use the /u option, system permissions are used by default.
/p [<Password>] | Specifies the password of the user account that is specified in the /u option. If you do not use the /p option, a password prompt appears when the command is executed.
[/fo {TABLE | LIST | CSV}] | Displays the output in the specified format. Valid values for Format are: TABLE: Displays output in a table. LIST: Displays output in a list. CSV: Displays output in Comma Separated Values format.
/nh | Suppresses column header in the output. Valid only when the /fo parameter is set to TABLE or CSV.
/v | Specifies that detailed information be displayed in the output.
/? | Displays help at the command prompt.
Examples

To query and display all open files, type:

Copy Code
openfiles /query

To query and display all open files in table format without headers, type:

Copy Code
openfiles /query /fo table /nh

To query and display all open files in list format with detailed information, type:

Copy Code
openfiles /query /fo list /v

To query and display all open files on the remote system "srvmain" by using the credentials for the user "hiropln" on the "maindom" domain, type:

Copy Code
openfiles /query /s srvmain /u maindom\hiropln /p p@ssW23
Note
In this example, the password is supplied on the command line. To prevent displaying the password, leave out the /p option. You will be prompted for the password, which will not be echoed to the screen.

openfiles /local

Enables or disables the system Maintain Objects List global flag. If used without parameters, openfiles /local displays the current status of the Maintain Objects List global flag.
Syntax
Copy Code
openfiles /local [on | off]
Parameters

Parameter | Description
[on | off] | Enables or disables the system Maintain Objects List global flag, which tracks local file handles.
/? | Displays help at the command prompt.
Remarks
  • Enabling the Maintain Objects List global flag may slow down your system.

  • Changes made by using the on or off option do not take effect until you restart the system.

Examples

To check the current status of the Maintain Objects List global flag, type:

Copy Code
openfiles /local

By default, the Maintain Objects List global flag is disabled, and the following output is displayed:

Copy Code
INFO: The system global flag 'maintain objects list' is currently disabled.

To enable the Maintain Objects List global flag, type:

Copy Code
openfiles /local on

The following message is displayed when the global flag is enabled:

Copy Code
SUCCESS: The system global flag 'maintain objects list' is enabled.
         This will take effect after the system is restarted.

To disable the Maintain Objects List global flag, type:

Copy Code
openfiles /local off

Additional references

Command-Line Syntax Key


Pagefileconfig.vbs

Applies To: Windows Server 2003 with SP1,Windows XP,Windows Server 2003,Windows Server 2003 with SP2,Windows Server 2003 R2

Pagefileconfig.vbs is deprecated, and is not guaranteed to be supported in future releases of Windows.

This tool is included in Windows Server 2003. For more information see Pagefileconfig.vbs.


Path

Applies To: Windows Server 2008,Windows Vista

Sets the command path in the PATH environment variable (the set of directories used to search for executable files). If used without parameters, path displays the current command path.

For examples of how to use this command, see Examples.

Syntax

Copy Code
path [[<Drive>:]<Path>[;...][;%PATH%]]
path ;

Parameters

Parameter | Description
[<Drive>:]<Path> | Specifies the drive and directory to set in the command path.
; | Separates directories in the command path. If used without other parameters, ; clears the existing command paths from the PATH environment variable and directs Cmd.exe to search only in the current directory.
%PATH% | Appends the command path to the existing set of directories listed in the PATH environment variable.
/? | Displays help at the command prompt.

Remarks

  • When you include %PATH% in the syntax, Cmd.exe replaces it with the command path values found in the PATH environment variable, eliminating the need to manually enter these values at the command prompt.

  • The current directory is always searched before the directories specified in the command path.

  • You might have files in a directory that share the same file name but have different extensions. For example, you might have a file named Accnt.com that starts an accounting program and another file named Accnt.bat that connects your server to the accounting system network.

    The Windows operating system searches for a file by using default file name extensions in the following order of precedence: .exe, .com, .bat, and .cmd. To run Accnt.bat when Accnt.com exists in the same directory, you must include the .bat extension at the command prompt.

  • If two or more files in the command path have the same file name and extension, path first searches for the specified file name in the current directory. Then it searches the directories in the command path in the order that they are listed in the PATH environment variable.

  • If you place the path command in your Autoexec.nt file, the Windows operating system automatically appends the specified MS-DOS subsystem search path every time you log on to your computer. Cmd.exe does not use the Autoexec.nt file. When started from a shortcut, Cmd.exe inherits the environment variables set in My Computer/Properties/Advanced/Environment.

Examples

To search the paths C:\User\Taxes, B:\User\Invest, and B:\Bin for external commands, type:

path c:\user\taxes;b:\user\invest;b:\bin

Additional references

Command-Line Syntax Key


Pathping
See Also

Applies To: Windows Vista,Windows Server 2003,Windows Server 2000,Windows Server 2003 R2,Windows 7,Windows Server 2008,Windows Server 2008 R2,Windows XP

Pathping

Provides information about network latency and network loss at intermediate hops between a source and destination. Pathping sends multiple Echo Request messages to each router between a source and destination over a period of time and then computes results based on the packets returned from each router. Because pathping displays the degree of packet loss at any given router or link, you can determine which routers or subnets might be having network problems. Pathping performs the equivalent of the tracert command by identifying which routers are on the path. It then sends pings periodically to all of the routers over a specified time period and computes statistics based on the number returned from each. Used without parameters, pathping displays help.
Syntax

pathping [-n] [-h MaximumHops] [-g HostList] [-p Period] [-q NumQueries[-w Timeout] [-i IPAddress] [-4 IPv4] [-6 IPv6][TargetName]

Parameters
-n

Prevents pathping from attempting to resolve the IP addresses of intermediate routers to their names. This might expedite the display of pathping results.

-h MaximumHops

Specifies the maximum number of hops in the path to search for the target (destination). The default is 30 hops.

-g HostList

Specifies that the Echo Request messages use the Loose Source Route option in the IP header with the set of intermediate destinations specified in HostList. With loose source routing, successive intermediate destinations can be separated by one or multiple routers. The maximum number of addresses or names in the host list is 9. The HostList is a series of IP addresses (in dotted decimal notation) separated by spaces.

-p Period

Specifies the number of milliseconds to wait between consecutive pings. The default is 250 milliseconds (1/4 second).

-q NumQueries

Specifies the number of Echo Request messages sent to each router in the path. The default is 100 queries.

-w Timeout

Specifies the number of milliseconds to wait for each reply. The default is 3000 milliseconds (3 seconds).

-i IPAddress

Specifies the source address.

-4 IPv4

Specifies that pathping uses IPv4 only.

-6 IPv6

Specifies that pathping uses IPv6 only.

TargetName

Specifies the destination, which is identified either by IP address or host name.

/?

Displays help at the command prompt.

Remarks
  • Pathping parameters are case-sensitive.

  • To avoid network congestion, pings should be sent at a sufficiently slow pace.

  • To minimize the effects of burst losses, do not send pings too frequently.

  • When using the -p parameter, pings are sent individually to each intermediate hop. Because of this, the interval between two pings sent to the same hop is period multiplied by the number of hops.

  • When using the -w parameter, multiple pings can be sent in parallel. Because of this, the amount of time specified in the Timeout parameter is not bounded by the amount of time specified in the Period parameter for waiting between pings.

  • This command is available only if the Internet Protocol (TCP/IP) protocol is installed as a component in the properties of a network adapter in Network Connections.

Examples

The following example shows pathping command output:

Copy Code
D:\>pathping -n corp1

Tracing route to corp1 [10.54.1.196]
over a maximum of 30 hops:
  0  172.16.87.35
  1  172.16.87.218
  2  192.168.52.1
  3  192.168.80.1
  4  10.54.247.14
  5  10.54.1.196

Computing statistics for 125 seconds...
            Source to Here   This Node/Link
Hop  RTT    Lost/Sent = Pct  Lost/Sent = Pct  Address
  0                                           172.16.87.35
                                0/ 100 =  0%   |
  1   41ms     0/ 100 =  0%     0/ 100 =  0%  172.16.87.218
                               13/ 100 = 13%   |
  2   22ms    16/ 100 = 16%     3/ 100 =  3%  192.168.52.1
                                0/ 100 =  0%   |
  3   24ms    13/ 100 = 13%     0/ 100 =  0%  192.168.80.1
                                0/ 100 =  0%   |
  4   21ms    14/ 100 = 14%     1/ 100 =  1%  10.54.247.14
                                0/ 100 =  0%   |
  5   24ms    13/ 100 = 13%     0/ 100 =  0%  10.54.1.196

Trace complete.

When pathping is run, the first results list the path. This is the same path that is shown using the tracert command. Next, a busy message is displayed for approximately 90 seconds (the time varies by hop count). During this time, information is gathered from all routers previously listed and from the links between them. At the end of this period, the test results are displayed.

In the sample report above, the This Node/Link, Lost/Sent = Pct and Address columns show that the link between 172.16.87.218 and 192.168.52.1 is dropping 13 percent of the packets. The routers at hops 2 and 4 also are dropping packets addressed to them, but this loss does not affect their ability to forward traffic that is not addressed to them.

The loss rates displayed for the links, identified as a vertical bar (|) in the Address column, indicate link congestion that is causing the loss of packets that are being forwarded on the path. The loss rates displayed for routers (identified by their IP addresses) indicate that these routers might be overloaded.

Formatting legend

Format | Meaning
Italic | Information that the user must supply
Bold | Elements that the user must type exactly as shown
Ellipsis (...) | Parameter that can be repeated several times in a command line
Between brackets ([]) | Optional items
Between braces ({}); choices separated by pipe (|). Example: {even|odd} | Set of choices from which the user must choose only one
Courier font | Code or program output

See Also

TracertCommand-line reference A-ZCommand shell overview


Pause

Applies To: Windows Server 2008,Windows Vista

Suspends the processing of a batch program and displays the following prompt:

Copy Code
Press any key to continue . . .

For examples of how to use this command, see Examples.

Syntax

Copy Code
pause

Parameters

Parameter | Description
/? | Displays help at the command prompt.

Remarks

  • When you run the pause command, the following message appears:

    Copy Code
    Press any key to continue . . .
  • If you press CTRL+C to stop a batch program, the following message appears:

    Copy Code
    Terminate batch job (Y/N)?
    If you press Y (for yes) in response to this message, the batch program ends and control returns to the operating system.

  • You can insert the pause command before a section of the batch file that you might not want to process. When pause suspends processing of the batch program, you can press CTRL+C and then press Y to stop the batch program.

Examples

To create a batch program that prompts the user to change disks in one of the drives, type:

Copy Code
@echo off
:Begin
copy a:*.*
echo Put a new disk into drive A
pause
goto begin

In this example, all the files on the disk in drive A are copied to the current directory. After the message prompts you to put a new disk in drive A, the pause command suspends processing so that you can change disks and then press any key to resume processing. This batch program runs in an endless loop—the goto begin command sends the command interpreter to the Begin label of the batch file. To stop this batch program, press CTRL+C and then press Y.

Additional references

Command-Line Syntax Key


Pbadmin

Applies To: Windows Server 2003,Windows Server 2003 with SP2,Windows Server 2003 R2,Windows XP,Windows Server 2003 with SP1

Pbadmin is deprecated, and is not guaranteed to be supported in future releases of Windows.

This tool is included in Windows Server 2003. For more information see Pbadmin.


Pentnt

Applies To: Windows Server 2003 with SP1,Windows XP,Windows Server 2003 R2,Windows Server 2003 with SP2,Windows Server 2003

Pentnt is deprecated, and is not guaranteed to be supported in future releases of Windows.

This tool is included in Windows Server 2003. For more information see Pentnt.


Perfmon

Applies To: Windows Vista,Windows 7,Windows Server 2008,Windows Server 2008 R2

Start Windows Reliability and Performance Monitor in a specific standalone mode.

Syntax

Copy Code
perfmon </res|report|rel|sys>

Parameters

Parameter | Description
/res | Start Resource View.
/report | Start the System Diagnostics Data Collector Set and display a report of the results.
/rel | Start Reliability Monitor.
/sys | Start Performance Monitor.

Additional references

Windows Reliability and Performance Monitor [Vista]


Ping
See Also

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows XP,Windows 7,Windows Server 2003 R2,Windows Server 2003,Windows Vista,Windows Server 2000

Ping

Verifies IP-level connectivity to another TCP/IP computer by sending Internet Control Message Protocol (ICMP) Echo Request messages. The receipt of corresponding Echo Reply messages are displayed, along with round-trip times. Ping is the primary TCP/IP command used to troubleshoot connectivity, reachability, and name resolution. Used without parameters, ping displays help.
Syntax

ping[-t] [-a] [-n Count] [-l Size] [-f] [-i TTL] [-v TOS] [-r Count] [-s Count] [{-j HostList | -k HostList}] [-w Timeout] [-R] [-S SrcAddr] [-4] [-6] TargetName

Parameters
-t

Specifies that ping continue sending Echo Request messages to the destination until interrupted. To interrupt and display statistics, press CTRL+BREAK. To interrupt and quit ping, press CTRL+C.

-a

Specifies that reverse name resolution is performed on the destination IP address. If this is successful, ping displays the corresponding host name.

-n Count

Specifies the number of Echo Request messages sent. The default is 4.

-l Size

Specifies the length, in bytes, of the Data field in the Echo Request messages sent. The default is 32. The maximum Size is 65,527.

-f

Specifies that Echo Request messages are sent with the Don't Fragment flag in the IP header set to 1 (available on IPv4 only). The Echo Request message cannot be fragmented by routers in the path to the destination. This parameter is useful for troubleshooting path Maximum Transmission Unit (PMTU) problems.

-i TTL

Specifies the value of the TTL field in the IP header for Echo Request messages sent. The default is the default TTL value for the host. The maximum TTL is 255.

-v TOS

Specifies the value of the Type of Service (TOS) field in the IP header for Echo Request messages sent (available on IPv4 only). The default is 0. TOS is specified as a decimal value from 0 through 255.

-r Count

Specifies that the Record Route option in the IP header is used to record the path taken by the Echo Request message and corresponding Echo Reply message (available on IPv4 only). Each hop in the path uses an entry in the Record Route option. If possible, specify a Count that is equal to or greater than the number of hops between the source and destination. The Count must be a minimum of 1 and a maximum of 9.

-s Count

Specifies that the Internet Timestamp option in the IP header is used to record the time of arrival for the Echo Request message and corresponding Echo Reply message for each hop. The Count must be a minimum of 1 and a maximum of 4. This is required for link-local destination addresses.

-j HostList

Specifies that the Echo Request messages use the Loose Source Route option in the IP header with the set of intermediate destinations specified in HostList (available on IPv4 only). With loose source routing, successive intermediate destinations can be separated by one or multiple routers. The maximum number of addresses or names in the host list is 9. The host list is a series of IP addresses (in dotted decimal notation) separated by spaces.

-k HostList

Specifies that the Echo Request messages use the Strict Source Route option in the IP header with the set of intermediate destinations specified in HostList (available on IPv4 only). With strict source routing, the next intermediate destination must be directly reachable (it must be a neighbor on an interface of the router). The maximum number of addresses or names in the host list is 9. The host list is a series of IP addresses (in dotted decimal notation) separated by spaces.

-w Timeout

Specifies the amount of time, in milliseconds, to wait for the Echo Reply message that corresponds to a given Echo Request message to be received. If the Echo Reply message is not received within the time-out, the "Request timed out" error message is displayed. The default time-out is 4000 (4 seconds).

-R

Specifies that the round-trip path is traced (available on IPv6 only).

-S SrcAddr

Specifies the source address to use (available on IPv6 only).

-4

Specifies that IPv4 is used to ping. This parameter is not required to identify the target host with an IPv4 address. It is only required to identify the target host by name.

-6

Specifies that IPv6 is used to ping. This parameter is not required to identify the target host with an IPv6 address. It is only required to identify the target host by name.

TargetName

Specifies the host name or IP address of the destination.

/?

Displays help at the command prompt.

Remarks
  • You can use ping to test both the computer name and the IP address of the computer. If pinging the IP address is successful, but pinging the computer name is not, you might have a name resolution problem. In this case, ensure that the computer name you are specifying can be resolved through the local Hosts file, by using Domain Name System (DNS) queries, or through NetBIOS name resolution techniques.

  • This command is available only if the Internet Protocol (TCP/IP) protocol is installed as a component in the properties of a network adapter in Network Connections.

Examples

The following example shows ping command output:

C:\>ping example.microsoft.com

Pinging example.microsoft.com [192.168.239.132] with 32 bytes of data:

Reply from 192.168.239.132: bytes=32 time=101ms TTL=124

Reply from 192.168.239.132: bytes=32 time=100ms TTL=124

Reply from 192.168.239.132: bytes=32 time=120ms TTL=124

Reply from 192.168.239.132: bytes=32 time=120ms TTL=124

To ping the destination 10.0.99.221 and resolve 10.0.99.221 to its host name, type:

ping -a 10.0.99.221

To ping the destination 10.0.99.221 with 10 Echo Request messages, each of which has a Data field of 1000 bytes, type:

ping -n 10 -l 1000 10.0.99.221

To ping the destination 10.0.99.221 and record the route for 4 hops, type:

ping -r 4 10.0.99.221

To ping the destination 10.0.99.221 and specify the loose source route of 10.12.0.1-10.29.3.1-10.1.44.1, type:

ping -j 10.12.0.1 10.29.3.1 10.1.44.1 10.0.99.221

Formatting legend

Format | Meaning
Italic | Information that the user must supply
Bold | Elements that the user must type exactly as shown
Ellipsis (...) | Parameter that can be repeated several times in a command line
Between brackets ([]) | Optional items
Between braces ({}); choices separated by pipe (|). Example: {even|odd} | Set of choices from which the user must choose only one
Courier font | Code or program output

See Also

Command-line reference A-ZCommand shell overview


Pnpunattend

Applies To: Windows Vista,Windows 7,Windows Server 2008,Windows Server 2008 R2

Audits a computer for device drivers, and perform unattended driver installations, or search for drivers without installing and, optionally, report the results to the command line. Use this command to specify the installation of specific drivers for specific hardware devices. See Remarks.

Syntax

Copy Code
PnPUnattend.exe auditSystem [/help] [/?] [/h] [/s] [/L]

Parameters

Parameter | Description
auditSystem | Specifies online driver install. Required, except when pnpunattend is run with either the /Help or /? parameters.
/s | Optional. Specifies to search for drivers without installing.
 | Optional. Specifies to display the log information for this command in the command prompt.
/? | Optional. Displays help for this command at the command prompt.

Remarks

Preliminary preparation is required. Prior to using this command, you must complete the following tasks:

  1. Create a directory for the drivers you want to install. For example, create a folder at C:\Drivers\Video for video adapter drivers.

  2. Download and extract the driver package for your device. Copy the contents of the subfolder that contains the INF file for your version of the operating system and any subfolders to the video folder that you created. For example, copy the video driver files to C:\Drivers\Video.

  3. Add a system environment path variable to the folder you created in step 1.For example, C:\Drivers\Video.

  4. Create the following registry key, and then for the DriverPaths key you create, set the Value Data to 1.

  • For Windows® 7 navigate the Registry path: HKEY_LOCAL_Machine\Software\Microsoft\Windows NT\CurrentVersion\, and then create the keys: UnattendSettings\PnPUnattend\DriverPaths\

  • For Windows Vista, navigate to the Registry path: HK_LM\Software\Microsoft\Windows NT\CurrentVersion\, and then create the keys = \UnattendSettings\PnPUnattend\DriverPaths.

Examples

The following example command shows how to use the PNPUnattend.exe to audit a computer for possible driver updates, and then report the findings to the Command Prompt.

Copy Code
pnpunattend auditsystem /s /l

Additional references

Command-Line Syntax Key


Pnputil

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows 7,Windows Vista

Pnputil.exe is a command line utility that you can use to manage the driver store. You can use Pnputil to add driver packages, remove driver packages, and list driver packages that are in the store.

Syntax

Copy Code
pnputil.exe [-f | -i] [ -? | -a | -d | -e ] <INF name>

Parameters

Parameter | Description
-a | Specifies to add the identified INF file.
-d | Specifies to delete the identified INF file.
-e | Specifies to enumerate all third-party INF files.
-f | Specifies to force the deletion of the identified INF file. Cannot be used in conjunction with the –i parameter.
-i | Specifies to install the identified INF file. Cannot be used in conjunction with the -f parameter.
/? | Displays help at the command prompt.

Remarks

Examples

  • pnputil.exe -a a:\usbcam\USBCAM.INF Adds the INF file that is specified by USBCAM.INF

  • pnputil.exe -a c:\drivers\*.inf Adds all INF files in c:\drivers\

  • pnputil.exe -i -a a:\usbcam\USBCAM.INF Adds and installs the specified driver.

  • pnputil.exe –e Enumerates all third-party drivers.

  • pnputil.exe -d oem0.inf Deletes the specified.

  • pnputil.exe -f -d oem0.inf Forces the deletion of the specified INF file.

Additional references

Command-Line Syntax Key

Popd


Popd

Applies To: Windows Vista,Windows Server 2003,Windows Server 2000,Windows Server 2003 R2,Windows 7,Windows Server 2008,Windows XP

Changes the current directory to the directory that was most recently stored by the pushd command.

For examples of how to use this command, see Examples.

Syntax

Copy Code
popd

Parameters

Parameter | Description
/? | Displays help at the command prompt.

Remarks

  • Every time you use the pushd command, a single directory is stored for your use. However, you can store multiple directories by using the pushd command multiple times.

    The directories are stored sequentially in a virtual stack. If you use the pushd command once, the directory in which you use the command is placed at the bottom of the stack. If you use the command again, the second directory is placed on top of the first one. The process repeats every time you use the pushd command.

    You can use the popd command to change the current directory to the directory most recently stored by the pushd command. If you use the popd command, the directory on the top of the stack is removed from the stack and the current directory is changed to that directory. If you use the popd command again, the next directory on the stack is removed.

  • When command extensions are enabled, the popd command removes any drive-letter assignations created by pushd.

Examples

The following example shows how you can use the pushd command and the popd command in a batch program to change the current directory from the one in which the batch program was run and then change it back:

Copy Code
@echo off
rem This batch file deletes all .txt files in a specified directory
pushd %1
del *.txt
popd
cls
echo All text files deleted in the %1 directory

Additional references

Command-Line Syntax Key

Pushd


PowerShell

Applies To: Windows XP,Windows Server 2008,Windows Server 2008 R2,Windows 7,Windows Server 2003 with SP2,Windows Vista

Windows PowerShell™ is a task-based command-line shell and scripting language designed especially for system administration. Built on the .NET Framework, Windows PowerShell helps IT professionals and power users control and automate the administration of the Windows operating system and applications that run on Windows.

The PowerShell.exe command-line tool starts a Windows PowerShell session in a Command Prompt window. When you use PowerShell.exe, you can use its optional parameters to customize the session. For example, you can start a session that uses a particular execution policy or one that excludes a Windows PowerShell profile. Otherwise, the session is the same as any session that is started in the Windows PowerShell console.

Using PowerShell.exe

You can use PowerShell.exe to start and end a Windows PowerShell session in a Command Prompt window.

  1. To start a Windows PowerShell session in a Command Prompt window, type powershell. A PS prefix is added to the command prompt to indicate that you are in a Windows PowerShell session.

  2. To end a Windows PowerShell session in a Command Prompt window, type exit. The typical command prompt returns.

For a list of the PowerShell.exe command-line parameters, see PowerShell.exe Console Help.

Other Ways to Start Windows PowerShell

For information about other ways to start Windows PowerShell, see Starting Windows PowerShell.

Remarks

Windows PowerShell 2.0 runs on the Server Core installation option of the Windows Server 2008 operating system. However, features that require a user interface, such as the Windows PowerShell Integrated Scripting Environment (ISE) and the Out-GridView cmdlet, do not run on Server Core installations.


Print

Applies To: Windows Vista,Windows Server 2003,Windows Server 2000,Windows Server 2003 R2,Windows 7,Windows Server 2008 R2,Windows Server 2008,Windows XP

Sends a text file to a printer.

For examples of how to use this command, see Examples.

Syntax

Copy Code
Print [/d:<PrinterName>] [<Drive>:][<Path>]<FileName>[ ...]

Parameters

Parameter Description

/d:<PrinterName>

Specifies the printer that you want to print the job. To print to a locally connected printer, specify the port on your computer where the printer is connected.

  • Valid values for parallel ports are LPT1, LPT2, and LPT3.

  • Valid values for serial ports are COM1, COM2, COM3, and COM4.

You can also specify a network printer by using its queue name (\\ServerName\PrinterName). If you do not specify a printer, the print job is sent to LPT1 by default.

<Drive>:

Specifies the logical or physical drive where the file you want to print is located. This parameter is not required if the file you want to print is located on the current drive.

<Path>

Specifies the location of the file you want to print. This parameter is not required if the file you want to print is located in the current directory.

<FileName>[ ...]

Required. Specifies the file you want to print. You can include multiple files in one command.

/?

Displays help at the command prompt.

Remarks

  • A file can print in the background if you send it to a printer connected to a serial or parallel port on the local computer.

  • You can perform many configuration tasks from the command prompt by using the Mode command.

    See Mode for more information about:

    • Configuring a printer connected to a parallel port

    • Configuring a printer connected to a serial port

    • Displaying the status of a printer

    • Preparing a printer for code page switching

Examples

To send the file Report.txt in the current directory to a printer connected to LPT2 on the local computer, type:

Copy Code
print /d:lpt2 report.txt

To send the file Report.txt in the c:\Accounting directory to the Printer1 print queue on the \\CopyRoom server, type:

Copy Code
print /d:\\copyroom\printer1 c:\accounting\report.txt

Additional references

Command-Line Syntax Key

Print Command Reference

Mode


Prncnfg.vbs

Applies To: Windows Vista,Windows Server 2008

Configures or displays configuration information about a printer.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
Cscript Prncnfg {-g | -t | -x | -?} [-S <ServerName>] [-P <PrinterName>] [-z <NewPrinterName>] [-u <UserName>] [-w <Password>] [-r <PortName>] [-l <Location>] [-h <ShareName>] [-m <Comment>] [-f <SeparatorFileName>] [-y <Datatype>] [-st <StartTime>] [-ut <UntilTime>] [-i <DefaultPriority>] [-o <Priority>] [<+|->shared] [<+|->direct] [<+|->hidden] [<+|->published] [<+|->rawonly] [<+|->queued] [<+|->enablebidi] [<+|->keepprintedjobs] [<+|->workoffline] [<+|->enabledevq] [<+|->docompletefirst]

Parameters

Parameter | Description
-g | Displays configuration information about a printer.
-t | Configures a printer.
-x | Renames a printer.
-S <ServerName> | Specifies the name of the remote computer that hosts the printer that you want to manage. If you do not specify a computer, the local computer is used.
-P <PrinterName> | Specifies the name of the printer that you want to manage. Required.
-z <NewPrinterName> | Specifies the new printer name. Requires the -x and -P parameters.
-u <UserName> -w <Password> | Specifies an account with permissions to connect to the computer that hosts the printer that you want to manage. All members of the target computer's local Administrators group have these permissions, but the permissions can also be granted to other users. If you do not specify an account, you must be logged on under an account with these permissions for the command to work.
-r <PortName> | Specifies the port where the printer is connected. If this is a parallel or a serial port, then use the ID of the port (for example, LPT1 or COM1). If this is a TCP/IP port, use the port name that was specified when the port was added.
-l <Location> | Specifies the printer location, such as "Copy Room."
-h <ShareName> | Specifies the printer's share name.
-m <Comment> | Specifies the printer's comment string.
-f <SeparatorFileName> | Specifies a file that contains the text that appears on the separator page.
-y <DataType> | Specifies the data types that the printer can accept.
-st <StartTime> | Configures the printer for limited availability. Specifies the time of day the printer is available. If you send a document to a printer when it is unavailable, the document is held (spooled) until the printer becomes available. You must specify time as a 24-hour clock. For example, to specify 11:00 P.M., type 2300.
-ut <EndTime> | Configures the printer for limited availability. Specifies the time of day the printer is no longer available. If you send a document to a printer when it is unavailable, the document is held (spooled) until the printer becomes available. You must specify time as a 24-hour clock. For example, to specify 11:00 P.M., type 2300.
-o <Priority> | Specifies a priority that the spooler uses to route print jobs into the print queue. A print queue with a higher priority receives all its jobs before any queue with a lower priority.
-i <DefaultPriority> | Specifies the default priority assigned to each print job.
{+|-}shared | Specifies whether this printer is shared on the network.
{+|-}direct | Specifies whether the document should be sent directly to the printer without being spooled.
{+|-}published | Specifies whether this printer should be published in Active Directory. If you publish the printer, other users can search for it based on its location and capabilities (such as color printing and stapling).
{+|-}hidden | Reserved function.
{+|-}rawonly | Specifies whether only raw data print jobs can be spooled in this queue.
{+ | -}queued | Specifies that the printer should not begin to print until after the last page of the document is spooled. The printing program is unavailable until the document has finished printing. However, using this parameter ensures that the whole document is available to the printer.
{+ | -}keepprintedjobs | Specifies whether the spooler should retain documents after they are printed. Enabling this option allows a user to resubmit a document to the printer from the print queue instead of from the printing program.
{+ | -}workoffline | Specifies whether a user is able to send print jobs to the print queue if the computer is not connected to the network.
{+ | -}enabledevq | Specifies whether print jobs that do not match the printer setup (for example, PostScript files spooled to non-PostScript printers) should be held in the queue rather than being printed.
{+ | -}docompletefirst | Specifies whether the spooler should send print jobs with a lower priority that have completed spooling before sending print jobs with a higher priority that have not completed spooling. If this option is enabled and no documents have completed spooling, the spooler will send larger documents before smaller ones. You should enable this option if you want to maximize printer efficiency at the cost of job priority. If this option is disabled, the spooler always sends higher priority jobs to their respective queues first.
{+ | -}enablebidi | Specifies whether the printer sends status information to the spooler.
/? | Displays help at the command prompt.

Remarks

  • The Prncnfg.vbs command is a Visual Basic script located in the %WINDIR%\System32\Printing_Admin_Scripts\<language> directory. To use this command, at a command prompt, type Cscript followed by the full path to the Prncnfg.vbs file, or change directories to the appropriate folder. For example:

    Copy Code
    Cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prncnfg.vbs
  • If the information that you supply contains spaces, use quotation marks around the text (for example, "Computer Name").

Examples

To display configuration information for the printer named ColorPrinter_2 with a print queue hosted by the remote computer named HRServer, type:

Copy Code
Cscript Prncnfg.vbs -g -S HRServer -P ColorPrinter_2

To configure a printer named ColorPrinter_2 so that the spooler in the remote computer named HRServer keeps print jobs after they have been printed, type:

Copy Code
Cscript Prncnfg.vbs -t -S HRServer -P ColorPrinter_2 +keepprintedjobs

To change the name of a printer on the remote computer named HRServer from ColorPrinter_2 to ColorPrinter 3, type:

Copy Code
Cscript prncnfg.vbs -x -S HRServer -P ColorPrinter_2 -z "ColorPrinter 3"

Additional references

Command-Line Syntax Key

Print Command Reference


Prndrvr.vbs

Applies To: Windows Server 2008,Windows Vista

Adds, deletes, and lists printer drivers.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
Cscript prndrvr {-a | -d | -l | -x | -?} [-m <model>] [-v {0|1|2|3}]
[-e <environment>] [-s <ServerName>] [-u <UserName>] [-w <Password>]
[-h <path>] [-i <inf file>]

Parameters

Parameter Description

-a

Installs a driver.

-d

Deletes a driver.

-l

Lists all printer drivers installed on the server specified by the -s parameter. If you do not specify a server, Windows lists the printer drivers installed on the local computer.

-x

Deletes all printer drivers and additional printer drivers not in use by a logical printer on the server specified by the -s parameter. If you do not specify a server to remove from the list, Windows deletes all unused printer drivers on the local computer.

-m <DriverModelName>

Specifies (by name) the driver you want to install. Drivers are often named for the model of printer they support. See the printer documentation for more information.

-v {0 | 1 | 2 | 3}

Specifies the version of the driver you want to install. See the description of the -e parameter for information on which versions are available for which environment. If you do not specify a version, the version of the driver appropriate for the version of Windows running on the computer where you are installing the driver is installed.

  • Version 0 supports Windows 95, Windows 98, and Windows Millennium Edition.

  • Version 1 supports Windows NT 3.51.

  • Version 2 supports Windows NT 4.0.

  • Version 3 supports Windows Vista, Windows XP, Windows 2000, and the Windows Server 2003 operating systems. Note that this is the only printer driver version that Windows Vista supports.

-e <Environment>

Specifies the environment for the driver you want to install. If you do not specify an environment, the environment of the computer where you are installing the driver is used. The supported environment parameters are:

  • "Windows NT x86"

  • "Windows x64"

  • "Windows IA64"

-s <ServerName>

Specifies the name of the remote computer that hosts the printer that you want to manage. If you do not specify a computer, the local computer is used.

-u <UserName> -w <Password>

Specifies an account with permissions to connect to the computer that hosts the printer that you want to manage. All members of the target computer's local Administrators group have these permissions, but the permissions can also be granted to other users. If you do not specify an account, you must be logged on under an account with these permissions for the command to work.

-h <Path>

Specifies the path to the driver file. If you do not specify a path, the path to the location where Windows was installed is used.

-i <Filename.inf>

Specifies the complete path and file name for the driver you want to install. If you do not specify a file name, the script uses one of the inbox printer .inf files in the inf subdirectory of the Windows directory.

If the driver path is not specified, the script searches for driver files in the driver.cab file.

/?

Displays help at the command prompt.

Remarks

  • The Prndrvr.vbs command is a Visual Basic script located in the %WINDIR%\System32\Printing_Admin_Scripts\<language> directory. To use this command, at a command prompt, type Cscript followed by the full path to the Prndrvr.vbs file, or change directories to the appropriate folder. For example:

    Copy Code
    Cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prndrvr.vbs
  • If the information that you supply contains spaces, use quotation marks around the text (for example, "Computer Name").

  • The -x option deletes all additional printer drivers (drivers installed for use on clients running alternate versions of Windows), even if the primary driver is in use. If the fax component is installed, this option also deletes fax drivers. The primary fax driver is deleted if it is not in use (that is, if there is no queue using it). If the primary fax driver is deleted, the only way to re-enable fax is to reinstall the fax component.

  • Used without parameters, Prndrvr.vbs displays command-line help for the Prndrvr.vbs command.

Examples

To list all drivers on the \\PrintServer1 server, type:

Copy Code
Cscript Prndrvr -l -s

To add a version 3 Windows x64 printer driver for the "Laser Printer Model 1" model of printer using the C:\temp\LaserPrinter1.inf driver information file for a driver stored in the C:\temp folder type:

Copy Code
Cscript Prndrvr -a -m "Laser Printer Model 1" -v 3 -e "Windows x64" -i c:\temp\LaserPrinter1.inf -h c:\temp

To delete a version 3 Windows NT x86 printer driver for "Laser Printer Model 1", type:

Copy Code
Cscript Prndrvr -a -m "Laser Printer Model 1" -v 3 -e "Windows NT x86"

Additional references

Command-Line Syntax Key

Print Command Reference


Prnjobs.vbs

Applies To: Windows Vista,Windows Server 2008

Pauses, resumes, cancels, and lists print jobs.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
Cscript Prnjobs {-z | -m | -x | -l | -?} [-s <ServerName>]
[-p <PrinterName>] [-j <JobID>] [-u <UserName>] [-w <Password>]

Parameters

Parameter | Description
-z | Pauses the print job specified with the -j parameter.
-m | Resumes the print job specified with the -j parameter.
-x | Cancels the print job specified with the -j parameter.
-l | Lists all the print jobs in a print queue.
-s <ServerName> | Specifies the name of the remote computer that hosts the printer that you want to manage. If you do not specify a computer, the local computer is used.
-p <PrinterName> | Specifies the name of the printer that you want to manage. Required.
-j <JobID> | Specifies (by ID number) the print job you want to cancel.
-u <UserName> -w <Password> | Specifies an account with permissions to connect to the computer that hosts the printer that you want to manage. All members of the target computer's local Administrators group have these permissions, but the permissions can also be granted to other users. If you do not specify an account, you must be logged on under an account with these permissions for the command to work.
/? | Displays help at the command prompt.

Remarks

  • The Prnjobs.vbs command is a Visual Basic script located in the %WINDIR%\System32\Printing_Admin_Scripts\<language> directory. To use this command, at a command prompt, type Cscript followed by the full path to the Prnjobs.vbs file, or change directories to the appropriate folder. For example:

    Copy Code
    Cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prnjobs.vbs
  • If the information that you supply contains spaces, use quotation marks around the text (for example, "Computer Name").

Examples

To pause a print job with a job ID of 27 sent to the remote computer named HRServer for printing on the printer named ColorPrinter, type:

Copy Code
Cscript Prnjobs.vbs -z -s HRServer -p ColorPrinter -j 27

To list all current print jobs in the queue for the local printer named ColorPrinter_2, type:

Copy Code
Cscript Prnjobs.vbs -l -p ColorPrinter_2

Additional references

Command-Line Syntax Key

Print Command Reference


Prnmngr.vbs

Applies To: Windows Server 2008,Windows Vista

Adds, deletes, and lists printers or printer connections, in addition to setting and displaying the default printer.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
Cscript Prnmngr {-a | -d | -x | -g | -t | -l | -?}[c] [-s <ServerName>]
[-p <PrinterName>] [-m <PrinterModel>] [-r <PortName>] [-u <UserName>]
[-w <Password>]

Parameters

Parameter | Description
-a | Adds a local printer connection.
-d | Deletes a printer connection.
-x | Deletes all printers from the server specified with the -s parameter. If you do not specify a server, Windows deletes all printers on the local computer.
-g | Displays the default printer.
-t | Sets the default printer to the printer specified by the -p parameter.
-l | Lists all printers installed on the server specified by the -s parameter. If you do not specify a server, Windows lists the printers installed on the local computer.
c | Specifies that the parameter applies to printer connections. Can be used with the -a and -x parameters.
-s <ServerName> | Specifies the name of the remote computer that hosts the printer that you want to manage. If you do not specify a computer, the local computer is used.
-p <PrinterName> | Specifies the name of the printer that you want to manage.
-m <DriverModelName> | Specifies (by name) the driver you want to install. Drivers are often named for the model of printer they support. See the printer documentation for more information.
-r <PortName> | Specifies the port where the printer is connected. If this is a parallel or a serial port, use the ID of the port (for example, LPT1: or COM1:). If this is a TCP/IP port, use the port name that was specified when the port was added.
-u <UserName> -w <Password> | Specifies an account with permissions to connect to the computer that hosts the printer that you want to manage. All members of the target computer's local Administrators group have these permissions, but the permissions can also be granted to other users. If you do not specify an account, you must be logged on under an account with these permissions for the command to work.
/? | Displays help at the command prompt.

Remarks

  • The Prndrvr.vbs command is a Visual Basic script located in the %WINDIR%\System32\Printing_Admin_Scripts\<language> directory. To use this command, at a command prompt, type Cscript followed by the full path to the Prnmngr.vbs file, or change directories to the appropriate folder. For example:

    Copy Code
    Cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prnmngr.vbs
  • If the information that you supply contains spaces, use quotation marks around the text (for example, "Computer Name").

Examples

To add a printer named ColorPrinter_2 that is connected to LPT1 on the local computer and requires a printer driver called Color Printer Driver1, type:

Copy Code
Cscript Prnmngr.vbs -a -p ColorPrinter_2 -m "Color Printer Driver1" -r lpt1:

To delete the printer named ColorPrinter_2 from the remote computer named HRServer, type:

Copy Code
Cscript Prnmngr.vbs -d -s HRServer -p ColorPrinter_2

Additional references

Command-Line Syntax Key

Print Command Reference


Prnport.vbs

Applies To: Windows Vista,Windows Server 2008

Creates, deletes, and lists standard TCP/IP printer ports, in addition to displaying and changing port configuration.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
Cscript prnport {-a | -d | -l | -g | -t | -?} [-r <PortName>]
[-s <ServerName>] [-u <UserName>] [-w <Password>] [-o {raw | lpr}]
[-h <HostAddress>] [-q <QueueName>] [-n <PortNumber>] -m{e | d}
[-i <SNMPIndex>] [-y <CommunityName>] -2{e | -d}

Parameters

Parameter | Description
-a | Creates a standard TCP/IP printer port.
-d | Deletes a standard TCP/IP printer port.
-l | Lists all standard TCP/IP printer ports on the computer specified with the -s parameter.
-g | Displays the configuration of a standard TCP/IP printer port.
-t | Configures the port settings for a standard TCP/IP printer port.
-r <PortName> | Specifies the port to which the printer is connected.
-s <ServerName> | Specifies the name of the remote computer that hosts the printer that you want to manage. If you do not specify a computer, the local computer is used.
-u <UserName> -w <Password> | Specifies an account with permissions to connect to the computer that hosts the printer that you want to manage. All members of the target computer's local Administrators group have these permissions, but the permissions can also be granted to other users. If you do not specify an account, you must be logged on under an account with these permissions for the command to work.
-o {raw | lpr} | Specifies which protocol the port uses: TCP raw or TCP LPR. If you use TCP raw, you can optionally specify the port number by using the -n parameter. The default port number is 9100.
-h <HostAddress> | Specifies (by IP address) the printer for which you want to configure the port.
-q <QueueName> | Specifies the queue name for a TCP raw port.
-n <PortNumber> | Specifies the port number for a TCP raw port. The default port number is 9100.
-m{e | d} | Specifies whether SNMP is enabled. The parameter e enables SNMP. The parameter d disables SNMP.
-i <SNMPIndex | Specifies the SNMP index, if SNMP is enabled. For more information, see RFC 1759 at the RFC Editor Web site (http://go.microsoft.com/fwlink/?LinkId=569).
-y <CommunityName> | Specifies the SNMP community name, if SNMP is enabled.
-2{e | -d} | Specifies whether double spools (also known as respooling) are enabled for TCP LPR ports. Double spools are necessary because TCP LPR must include an accurate byte count in the control file that is sent to the printer, but the protocol cannot get the count from the local print provider. Therefore, when a file is spooled to a TCP LPR print queue, it is also spooled as a temporary file in the system32 directory. TCP LPR determines the size of the temporary file and sends the size to the server running LPD. The parameter e enables double spools. The parameter d disables double spools.
/? | Displays help at the command prompt.

Remarks

  • The Prnport.vbs command is a Visual Basic script located in the %WINDIR%\System32\Printing_Admin_Scripts\<language> directory. To use this command, at a command prompt, type Cscript followed by the full path to the Prnport.vbs file, or change directories to the appropriate folder. For example:

    Copy Code
    Cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prnport.vbs
  • If the information that you supply contains spaces, use quotation marks around the text (for example, "Computer Name").

  • The TCP raw protocol is a higher performance protocol on Windows than the LPR protocol.

Examples

To display all standard TCP/IP printing ports on the server \\Server1, type:

Copy Code
Cscript Prnport.vbs -l -s Server1

To delete the standard TCP/IP printing port on the server \\Server1 that connects to a network printer at 10.2.3.4, type:

Copy Code
Cscript Prnport.vbs -d -s Server1 -r IP_10.2.3.4

To add a standard TCP/IP printing port on the server \\Server1 that connects to a network printer at 10.2.3.4 and uses the TCP raw protocol on port 9100, type:

Copy Code
Cscript Prnport.vbs -a -s Server1 -r IP_10.2.3.4 -h 10.2.3.4 -o raw -n 9100

To enable SNMP, specify the "public" community name and set the SNMP index to 1 on a network printer at 10.2.3.4 shared by the server \\Server1, type:

Copy Code
Cscript Prnport.vbs -t -s Server1 -r IP_10.2.3.4 -me -y public -i 1 -n 9100

To add a standard TCP/IP printing port on the local computer that connects to a network printer at 10.2.3.4 and automatically get the device settings from the printer, type:

Copy Code
Cscript Prnport.vbs -a -r IP_10.2.3.4 -h 10.2.3.4

Additional references

Command-Line Syntax Key

Print Command Reference


Prnqctl.vbs

Applies To: Windows Server 2008,Windows Vista

Prints a test page, pauses or resumes a printer, and clears a printer queue.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
Cscript Prnqctl {-z | -m | -e | -x | -?} [-s <ServerName>]
[-p <PrinterName>] [-u <UserName>] [-w <Password>]

Parameters

Parameter | Description
-z | Pauses printing on the printer specified with the -p parameter.
-m | Resumes printing on the printer specified with the -p parameter.
-e | Prints a test page on the printer specified with the -p parameter.
-x | Cancels all print jobs on the printer specified with the -p parameter.
-s <ServerName> | Specifies the name of the remote computer that hosts the printer that you want to manage. If you do not specify a computer, the local computer is used.
-p <PrinterName> | Specifies the name of the printer that you want to manage. Required.
-u <UserName> -w <Password> | Specifies an account with permissions to connect to the computer that hosts the printer that you want to manage. All members of the target computer's local Administrators group have these permissions, but the permissions can also be granted to other users. If you do not specify an account, you must be logged on under an account with these permissions for the command to work.
/? | Displays help at the command prompt.

Remarks

  • The Prnqctl.vbs command is a Visual Basic script located in the %WINDIR%\System32\Printing_Admin_Scripts\<language> directory. To use this command, at a command prompt, type Cscript followed by the full path to the Prnqctl.vbs file, or change directories to the appropriate folder. For example:

    Copy Code
    Cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prnqctl.vbs
  • If the information that you supply contains spaces, use quotation marks around the text (for example, "Computer Name").

Examples

To print a test page on the LaserPrinter1 printer shared by the \\Server1 computer, type:

Copy Code
Cscript Prnqctl -e -s Server1 -p LaserPrinter1

To pause printing on the LaserPrinter1 printer on the local computer, type:

Copy Code
Cscript Prnqctl -z -p LaserPrinter1

To cancel all print jobs on the LaserPrinter1 printer on the local computer, type:

Copy Code
Cscript Prnqctl -x -p LaserPrinter1

Additional references

Command-Line Syntax Key

Print Command Reference


Prompt

Applies To: Windows Vista,Windows Server 2008

Changes the Cmd.exe command prompt. If used without parameters, prompt resets the command prompt to the default setting, which is the current drive letter and directory followed by the greater than symbol (>).

For examples of how to use this command, see Examples.

Syntax

Copy Code
prompt [<Text>]

Parameters

Parameter | Description
<Text> | Specifies the text and information that you want to include in the command prompt.
/? | Displays help at the command prompt.

Remarks

  • You can customize the command prompt to display any text you want, including such information as the name of the current directory, the time and date, and the Microsoft Windows version number.

  • The following table lists the character combinations that you can include instead of, or in addition to, one or more character strings in the Text parameter. The list includes a brief description of the text or information that each character combination adds to your command prompt.

    Character Description

    $q

    = (equal sign)

    $$

    $ (dollar sign)

    $t

    Current time

    $d

    Current date

    $p

    Current drive and path

    $v

    Windows version number

    $n

    Current drive

    $g

    > (greater than sign)

    $l

    < (less than sign)

    $b

    | (pipe)

    $_

    ENTER-LINEFEED

    $e

    ANSI escape code (code 27)

    $h

    Backspace (to delete a character that has been written to the command line)

    $a

    & (ampersand)

    $c

    ( (left parenthesis)

    $f

    ) (right parenthesis)

    $s

    space

  • When command extensions are enabled (that is, the default) the prompt command supports the following formatting characters:

    Character Description

    $+

    Zero or more plus sign (+) characters, depending on the depth of the pushd directory stack (one character for each level pushed).

    $m

    The remote name associated with the current drive letter or the empty string if current drive is not a network drive.

  • If you include the $p character in the text parameter, your disk is read after you enter each command (to determine the current drive and path). This can take extra time, especially for floppy disk drives.

Examples

To set a two-line command prompt with the current time and date on the first line and the greater than sign on the next line, type:

Copy Code
prompt $d$s$s$t$_$g

The prompt is changed as follows, where the date and time are current:

Copy Code
Fri 06/01/2007  13:53:28.91
>

To set the command prompt to display as an arrow (-->), type:

Copy Code
prompt --$g

To manually change the command prompt to the default setting (the current drive and path followed by the greater than sign), type:

Copy Code
prompt $p$g

Additional references

Command-Line Syntax Key


Pubprn.vbs

Applies To: Windows Server 2008,Windows Vista

Publishes a printer to the Active Directory Domain Services.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
Cscript Pubprn.vbs {<ServerName> | <UNCPrinterPath>}
"LDAP://CN=<Container>,DC=<Container>"

Parameters

Parameter | Description
<ServerName> | Specifies the name of the Windows server that hosts the printer that you want to publish. If you do not specify a computer, the local computer is used.
<UNCPrinterPath> | The Universal Naming Convention (UNC) path to the shared printer that you want to publish.
"LDAP://CN=<Container>,DC=<Container>" | Specifies the path to the container in Active Directory Domain Services where you want to publish the printer.
/? | Displays help at the command prompt.

Remarks

  • The Pubprn.vbs command is a Visual Basic script located in the %WINDIR%\System32\Printing_Admin_Scripts\<language> directory. To use this command, at a command prompt, type Cscript followed by the full path to the Pubprn.vbs file, or change directories to the appropriate folder. For example:

    Copy Code
    Cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Pubprn.vbs
  • If the information that you supply contains spaces, use quotation marks around the text (for example, "Computer Name").

Examples

To publish all printers on the \\Server1 computer to the MyContainer container in the MyDomain.Company.Com domain, type:

Copy Code
Cscript Ppubprn.vbs Server1 "LDAP://CN=MyContainer,DC=MyDomain,DC=Company,DC=Com"

To publish the LaserPrinter1 printer on the \\Server1 server to the MyContainer container in the MyDomain.Company.Com domain, type:

Copy Code
Cscript Ppubprn.vbs \\Server1\LaserPrinter1 "LDAP://CN=MyContainer,DC=MyDomain,DC=Company,DC=Com"

Additional references

Command-Line Syntax Key

Print Command Reference


Pushd

Applies To: Windows Vista,Windows Server 2008

Stores the current directory for use by the popd command, and then changes to the specified directory.

For examples of how to use this command, see Examples.

Syntax

Copy Code
pushd [<Path>]

Parameters

Parameter | Description
<Path> | Specifies the directory to make the current directory. This command supports relative paths.
/? | Displays help at the command prompt.

Remarks

  • Every time you use the pushd command, a single directory is stored for your use. However, you can store multiple directories by using the pushd command multiple times.

    The directories are stored sequentially in a virtual stack. If you use the pushd command once, the directory in which you use the command is placed at the bottom of the stack. If you use the command again, the second directory is placed on top of the first one. The process repeats every time you use the pushd command.

    You can use the popd command to change the current directory to the directory most recently stored by the pushd command. If you use the popd command, the directory on the top of the stack is removed from the stack and the current directory is changed to that directory. If you use the popd command again, the next directory on the stack is removed.

  • If command extensions are enabled, the pushd command accepts either a network path or a local drive letter and path.

  • If you specify a network path, the pushd command temporarily assigns the highest unused drive letter (starting with Z:) to the specified network resource. The command then changes the current drive and directory to the specified directory on the newly assigned drive. If you use the popd command with command extensions enabled, the popd command removes the drive-letter assignation created by pushd.

Examples

The following example shows how you can use the pushd command and the popd command in a batch program to change the current directory from the one in which the batch program was run and then change it back:

Copy Code
@echo off
rem This batch file deletes all .txt files in a specified directory
pushd %1
del *.txt
popd
cls
echo All text files deleted in the %1 directory

Additional references

Command-Line Syntax Key

Popd


Qappsrv

Applies To: Windows Server 2008,Windows Vista

Displays a list of all terminal servers on the network.

Remarks

This command is the same as the query termserver command.

Additional references

Query termserver

Command-Line Syntax Key

Terminal Services Command Reference


Qprocess

Applies To: Windows Vista,Windows Server 2008

Displays information about processes that are running on a terminal server.

Remarks

This command is the same as the query process command.

Additional references

Query process

Command-Line Syntax Key

Terminal Services Command Reference


Query

Applies To: Windows Server 2008,Windows Vista

Displays information about processes, sessions, and terminal servers.

Syntax

Copy Code
query process
query session
query termserver
query user

Parameters

Parameter | Description
Query process | Displays information about processes that are running on a terminal server.
Query session | Displays information about sessions on a terminal server.
Query termserver | Displays a list of all terminal servers on the network.
Query user | Displays information about user sessions on a terminal server.

Additional references

Command-Line Syntax Key

Terminal Services Command Reference


Query process

Applies To: Windows Vista,Windows Server 2008

Displays information about processes that are running on a terminal server.

You can use this command to find out which programs a specific user is running, and also which users are running a specific program.

For examples of how to use this command, see Examples.

Syntax

Copy Code
query process [* | <ProcessID> | <UserName> | <SessionName> | /id:<nn> | <ProgramName>] [/server:<ServerName>]

Parameters

Parameter | Description
* | Lists the processes for all sessions.
<ProcessID> | Specifies the numeric ID identifying the process that you want to query.
<UserName> | Specifies the name of the user whose processes you want to list.
<SessionName> | Specifies the name of the session whose processes you want to list.
/id:<nn> | Specifies the ID of the session whose processes you want to list.
<ProgramName> | Specifies the name of the program whose processes you want to query. The .exe extension is required.
/server:<ServerName> | Specifies the terminal server whose processes you want to list. If unspecified, the server where you are currently logged on is used.
/? | Displays help at the command prompt.

Remarks

  • Administrators have full access to all query process functions.

  • If you do not specify the <UserName>, <SessionName>, /id:<nn>, <ProgramName>, or * parameters, query process displays only the processes that belong to the current user.

  • If a session is specified, it must identify an active session.

  • Query process returns the following information:

    • The user who owns the process

    • The session that owns the process

    • The ID of the session

    • The name of the process

    • The ID of the process

  • When query process returns information, a greater than (>) symbol is displayed before each process that belongs to the current session.

Examples

  • To display information about the processes being used by all sessions, type:

    Copy Code
    query process *
  • To display information about the processes being used by session ID 2, type:

    Copy Code
    query process /ID:2

Additional references

Command-Line Syntax Key

Query

Terminal Services Command Reference


Query session

Applies To: Windows Server 2008,Windows Vista

Displays information about sessions on a terminal server.

The list includes information not only about active sessions but also about other sessions that the server runs.

For examples of how to use this command, see Examples.

Syntax

Copy Code
query session [<SessionName> | <UserName> | <SessionID>] [/server:<ServerName>] [/mode] [/flow] [/connect] [/counter]

Parameters

Parameter | Description
<SessionName> | Specifies the name of the session that you want to query.
<UserName> | Specifies the name of the user whose sessions you want to query.
<SessionID> | Specifies the ID of the session that you want to query.
/server:<ServerName> | Identifies the terminal server to query. The default is the current server.
/mode | Displays current line settings.
/flow | Displays current flow-control settings.
/connect | Displays current connect settings.
/counter | Displays current counters information, including the total number of sessions created, disconnected, and reconnected.
/? | Displays help at the command prompt.

Remarks

  • A user can always query the session to which the user is currently logged on. To query other sessions, the user must have Query Information special access permission.

  • If you do not specify a session by using <SessionName>, <UserName>, or <SessionID>, query session displays information about all active sessions in the system.

  • When query session returns information, a greater than (>) symbol is displayed before the current session. Following is sample output for query session:

    Copy Code
    C:\>query session
 SESSIONNAME    USERNAME       ID STATE  TYPE   DEVICE
>console        Administrator1  0 active wdcon
 rdp-tcp#1      User1           1 active wdtshare
 rdp-tcp                        2 listen wdtshare
                                4 idle
                                5 idle
    The greater than (>) symbol indicates the current session. SESSIONNAME specifies the name assigned to the session. USERNAME indicates the user name of the user connected to the session. STATE provides information about the current state of the session. TYPE indicates the session type. DEVICE, which is not present for the console or network-connected sessions, is the device name assigned to the session. The comment following session information is from the session profile. Any sessions in which the initial state is configured as DISABLED do not show up in the query session list until they are enabled.

Examples

  • To display information about all active sessions on server SERVER2, type:

    Copy Code
    query session /server:SERVER2
  • To display information about active session MODEM02, type:

    Copy Code
    query session MODEM02

Additional references

Command-Line Syntax Key

Query

Terminal Services Command Reference


Query termserver

Applies To: Windows Vista,Windows Server 2008

Displays a list of all terminal servers on the network.

For examples of how to use this command, see Examples.

Syntax

Copy Code
query termserver [<ServerName>] [/domain:<Domain>] [/address] [/continue]

Parameters

Parameter | Description
<ServerName> | Specifies the name that identifies the terminal server.
/domain:<Domain> | Specifies the domain to query for terminal servers. You do not need to specify a domain if you are querying the domain in which you are currently working.
/address | Displays the network and node addresses for each server.
/continue | Prevents pausing after each screen of information is displayed.
/? | Displays help at the command prompt.

Remarks

  • Query termserver searches the network for all attached terminal servers and returns the following information:

    • The name of the server

    • The network (and node address if the /address option is used)

Examples

  • To display information about all terminal servers on the network, type:

    Copy Code
    query termserver
  • To display information about the terminal server named Server3, type:

    Copy Code
    query termserver Server3
  • To display information about all terminal servers in domain CONTOSO, type:

    Copy Code
    query termserver /domain:CONTOSO
  • To display the network and node address for the terminal server named Server3, type:

    Copy Code
    query termserver Server3 /address

Additional references

Command-Line Syntax Key

Query

Terminal Services Command Reference


Query user

Applies To: Windows Server 2008,Windows Vista

Displays information about user sessions on a terminal server.

For examples of how to use this command, see Examples.

Syntax

Copy Code
query user [<UserName> | <SessionName> | <SessionID>] [/server:<ServerName>]

Parameters

Parameter | Description
<UserName> | Specifies the logon name of the user that you want to query.
<SessionName> | Specifies the name of the session that you want to query.
<SessionID> | Specifies the ID of the session that you want to query.
/server:<ServerName> | Specifies the terminal server that you want to query. Otherwise, the current terminal server is used.
/? | Displays help at the command prompt.

Remarks

  • You can use this command to find out if a specific user is logged on to a specific terminal server. Query user returns the following information:

    • The name of the user

    • The name of the session on the terminal server

    • The session ID

    • The state of the session (active or disconnected)

    • The idle time (the number of minutes since the last keystroke or mouse movement at the session)

    • The date and time the user logged on

  • To use query user, you must have Full Control permission or Query Information special access permission.

  • If you use query user without specifying <UserName>, <SessionName>, or <SessionID>, a list of all users who are logged on to the server is returned. Alternatively, you can also use query session to display a list of all sessions on a server.

  • When query user returns information, a greater than (>) symbol is displayed before the current session.

  • The /server parameter is required only if you use query user from a remote server.

Examples

  • To display information about all users logged on the system, type:

    Copy Code
    query user
  • To display information about the user USER1 on server SERVER1, type:

    Copy Code
    query user USER1 /server:SERVER1

Additional references

Command-Line Syntax Key

Query

Terminal Services Command Reference


Quser

Applies To: Windows Vista,Windows Server 2008

Displays information about user sessions on a terminal server.

Remarks

This command is the same as the query user command.

Additional references

Query user

Command-Line Syntax Key

Terminal Services Command Reference


Qwinsta

Applies To: Windows Server 2008,Windows Vista

Displays information about sessions on a terminal server.

Remarks

This command is the same as the query session command.

Additional references

Query session

Command-Line Syntax Key

Terminal Services Command Reference


Rcp

Applies To: Windows Server 2008,Windows Server 2008 R2

Copies files between computers. This command has been deprecated. You can install the Subsystem for UNIX-based Applications using the Add Features Wizard. For more information, see Windows Server 2008 UNIX Interoperability Components at the Microsoft Web site. After installation, you can then open a C Shell or Korn Shell command window and run rcp. For more information, type man rcp at the C Shell or Korn Shell prompt.


Rd

Applies To: Windows Server 2008,Windows Vista

Deletes a directory. This command is the same as the rmdir command.

For examples of how to use this command, see Examples.

Syntax

Copy Code
rd [<Drive>:]<Path> [/s [/q]]
rmdir [<Drive>:]<Path> [/s [/q]]

Parameters

Parameter | Description
[<Drive>:]<Path> | Specifies the location and the name of the directory that you want to delete. Path is required.
/s | Deletes a directory tree (the specified directory and all its subdirectories, including all files).
/q | Specifies quiet mode. Does not prompt for confirmation when deleting a directory tree. (Note that /q works only if /s is specified.)
/? | Displays help at the command prompt.

Remarks

  • You cannot delete a directory that contains files, including hidden or system files. If you attempt to do so, the following message appears:

    The directory is not empty

    Use the dir /a command to list all files (including hidden and system files). Then use the attrib command with -h to remove hidden file attributes, -s to remove system file attributes, or -h -s to remove both hidden and system file attributes. After the hidden and file attributes have been removed, you can delete the files.

  • If you insert a backslash (\) at the beginning of Path, Path will start at the root directory (regardless of the current directory).

  • You cannot use rd to delete the current directory. If you attempt to delete the current directory, the following error message appears:

    The process cannot access the file because it is being used by another process.

    If you receive this error message, you must change to a different directory (not a subdirectory of the current directory), and then use rd (specify Path if necessary).

  • The rd command, with different parameters, is available from the Recovery Console.

Examples

You cannot delete the directory that you are currently working in. You must change to a directory that is not within the current directory. For example, to change to the parent directory, type:

Copy Code
cd ..

You can now safely remove the desired directory.

Use the /s option to remove a directory tree. For example, to remove a directory named Test (and all its subdirectories and files) from the current directory, type:

Copy Code
rd /s test

To run the previous example in quiet mode, type:

Copy Code
rd /s /q test
Caution
When you run rd /s in quiet mode, the entire directory tree is deleted without confirmation. Ensure that important files are moved or backed up before using the /q command-line option.

Additional references

Command-Line Syntax Key


Rdpsign
See Also

Applies To: Windows Server 2008

Enables you to digitally sign a Remote Desktop Protocol (.rdp) file.

For examples of how to use this command, see Examples.

Syntax

Copy Code
rdpsign /sha1 <hash> [/q | /v |] [/l] <file_name.rdp>

Parameters

Parameter | Description
/sha1 <hash> | Specifies the thumbprint, which is the Secure Hash Algorithm 1 (SHA1) hash of the signing certificate that is included in the certificate store.
/q | Quiet mode. No output when the command succeeds and minimal output if the command fails.
/v | Verbose mode. Displays all warnings, messages, and status.
/l | Tests the signing and output results without actually replacing any of the input files.
/? | Displays help at the command prompt.

Remarks

  • The SHA1 certificate thumbprint should represent a trusted .rdp file publisher. To obtain the certificate thumbprint, open the Certificates snap-in, double-click the certificate that you want to use (either in the local computer's certificates store or in your personal certificates store), click the Details tab, and then in the Field list, click Thumbprint.

    Note
    When you copy the thumbprint for use with the Rdpsign.exe tool, you must remove any spaces.

  • You must specify the .rdp file (or files) to sign by using the full file name. Wildcard characters are not accepted.

  • The signed output files will overwrite the input files.

  • If any of the .rdp files cannot be read or written to, the tool will continue to the next file if multiple files are specified.

Examples

  • To sign an .rdp file that is named File1.rdp, navigate to the folder where you saved the .rdp file, and then type the following:

    Copy Code
    rdpsign /sha1 hash file1.rdp
    Note
    The hash value represents the SHA1 certificate thumbprint, without any spaces.

  • To test whether digital signing will succeed for an .rdp file without actually signing the file, type the following:

    Copy Code
    rdpsign /sha1 hash /l file1.rdp
  • To sign multiple .rdp files, separate the file names by using spaces. For example, to sign multiple .rdp files that are named File1.rdp, File2.rdp, and File3.rdp, type the following:

    Copy Code
    rdpsign /sha1 hash file1.rdp file2.rdp file3.rdp

See Also

Concepts

Command-Line Syntax Key
Terminal Services Command Reference


Reagentc

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Reagentc

Configures the Windows Recovery Environment (Windows RE) and enables image recovery solutions.

For the syntax and examples of how to use this command, see REAgentC Command-Line Options.


Recover

Applies To: Windows Server 2008,Windows Vista

Recovers readable information from a bad or defective disk.

For examples of how to use this command, see Examples.

Syntax

Copy Code
recover [<Drive>:][<Path>]<FileName>

Parameters

Parameter | Description
[<Drive>:][<Path>]<FileName> | Specifies the location and name of the file that you want to recover. FileName is required.
/? | Displays help at the command prompt.

Remarks

  • The recover command reads a file, sector-by-sector, and recovers data from the good sectors. Data in bad sectors is lost.

  • Bad sectors reported by chkdsk were marked as "bad" when your disk was prepared for operation. They pose no danger, and recover does not affect them.

  • Because all data in bad sectors is lost when you recover a file, you should recover only one file at a time.

  • You cannot use wildcard characters (* and ?) with the recover command. You must specify a file (and the location of the file if it is not in the current directory).

Examples

To recover the file Story.txt in the \Fiction directory on drive D, type:

Copy Code
recover d:\fiction\story.txt

Additional references

Command-Line Syntax Key


Redircmp

Applies To: Windows Server 2003,Windows Server 2003 R2,Windows Server 2008,Windows Server 2008 R2,Windows Server 2003 with SP1

Redirects the default container for newly created computers to a specified, target organizational unit (OU) so that newly created computer objects are created in the specific target OU instead of in CN=Computers.

Caution
The CN=Computers container is a computer-protected object. For backward compatibility reasons, you cannot (and must not) remove it. However, you can rename this object.

You must run the redircmp command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
redircmp <container-DN>

Parameters

Parameter | Description
<container-DN> | The distinguished name of the target OU that will become the default location for newly created computer objects.
/? | Displays Help at the command prompt.

Remarks

  • Redircmp.exe is located in the C:\Windows\System32 folder.

  • You must be a member of the Domain Admins group or the Enterprise Admins group to use this tool.

  • The domain functional level must be Windows Server 2003 or Windows Server 2008.

  • Objects in the default containers are more difficult to manage because Group Policy cannot be applied directly to them. You can use the redircmp command to redirect computer objects to an OU container that can have Group Policy applied directly to it.

Examples

To redirect newly created computer objects to the newcomputerou OU in the domainname.com domain, at a command prompt, type the following command, and then press ENTER:

Copy Code
redircmp ou=newcomputerou,dc=domainname,dc=com

Additional references

Command-Line Syntax Key

Redirecting the users and computers containers in Windows Server 2003 domains (http://go.microsoft.com/fwlink/?LinkId=148341)


Redirusr

Applies To: Windows Server 2003 with SP1,Windows Server 2008 R2,Windows Server 2008,Windows Server 2003 R2,Windows Server 2003

Redirects the default container for newly created users to a specified, target organizational unit (OU) so that newly created user objects are created in the specific target OU instead of in CN=Users.

Caution
The CN=Users container is a computer-protected object. For backward compatibility reasons, you cannot (and must not) remove it. However, you can rename this object.

You must run the redirusr command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

Copy Code
redirusr <container-DN>

Parameters

Parameter | Description
<container-DN> | The distinguished name of the target OU that will become the default location for newly created user objects.
/? | Displays Help at the command prompt.

Remarks

  • Redirusr.exe is located in the C:\Windows\System32 folder.

  • You must be a member of the Domain Admins group or the Enterprise Admins group to use this tool.

  • The domain functional level must be Windows Server 2003 or Windows Server 2008.

  • Objects in the default containers are more difficult to manage because Group Policy cannot be applied directly to them. You can use the redirusr command to redirect user objects to an OU container that can have Group Policy applied directly to it.

Examples

To redirect newly created user objects to the newuserou OU in the domainname.com domain, at a command prompt, type the following command, and then press ENTER:

Copy Code
redirusr ou=newuserou,dc=domainname,dc=com

Additional references

Command-Line Syntax Key

Redirecting the users and computers containers in Windows Server 2003 domains (http://go.microsoft.com/fwlink/?LinkId=148341)


Reg

Applies To: Windows Server 2003,Windows Vista,Windows Server 2003 R2,Windows 7,Windows Server 2008,Windows Server 2008 R2,Windows XP

Performs operations on registry subkey information and values in registry entries. The reg commands include:

Reg add

Reg compare

Reg copy

Reg delete

Reg export

Reg import

Reg load

Reg query

Reg restore

Reg save

Reg unload

Some operations enable you to view or configure registry entries on local or remote computers, while others allow you to configure only local computers. Using reg to configure the registry of remote computers limits the parameters that you can use in some operations. Check the syntax and parameters for each operation to verify that they can be used on remote computers


Reg add

Applies To: Windows XP,Windows Server 2008 R2,Windows Server 2008,Windows 7,Windows Server 2003 R2,Windows Server 2003,Windows Vista,Windows Server 2000

Adds a new subkey or entry to the registry.

Syntax

Copy Code
reg add <KeyName> [{/v ValueName | /ve}] [/t DataType] [/s Separator] [/d Data] [/f]

For examples of how to use this command, see Examples.

Parameters

Parameter | Description
<KeyName> | Specifies the full path of the subkey or entry to be added. To specify a remote computer, include the computer name (in the format \\<ComputerName>\) as part of the KeyName. Omitting \\ComputerName\ causes the operation to default to the local computer. The KeyName must include a valid root key. Valid root keys for the local computer are: HKLM, HKCU, HKCR, HKU, and HKCC. If a remote computer is specified, valid root keys are: HKLM and HKU.
/v <ValueName> | Specifies the name of the registry entry to be added under the specified subkey.
/ve | Specifies that the registry entry that is added to the registry has a null value.
/t <Type> | Specifies the type for the registry entry. Type must be one of the following: REG_SZ REG_MULTI_SZ REG_DWORD_BIG_ENDIAN REG_DWORD REG_BINARY REG_DWORD_LITTLE_ENDIAN REG_LINK REG_FULL_RESOURCE_DESCRIPTOR REG_EXPAND_SZ
/s <Separator> | Specifies the character to be used to separate multiple instances of data when the REG_MULTI_SZ data type is specified and more than one entry needs to be listed. If not specified, the default separator is \0.
/d <Data> | Specifies the data for the new registry entry.
/f | Adds the registry entry without prompting for confirmation.
/? | Displays help for reg add at the command prompt.

Remarks

  • Subtrees cannot be added with this operation. This version of reg does not ask for confirmation when adding a subkey.

  • The following table lists the return values for the reg add operation.

Value | Description
0 | Success
1 | Failure
  • For the REG_EXPAND_SZ key type, use the caret symbol ( ^ ) with %" inside the /d parameter

Examples

To add the key HKLM\Software\MyCo on remote computer ABC, type:

Copy Code
REG ADD \\ABC\HKLM\Software\MyCo

To add a registry entry to HKLM\Software\MyCo with a value named Data of type REG_BINARY and data of fe340ead, type:

Copy Code
REG ADD HKLM\Software\MyCo /v Data /t REG_BINARY /d fe340ead

To add a multivalued registry entry to HKLM\Software\MyCo with a value name of MRU of type REG_MULTI_SZ and data of fax\0mail\0\0, type:

Copy Code
REG ADD HKLM\Software\MyCo /v MRU /t REG_MULTI_SZ /d fax\0mail\0\0

To add an expanded registry entry to HKLM\Software\MyCo with a value name of Path of type REG_EXPAND_SZ and data of %systemroot%, type:

Copy Code
REG ADD HKLM\Software\MyCo /v Path /t REG_EXPAND_SZ /d ^%systemroot^%

Additional references

Command-Line Syntax Key


Reg compare

Applies To: Windows Server 2000,Windows Server 2003,Windows Vista,Windows Server 2003 R2,Windows 7,Windows Server 2008,Windows Server 2008 R2,Windows XP

Compares specified registry subkeys or entries.

For examples of how to use this command, see Examples.

Syntax

Copy Code
reg compare <KeyName1> <KeyName2> [{/v ValueName | /ve}] [{/oa | /od | /os | on}] [/s]

Parameters

Parameter | Description
<KeyName1> | Specifies the full path of the first subkey to be compared. To specify a remote computer, include the computer name (in the format \\ComputerName\) as part of the KeyName. Omitting \\ComputerName\ causes the operation to default to the local computer. The KeyName must include a valid root key. Valid root keys for the local computer are: HKLM, HKCU, HKCR, HKU, and HKCC. If a remote computer is specified, valid root keys are: HKLM and HKU.
<KeyName2> | Specifies the full path of the second subkey to be compared. To specify a remote computer, include the computer name (in the format \\ComputerName\) as part of the KeyName. Omitting \\ComputerName\ causes the operation to default to the local computer. Specifying only the computer name in KeyName2 causes the operation to use the path to the subkey specified in KeyName1. The KeyName must include a valid root key. Valid root keys for the local computer are: HKLM, HKCU, HKCR, HKU, and HKCC. If a remote computer is specified, valid root keys are: HKLM and HKU.
/v <ValueName> | Specifies the value name to compare under the subkey.
/ve | Specifies that only entries that have a value name of null should be compared.
[{/oa | /od | /os | on}] | Specifies how to display the results of the compare operation. The default is /od. See the specific options below.
/oa | Specifies that all differences and matches are displayed. By default, only the differences are listed.
/od | Specifies that only differences are displayed. This is the default behavior.
/os | Specifies that only matches are displayed. By default, only the differences are listed.
/on | Specifies that nothing is displayed. By default, only the differences are listed.
/s | Compares all subkeys and entries recursively.
/? | Displays help for reg compare at the command prompt.

Remarks

The following table lists the return values for reg compare.

Value | Description
0 | The comparison is successful and the result is identical.
1 | The comparison failed.
2 | The comparison was successful and differences were found.

The following table lists the symbols displayed in the results.

Symbol | Description
= | KeyName1 data is equal to KeyName2 data.
< | KeyName1 data is less than KeyName2 data.
> | KeyName1 data is greater than KeyName2 data.

Examples

To compare all values under the key MyApp with all values under the key SaveMyApp, type:

REG COMPARE HKLM\Software\MyCo\MyApp HKLM\Software\MyCo\SaveMyApp

To compare the value for the Version under the key MyCo and the value for the Version under the key MyCo1, type:

REG COMPARE HKLM\Software\MyCo HKLM\Software\MyCo1 /v Version

To compare all subkeys and values under HKLM\Software\MyCo on the computer named ZODIAC with all subkeys and values under HKLM\Software\MyCo on the local computer, type:

REG COMPARE \\ZODIAC\HKLM\Software\MyCo \\. /s

Additional references

Command-Line Syntax Key


Reg copy

Applies To: Windows XP,Windows Server 2008 R2,Windows Server 2008,Windows 7,Windows Server 2003 R2,Windows Vista,Windows Server 2003,Windows Server 2000

Copies a registry entry to a specified location on the local or remote computer.

For examples of how to use this command, see Examples.

Syntax

Copy Code
reg copy <KeyName1> <KeyName2> [/s] [/f]

Parameters

Parameter | Description
<KeyName1> | Specifies the full path of the subkey to copy. To specify a remote computer, include the computer name (in the format \\ComputerName\) as part of the KeyName. Omitting \\ComputerName\ causes the operation to default to the local computer. The KeyName must include a valid root key. Valid root keys for the local computer are: HKLM, HKCU, HKCR, HKU, and HKCC. If a remote computer is specified, valid root keys are: HKLM and HKU.
<KeyName2> | Specifies the full path of the subkey destination. To specify a remote computer, include the computer name (in the format \\ComputerName\) as part of the KeyName. Omitting \\ComputerName\ causes the operation to default to the local computer. The KeyName must include a valid root key. Valid root keys for the local computer are: HKLM, HKCU, HKCR, HKU, and HKCC. If a remote computer is specified, valid root keys are: HKLM and HKU.
/s | Copies all subkeys and entries under the specified subkey.
/f | Copies the subkey without prompting for confirmation.
/? | Displays help for reg copy at the command prompt.

Remarks

  • Reg does not ask for confirmation when copying a subkey.

  • The following table lists the return values for the reg copy operation.

Value | Description
0 | Success
1 | Failure

Examples

To copy all subkeys and values under the key MyApp to the key SaveMyApp, type:

Copy Code
REG COPY HKLM\Software\MyCo\MyApp HKLM\Software\MyCo\SaveMyApp /s

To copy all values under the key MyCo on the computer named ZODIAC to the key MyCo1 on the current computer, type:

Copy Code
REG COPY \\ZODIAC\HKLM\Software\MyCo HKLM\Software\MyCo1

Additional references

Command-Line Syntax Key


Reg delete

Applies To: Windows Server 2000,Windows Server 2003,Windows Vista,Windows Server 2003 R2,Windows 7,Windows Server 2008,Windows Server 2008 R2,Windows XP

Deletes a subkey or entries from the registry.

For examples of how to use this command, see Examples.

Syntax

Copy Code
Reg delete <KeyName> [{/v ValueName | /ve | /va}] [/f]

Parameters

Parameter | Description
<KeyName> | Specifies the full path of the subkey or entry to be deleted. To specify a remote computer, include the computer name (in the format \\ComputerName\) as part of the KeyName. Omitting \\ComputerName\ causes the operation to default to the local computer. The KeyName must include a valid root key. Valid root keys for the local computer are: HKLM, HKCU, HKCR, HKU, and HKCC. If a remote computer is specified, valid root keys are: HKLM and HKU.
/v <ValueName> | Deletes a specific entry under the subkey. If no entry is specified, then all entries and subkeys under the subkey will be deleted.
/ve | Specifies that only entries that have no value will be deleted.
/va | Deletes all entries under the specified subkey. Subkeys under the specified subkey are not deleted.
/f | Deletes the existing registry subkey or entry without asking for confirmation.
/? | Displays help for reg delete at the command prompt.

Remarks

The following table lists the return values for the reg delete operation.

Value | Description
0 | Success
1 | Failure

Examples

To delete the registry key Timeout and its all subkeys and values, type:

Copy Code
REG DELETE HKLM\Software\MyCo\MyApp\Timeout

To delete the registry value MTU under HKLM\Software\MyCo on the computer named ZODIAC, type:

Copy Code
REG DELETE \\ZODIAC\HKLM\Software\MyCo /v MTU

Additional references

Command-Line Syntax Key


Reg export

Applies To: Windows XP,Windows Server 2008 R2,Windows Server 2008,Windows 7,Windows Server 2003 R2,Windows Vista,Windows Server 2003,Windows Server 2000

Copies the specified subkeys, entries, and values of the local computer into a file for transfer to other servers.

For examples of how to use this command, see Examples.

Syntax

Copy Code
Reg export KeyName FileName [/y]

Parameters

Parameter | Description
<KeyName> | Specifies the full path of the subkey. The export operation works only with the local computer. The KeyName must include a valid root key. Valid root keys are: HKLM, HKCU, HKCR, HKU, and HKCC.
<FileName> | Specifies the name and path of the file to be created during the operation. The file must have a .reg extension.
/y | Overwrites any existing file with the name FileName without prompting for confirmation.
/? | Displays help for reg export at the command prompt.

Remarks

The following table lists the return values for the reg export operation.

Value | Description
0 | Success
1 | Failure

Examples

To export the contents of all subkeys and values of the key MyApp to the file AppBkUp.reg, type:

Copy Code
reg export HKLM\Software\MyCo\MyApp AppBkUp.reg

Additional references

Command-Line Syntax Key


Reg import

Applies To: Windows Server 2000,Windows Server 2003,Windows Vista,Windows Server 2003 R2,Windows 7,Windows Server 2008,Windows Server 2008 R2,Windows XP

Copies the contents of a file that contains exported registry subkeys, entries, and values into the registry of the local computer.

For examples of how to use this command, see Examples.

Syntax

Copy Code
Reg import FileName

Parameters

Parameter | Description
<FileName> | Specifies the name and path of the file that has content to be copied into the registry of the local computer. This file must be created in advance by using reg export.
/? | Displays help for reg import at the command prompt.

Remarks

The following table lists the return values for the reg import operation.

Value | Description
0 | Success
1 | Failure

Examples

To import registry entries from the file named AppBkUp.reg, type:

Copy Code
reg import AppBkUp.reg

Additional references

Command-Line Syntax Key


Reg load

Applies To: Windows XP,Windows Server 2008 R2,Windows Server 2008,Windows 7,Windows Server 2003 R2,Windows Server 2003,Windows Vista,Windows Server 2000

Writes saved subkeys and entries into a different subkey in the registry. Intended for use with temporary files that are used for troubleshooting or editing registry entries.

For examples of how to use this command, see Examples.

Syntax

Copy Code
reg load KeyName FileName

Parameters

Parameter | Description
<KeyName> | Specifies the full path of the subkey to be loaded. For specifying remote computers, include the computer name (in the format \\ComputerName\) as part of the KeyName. Omitting \\ComputerName\ causes the operation to default to the local computer. The KeyName must include a valid root key. Valid root keys for the local computer are: HKLM, HKCU, HKCR, HKU, and HKCC. If a remote computer is specified, valid root keys are: HKLM and HKU.
<FileName> | Specifies the name and path of the file to be loaded. This file must be created in advance by using the reg save operation and a .hiv extension.
/? | Displays help for reg load at the command prompt.

Remarks

The following table lists the return values for the reg load operation.

Value | Description
0 | Success
1 | Failure

Examples

To load the file named TempHive.hiv to the key HKLM\TempHive, type:

Copy Code
REG LOAD HKLM\TempHive TempHive.hiv

Additional references

Command-Line Syntax Key


Reg query

Applies To: Windows Server 2000,Windows Server 2003,Windows Vista,Windows Server 2003 R2,Windows 7,Windows Server 2008,Windows Server 2008 R2,Windows XP

Returns a list of the next tier of subkeys and entries that are located under a specified subkey in the registry.

For examples of how to use this command, see Examples.

Syntax

Copy Code
reg query <KeyName> [{/v <ValueName> | /ve}] [/s] [/se <Separator>] [/f <Data>] [{/k | /d}] [/c] [/e] [/t <Type>] [/z]

Parameters

Parameter | Description
<KeyName> | Specifies the full path of the subkey. For specifying remote computers, include the computer name (in the format \\ComputerName\) as part of the KeyName. Omitting \\ComputerName\ causes the operation to default to the local computer. The KeyName must include a valid root key. Valid root keys for the local computer are: HKLM, HKCU, HKCR, HKU, and HKCC. If a remote computer is specified, valid root keys are: HKLM and HKU.
/v <ValueName> | Specifies the registry value name that is to be queried. If omitted, all value names for KeyName are returned. ValueName for this parameter is optional if the /f option is also used.
/ve | Runs a query for value names that are empty.
/s | Specifies to query all subkeys and value names recursively.
/se <Separator> | Specifies the single value separator to search for in the value name type REG_MULTI_SZ. If Separator is not specified, \0 is used.
/f <Data> | Specifies the data or pattern to search for. Use double quotes if a string contains spaces. If not specified, a wildcard (*) is used as the search pattern.
/k | Specifies to search in key names only.
/d | Specifies to search in data only.
/c | Specifies that the query is case sensitive. By default, queries are not case sensitive.
/e | Specifies to return only exact matches. By default, all the matches are returned.
/t <Type> | Specifies registry types to search. Valid types are: REG_SZ, REG_MULTI_SZ, REG_EXPAND_SZ, REG_DWORD, REG_BINARY, REG_NONE. If not specified, all types are searched.
/z | Specifies to include the numeric equivalent for the registry type in search results.
/? | Displays help for reg query at the command prompt.

Remarks <optional section>

The following table lists the return values for the reg query operation.

Value | Description
0 | Success
1 | Failure

Examples

To display the value of the name value Version in the HKLM\Software\Microsoft\ResKit key, type:

Copy Code
REG QUERY HKLM\Software\Microsoft\ResKit /v Version

To display all subkeys and values under the key HKLM\Software\Microsoft\ResKit\Nt\Setup on a remote computer named ABC, type:

Copy Code
REG QUERY \\ABC\HKLM\Software\Microsoft\ResKit\Nt\Setup /s

To display all the subkeys and values of the type REG_MULTI_SZ using # as the separator, type:

Copy Code
REG QUERY HKLM\Software\Microsoft\ResKit\Nt\Setup /se #

To display the key, value, and data for exact and case sensitive matches of SYSTEM under the HKLM root of data type REG_SZ, type:

Copy Code
REG QUERY HKLM /f SYSTEM /t REG_SZ /c /e

To display the key, value, and data that match 0F in the data under the HKCU root key of data type REG_BINARY.

Copy Code
REG QUERY HKCU /f 0F /d /t REG_BINARY

To display the value and data for value names of null (default) under HKLM\SOFTWARE, type:

Copy Code
REG QUERY HKLM\SOFTWARE /ve

Additional references

Command-Line Syntax Key


Reg restore

Applies To: Windows XP,Windows Server 2008 R2,Windows Server 2008,Windows 7,Windows Server 2003 R2,Windows Server 2003,Windows Vista,Windows Server 2000

Writes saved subkeys and entries back to the registry.

For examples of how to use this command, see Examples.

Syntax

Copy Code
Reg restore <KeyName> <FileName>

Parameters

Parameter | Description
<KeyName> | Specifies the full path of the subkey to be restored. The restore operation works only with the local computer. The KeyName must include a valid root key. Valid root keys are: HKLM, HKCU, HKCR, HKU, and HKCC.
<FileName> | Specifies the name and path of the file with content to be written into the registry. This file must be created in advance with the reg save operation using a .hiv extension.
/? | Displays help for reg restore at the command prompt.

Remarks

  • Before editing any registry entries, save the parent subkey with the reg save operation. If the edit fails, restore the original subkey with the reg restore operation.

  • The following table lists the return values for the reg restore operation.

Value | Description
0 | Success
1 | Failure

Examples

To restore the file named NTRKBkUp.hiv into the key HKLM\Software\Microsoft\ResKit, and overwrite the existing contents of the key, type:

Copy Code
REG RESTORE HKLM\Software\Microsoft\ResKit NTRKBkUp.hiv

Additional references

Command-Line Syntax Key


Reg save

Applies To: Windows Server 2000,Windows Server 2003,Windows Vista,Windows Server 2003 R2,Windows 7,Windows Server 2008,Windows Server 2008 R2,Windows XP

Saves a copy of specified subkeys, entries, and values of the registry in a specified file.

For examples of how to use this command, see Examples.

Syntax

Copy Code
reg save <KeyName> <FileName> [/y]

Parameters

Parameter | Description
<KeyName> | Specifies the full path of the subkey. For specifying remote computers, include the computer name (in the format \\ComputerName\) as part of the KeyName. Omitting \\ComputerName\ causes the operation to default to the local computer. The KeyName must include a valid root key. Valid root keys for the local computer are: HKLM, HKCU, HKCR, HKU, and HKCC. If a remote computer is specified, valid root keys are: HKLM and HKU.
<FileName> | Specifies the name and path of the file that is created. If no path is specified, the current path is used.
/y | Overwrites an existing file with the name FileName without prompting for confirmation.
/? | Displays help for reg save at the command prompt.

Remarks <optional section>

  • The following table lists the return values for the reg save operation.

Value | Description
0 | Success
1 | Failure
  • Before editing any registry entries, save the parent subkey with the reg save operation. If the edit fails, restore the original subkey with the reg restore operation.

Examples

To save the hive MyApp into the current folder as a file named AppBkUp.hiv, type:

Copy Code
REG SAVE HKLM\Software\MyCo\MyApp AppBkUp.hiv

Additional references

Command-Line Syntax Key


Reg unload

Applies To: Windows XP,Windows Server 2008 R2,Windows Server 2008,Windows 7,Windows Server 2003 R2,Windows Vista,Windows Server 2003,Windows Server 2000

Removes a section of the registry that was loaded using the reg load operation.

For examples of how to use this command, see Examples.

Syntax

Copy Code
reg unload <KeyName>

Parameters

Parameter | Description
<KeyName> | Specifies the full path of the subkey to be unloaded. For specifying remote computers, include the computer name (in the format \\ComputerName\) as part of the KeyName. Omitting \\ComputerName\ causes the operation to default to the local computer. The KeyName must include a valid root key. Valid root keys for the local computer are HKLM, HKCU, HKCR, HKU, and HKCC. If a remote computer is specified, valid root keys are HKLM and HKU.
/? | Displays help for reg unload at the command prompt.

Remarks

The following table lists the return values for the reg unload option.

Value | Description
0 | Success
1 | Failure

Examples

To unload the hive TempHive in the file HKLM, type:

Copy Code
REG UNLOAD HKLM\TempHive
Caution
Do not edit the registry directly unless you have no alternative. The registry editor bypasses standard safeguards, allowing settings that can degrade performance, damage your system, or even require you to reinstall Windows. You can safely alter most registry settings by using the programs in Control Panel or Microsoft Management Console (MMC). If you must edit the registry directly, back it up first.

Additional references

Command-Line Syntax Key


Regsvr32

Applies To: Windows Server 2000,Windows Server 2003,Windows Vista,Windows Server 2003 R2,Windows 7,Windows Server 2008,Windows Server 2008 R2,Windows XP

Registers .dll files as command components in the registry.

For examples of how to use this command, see Examples.

Syntax

Copy Code
regsvr32 [/u] [/s] [/n] [/i[:cmdline]] <DllName>

Parameters

Parameter | Description
/u | Unregisters server.
/s | Runs Regsvr32 without displaying messages.
/n | Runs Regsvr32 without calling DllRegisterServer. (Requires the /i parameter.)
/i:<cmdline> | Passes an optional command-line string (cmdline) to DllInstall. If you use this parameter in conjunction with the /u parameter, it calls DllUninstall.
<DllName> | The name of the .dll file that will be registered.
/? | Displays help at the command prompt.

Examples

To register the .dll for the Active Directory Schema, type:

Copy Code
regsvr32 schmmgmt.dll

Additional references

Command-Line Syntax Key


Rem

Applies To: Windows Vista,Windows Server 2003,Windows Server 2000,Windows 7,Windows Server 2003 R2,Windows Server 2008,Windows Server 2008 R2,Windows XP

Records comments (remarks) in a batch file or CONFIG.SYS. If no comment is specified, rem adds vertical spacing.

For examples of how to use this command, see Examples.

Syntax

Copy Code
rem [<Comment>]

Parameters

Parameter | Description
<Comment> | Specifies a string of characters to include as a comment.
/? | Displays help at the command prompt.

Remarks

  • The rem command does not display comments on the screen. You must use the echo on command in your batch or CONFIG.SYS file to display comments on the screen.

  • You cannot use a redirection character (< or >) or pipe (|) in a batch file comment.

  • Although you can use rem without a comment to add vertical spacing to a batch file, you can also use blank lines. Blank lines are ignored when a batch program is processed.

Examples

The following example shows a batch file that uses remarks for comments and for vertical spacing:

Copy Code
@echo off
rem  This batch program formats and checks new disks.
rem  It is named Checknew.bat.
rem
rem echo Insert new disk in Drive B.
pause
format b: /v chkdsk b:

To include an explanatory comment before the prompt command in your CONFIG.SYS file, add the following lines to CONFIG.SYS:

Copy Code
rem Set prompt to indicate current directory
prompt $p$g

Additional references

Command-Line Syntax Key


Ren

Applies To: Windows Vista,Windows Server 2003,Windows Server 2000,Windows 7,Windows Server 2003 R2,Windows Server 2008,Windows Server 2008 R2,Windows XP

Renames files or directories. This command is the same as the rename command.

For examples of how to use this command, see Examples.

Syntax

Copy Code
ren [<Drive>:][<Path>]<FileName1> <FileName2>
rename [<Drive>:][<Path>]<FileName1> <FileName2>

Parameters

Parameter | Description
[<Drive>:][<Path>]<FileName1> | Specifies the location and name of the file or set of files you want to rename. FileName1 can include wildcard characters (* and ?).
<FileName2> | Specifies the new name for the file. You can use wildcard characters to specify new names for multiple files.
/? | Displays help at the command prompt.

Remarks

  • You cannot specify a new drive or path when renaming files.

  • You cannot use the ren command to rename files across drives or to move files to a different directory.

  • You can use wildcard characters (* and ?) in either FileName parameter. Characters that are represented by wildcard characters in FileName2 will be identical to the corresponding characters in FileName1.

  • FileName2 must be a unique file name. If FileName2 matches an existing file name, ren displays the following message:

    Copy Code
    Duplicate file name or file not found

Examples

To change all the .txt file name extensions in the current directory to .doc extensions, type:

Copy Code
ren *.txt *.doc

To change the name of a directory from Chap10 to Part10, type:

Copy Code
ren chap10 part10

Additional references

Command-Line Syntax Key


Rename

Applies To: Windows XP,Windows Server 2008 R2,Windows Server 2008,Windows Server 2003 R2,Windows 7,Windows Server 2000,Windows Server 2003,Windows Vista

This is the same as the ren command. See Ren for syntax and parameters.


Repadmin

Applies To: Windows Server 2003,Windows Server 2003 R2,Windows Server 2008,Windows Server 2008 R2,Windows Server 2003 with SP1

Repadmin.exe helps administrators diagnose Active Directory replication problems between domain controllers running Microsoft Windows operating systems.

Repadmin.exe is built into Windows Server 2008 and Windows Server 2008 R2. It is available if you have the AD DS or the AD LDS server role installed. It is also available if you install the Active Directory Domain Services Tools that are part of the Remote Server Administration Tools (RSAT). For more information, see How to Administer Microsoft Windows Client and Server Computers Locally and Remotely (http://go.microsoft.com/fwlink/?LinkID=177813).

To use Repadmin.exe, you must run the ntdsutil command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

You can use Repadmin.exe to view the replication topology, as seen from the perspective of each domain controller. In addition, you can use Repadmin.exe to manually create the replication topology, to force replication events between domain controllers, and to view both the replication metadata and up-to-dateness vectors (UTDVECs). You can also use Repadmin.exe to monitor the relative health of an Active Directory Domain Services (AD DS) forest.

Important
During the normal course of operations, there is no need to create the replication topology manually. Incorrect use of Repadmin can adversely impact the replication topology. The primary use of Repadmin is to monitor replication so that you can identify problems, such as offline servers or an unavailable local area network (LAN) or wide area network (WAN) connection.

Repadmin also requires administrative credentials on each domain controller that is targeted by the command. Members of the Domain Admins group have the sufficient permissions to run repadmin on domain controllers in that domain. Members of the Enterprise Admins group are, by default, granted membership in the Domain Admins group in each domain in the forest.

You can also delegate the specific permissions that are required to view and manage replication status.

For more information about how to run repadmin.exe commands in different troubleshooting scenarios and how to interpret the output, see Monitoring and Troubleshooting Active Directory Replication Using Repadmin (http://go.microsoft.com/fwlink/?LinkId=197165). For more information about using repadmin.exe to remove lingering objects, see Use Repadmin to Remove Lingering Objects(http://go.microsoft.com/fwlink/?LinkId=197166).

Syntax

Copy Code
repadmin <cmd> <args> [/u:{domain\user}] [/pw:{password | *}] [/retry[:<retries>][:<delay>]] [/csv]

Help commands

Repadmin provides different Help menus for different types of information and for different levels of experience among administrators. The following table shows the commands that you can run for different Help menus in Repadmin.

Command Description

/?

Displays and describes commands that are available.

/help

Same as /?

/?:<cmd>

Displays possible arguments <args>, appropriate syntaxes, and examples for the specified command <cmd>.

/help:<cmd>

Same as /?:<cmd>

/experthelp

Displays commands that are available for advanced users only.

/listhelp

Displays the variations of syntax that are available for the DSA_NAME, DSA_LIST, NCNAME and OBJ_LIST strings.

Note
The DSA_LIST parameter is the same as the DC_LIST parameter in the Windows Server 2003 version of Repadmin.exe.

/oldhelp

Displays help for commands in the Windows 2000 Server and Windows Server 2003 versions of Repadmin.exe.

Commands

Parameter | Description
Repadmin /kcc | Forces the Knowledge Consistency Checker (KCC) on targeted domain controllers to immediately recalculate the inbound replication topology.
Repadmin /prp | Specifies the Password Replication Policy (PRP) for read-only domain controllers (RODCs).
Repadmin /queue | Displays inbound replication requests that the domain controller must issue to become consistent with its source replication partners.
Repadmin /replicate | Triggers the immediate replication of the specified directory partition to a destination domain controller from a source domain controller.
Repadmin /replsingleobj | Replicates a single object between any two domain controllers that have common directory partitions.
Repadmin /replsummary | Identifies domain controllers that are failing inbound replication or outbound replication, and summarizes the results in a report.
Repadmin /rodcpwdrepl | Triggers replication of passwords for the specified users from the source domain controller to one or more read-only domain controllers. (The source domain controller is typically a hub site domain controller.)
Repadmin /showattr | Displays the attributes of an object.
Repadmin /showobjmeta | Displays the replication metadata for a specified object that is stored in AD DS, such as attribute ID, version number, originating and local update sequence numbers (USNs), globally unique identifier (GUID) of the originating server, and date and time stamp.
Repadmin /showrepl | Displays the replication status when the specified domain controller last attempted to perform inbound replication on Active Directory partitions.
Repadmin /showutdvec | Displays the highest, committed USN that AD DS, on the targeted domain controller, shows as committed for itself and its transitive partners.
Repadmin /syncall | Synchronizes a specified domain controller with all replication partners.

Additional parameters

Parameter Description

u

Specifies the domain and user name with permission to perform operations in AD DS. (The domain and user name are separated by a backslash, for example, domain\user.) This parameter does not support using a User Principal Name (UPN) to log on to a domain.

pw

Specifies the password for the user name that you enter with the /u parameter.

Retry

Causes Repadmin to retry its attempt to bind to the target domain controller, if the first attempt fails with one of the following errors:

  • Event ID 1722 (0x6ba): "The RPC Server is unavailable"

  • Event ID 1753 (0x6d9): "There are no more endpoints available from the endpoint mapper"

csv

Displays the results of the /showrepl parameter in a comma-separated-value (CSV) format.

The DSA_LIST parameter

This section explains the syntax of the DSA_LIST parameter.

Note
The DSA_LIST parameter is the same as the DC_LIST parameter in the Windows Server 2003 version of Repadmin.exe.

Syntax

Copy Code
{<dc_name> | * |<partial_server_name>* | site:<site_name> |gc: |fsmo_<type>:[<name> | <site_name>]}

Parameters

Parameter | Definition
<dc_name> | Specifies the host name of a domain controller.
* | Specifies that the repadmin command will target all domain controllers in the forest of the computer that you are running Repadmin.exe on. Improper use of this standard wildcard character can cause a significant increase in network traffic.
<partial_server_name> | Uses wildcard characters to return partial matches. For example, if you append an asterisk (*) when you specify the partial domain controller name "Contoso-DC-*", the command returns Contoso-DC-01, Contoso-DC-02, Contoso-DC-03, and so on, but the command does not return Contoso-diff-name. This parameter works best when you use a common prefix for domain controllers in the domain. You cannot use a wildcard character at the beginning of the partial server name.
site:<site_name> | Returns all domain controllers in the Active Directory site that you specify in this parameter.
gc | Queries all global catalog servers in the enterprise.
fsmo_<type> | Specifies a group of domain controllers to query by operations master role. (The operations master role is also known as flexible single master operations or FSMO.). Valid operations master roles are listed in the following table.

Valid operations master roles

Operations master role | Description
fsmo_pdc:[<name>] | Runs Repadmin.exe against the primary domain controller (PDC) emulator operations master. The <name> parameter takes a naming context.
fsmo_rid:[<name>] | Runs Repadmin.exe against the relative ID (RID) operations master. The <name> parameter takes a naming context.
fsmo_im:[<name>] | Runs Repadmin.exe against the infrastructure operations master. The <name> parameter takes a naming context.
fsmo_istg:[<site_name>] | Runs Repadmin.exe against the Intersite Topology Generator (ISTG). The <site_name> parameter takes a site distinguished name.
fsmo_dnm: | Runs Repadmin.exe against the domain naming operations master.
fsmo_schema: | Runs Repadmin.exe against the schema operations master.

Remarks

  • Repadmin syntax uses the following terminology:

    • Naming context

      The distinguished name of a directory partition in an AD DS forest. Naming contexts include the three Read/Write naming contexts—domain, schema, and configuration—and the optional read-only naming contexts that are present on domain controllers that are global catalog servers. A naming context can also be an application directory partition. You specify a naming context as a distinguished name, which indicates its hierarchical relationship to the forest root domain, for example, DC=MyDomain,DC=Contoso,DC=Com.

    • Globally unique identifier (GUID)

      The 128-bit number that is used to uniquely identify objects that are stored in the directory, for example, fa1a9e6e-2e14-11d2-aa9b-bbfc0a30094c. The GUID is sometimes referred to in syntax as a universally unique identifier (UUID). For the purposes of Repadmin, these two terms are synonymous.

    • Distinguished name

      An X.500 distinguished name, for example, CN=Server1,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=Contoso,DC=Com.

  • In the Repadmin examples that are included in each command topic, the domain controller object GUID and the domain controller Invocation ID that are returned by some commands, such as the /showrepl command, initially show identical hexadecimal values (until system state is restored). However, these two values identify different objects. The domain controller object GUID is a unique identifier for the NTDS Settings object on the domain controller. The value of the domain controller object GUID does not change unless you remove AD DS from the domain controller, and then reinstall it. The domain controller Invocation ID identifies the directory database on the domain controller. This value changes when you restore a domain controller from a backup. When you first install a domain controller, the values for these two identifiers are the same; however, whenever you restore a domain controller from a backup, the Invocation ID value changes.

  • Most Repadmin commands take their parameters in the following order:

    1. "Destination or Target DSA_LIST"

    2. "Source DSA_NAME", if required

    3. <Naming Context> or Object distinguished name, if required

    For example:

    Copy Code
    repadmin /showrepl <DSA_LIST> <Source_DSA_NAME> <Naming Context>
    <DSA_NAME> is a Directory Service Agent binding string, as is <DSA_LIST>. For AD DS, this string is a network label. For a domain controller, network labels include Domain Name System (DNS), NetBIOS, and IP address. For example:

    Copy Code
    dc-01
dc-01.contoso.com
localhost
    For Active Directory Lightweight Directory Services (AD LDS), this string must be a network label of the AD LDS server that is followed by a colon, and then followed by the Lightweight Directory Access Protocol (LDAP) port of the AD LDS instance. For example:

    Copy Code
    ad-am-01:2000
ad-am-01.contoso.com:2000
    <Naming Context> is the distinguished name of the root of the naming context. For example:

    Copy Code
    DC=My-Domain,DC=Contoso,DC=Com
  • Text with international or Unicode characters displays correctly if you install appropriate fonts and language support on the computer from which you run Repadmin. Examples of such text are naming context names and server names.

Additional references

Command-Line Syntax Key


Repadmin /kcc

Applies To: Windows Server 2003,Windows Server 2003 with SP2,Windows Server 2003 R2,Windows Server 2008,Windows Server 2008 R2,Windows Server 2003 with SP1

Forces the Knowledge Consistency Checker (KCC) on each targeted domain controller to immediately recalculate the inbound replication topology.

By default, each domain controller performs this recalculation every 15 minutes. Run this command to troubleshoot KCC errors after you remove suspected fault conditions or to re-evaluate whether new connection objects must be created on behalf of the targeted domain controllers.

For examples of how to use this command, see Examples.

Syntax

Copy Code
repadmin /kcc [<DSA_LIST>] [/async]

Parameters

Parameter | Description
<DSA_LIST> | Specifies the host name of a domain controller or a list of domain controllers that are separated in the list by single spaces. For detailed syntax, see Repadmin.
/async | Specifies that replication is asynchronous. That is, Repadmin starts the replication event, but it does not expect an immediate response from the destination domain controller. Use this parameter to start the KCC if you do not want to wait for the KCC to finish. Repadmin /kcc is typically run without the /async parameter.

Examples

The following example triggers the KCC to run on each of the domain controllers that are in the site named HQ:

Copy Code
repadmin /kcc site:HQ

Additional references

Command-Line Syntax Key

Repadmin


Repadmin /prp

Applies To: Windows Server 2003 with SP1,Windows Server 2008 R2,Windows Server 2008,Windows Server 2003 R2,Windows Server 2003 with SP2,Windows Server 2003

Lists and modifies the Password Replication Policy (PRP) for read-only domain controllers (RODCs).

You run the repadmin /prp command against a writable domain controller that runs Windows Server 2008 rather than an RODC.

For examples of how to use this command, see Examples.

Syntax

Copy Code
repadmin /prp <OPERATION> <RODC> [ADDITIONAL_ARGS]

Operations

The repadmin /prp command can perform the following operations:

  • Add

  • Delete

  • Move

  • View

Additional arguments are available for each operation.

Add

Adds the specified security principal to the msDS-RevealOnDemandGroup attribute that is associated with the RODC. (This attribute is also known as the Allowed List.)

Note
You cannot use repadmin /prp commands to add an account to the Deny List or remove an account from the Deny List. To configure the Deny List, you can use the Active Directory Users and Computers snap-in or you can create a script. For example, if you want to deny members of the group RODC2Admins from caching passwords on RODC2, which is located in the Branch2 organizational unit (OU) of hq.cpandl.com, you can use the following script:

Copy Code
'The following items specify to Clear, Update, Append, or Delete a property of an Active Directory object
Const ADS_PROPERTY_CLEAR = 1
Const ADS_PROPERTY_UPDATE = 2
Const ADS_PROPERTY_APPEND = 3
Const ADS_PROPERTY_DELETE = 4

Const ATT = "msDS-NeverRevealGroup"
'The setting for ATT determines which list will be modified
'msDS-AuthenticatedToAccountlist is for the authenticated to or Auth2 list
'msDS-RevealedList is for the password revealed or cached list
'msDS-RevealOnDemandGroup is for the allowed to authenticate list
'msDS-NeverRevealGroup is for the denied from authenticating list

'PRPObj defines the object that needs to be modified in the PRP list
PRPObj = "CN=RODC2Admins,OU=Branch2,DC=hq,DC=cpandl,DC=com"

'RODCObj defines the RODC for which the PRP should be modified
RODCObj = "LDAP://CN=RODC2,OU=Domain Controllers,DC=hq,DC=cpandl,DC=com"

'Sets the object to modify based on the LDAP path set in RODCObj
Set objComputer = GetObject(RODCObj)

'Implements the change, which depending on the word after ADS_PROPERTY_ is a CLEAR, UPDATE, APPEND, or DELETE operation
objComputer.PutEx ADS_PROPERTY_APPEND, ATT, Array(PRPObj)
objComputer.SetInfo

'Confirms that the modification has taken place (this is optional)
wscript.echo "Modified list attributes for object " & PRPObj

'Closes the script
wscript.quit(0)

Syntax

Copy Code
repadmin /prp add <RODC> allow <PRINCIPAL>

Additional parameters

Parameter | Description
<RODC> | Specifies the host name of the RODC. You can specify the single-label host name or the fully qualified domain name (FQDN). In addition, you can use an asterisk (*) as a wildcard character to specify multiple RODCs in one domain.
<PRINCIPAL> | Specifies the name of the security principal that you want to add to the Allowed List.

Delete

Deletes one or more specified security principals from the msDS-AuthenticatedToAccountList attribute or from the msDS-RevealOnDemandGroup attribute that is associated with the RODC. (The AuthenticatedToAccountList attribute is also known as the Authenticated to List, and the msDS-RevealOnDemandGroup attribute is also known as the Allowed List.)

Syntax

Copy Code
repadmin /prp delete <RODC> allow {<PRINCIPAL>|/all}
repadmin /prp delete <RODC> auth2 /all

Additional parameters

Parameter | Description
<RODC> | Specifies the host name of the RODC. You can specify the single-label host name or the FQDN. In addition, you can use an asterisk (*) as a wildcard character to specify multiple RODCs in one domain.
<PRINCIPAL> | Specifies the name of the security principal that you want to delete from the Allowed List. Specify /all to have the operation delete all security principals.
/all | Specifies all security principals. You cannot delete only one security principal from the msDS-AuthenticatedToAccountList attribute.

Move

Moves all the security principals from the msDS-AuthenticatedToAccountList attribute to the specified group. If the group does not exist, this command creates the group. If necessary, this command also adds the group to the msDS-RevealOnDemandGroup attribute of the RODC. (The msDS-AuthenticatedToAccountList attribute is also known as the Authenticated To List, and the msDS-RevealOnDemandGroup attribute is also known as the Allowed List.)

Syntax

Copy Code
repadmin /prp move <RODC> <Group> [/noauth2cleanup] [/users_only | /comps_only]

Additional parameters

Parameter | Description
<RODC> | Specifies the host name of the RODC. For this operation, you can specify the single-label host name or the FQDN.
<Group> | Specifies the name of the security group to which you want to move the security principals. If the security group does not exist, this command creates the security group in the built-in Users container. You can specify the name of the security group but not the distinguished name.
/noauth2cleanup | Retains the list of security principals in the msDS-AuthenticatedToAccountList attribute after the Move operation is complete. By default, the msDS-AuthenticatedToAccountList attribute is cleared.
/users_only | Moves only user accounts from the msDS-AuthenticatedToAccountList attribute to the specified group. The group is then added to the msDS-RevealOnDemandGroup attribute.
/comps_only | Moves only computer accounts from the msDS-AuthenticatedToAccountList attribute to the specified group. The group is then added to the msDS-RevealOnDemandGroup attribute.

View

Displays the security principals in the specified list or displays the current PRP setting (allowed or denied) for a specified user.

Syntax

Copy Code
repadmin /prp view <RODC> {<List_Name>|<User>}

Additional parameters

Parameter Description

<RODC>

Specifies the host name of the RODC. You can specify the single-label host name or the fully qualified domain name. In addition, you can use an asterisk (*) as a wildcard character to specify multiple RODCs in one domain.

<List_Name>

Specifies all the security principals that are in the list that you want to view. The valid list names are as follows:

  • auth2: The list of security principals that the RODC has authenticated.

  • reveal: The list of security principals for which the RODC has cached passwords.

  • allow: The list of security principals in the msDS-RevealOnDemandGroup attribute. The RODC can cache passwords for this list of security principals only.

  • deny: The list of security principals in the msDS-NeverRevealGroup attribute. The RODC cannot cache passwords for any security principals in this list.

<User>

Specifies the effective PRP setting (allowed or denied) for the specified user. You can specify the user name only or the distinguished name.

Examples

The following example lists the users whose passwords are currently cached on the domain controller named br1-rodc01:

Copy Code
repadmin /prp view br1-rodc01 reveal

The following command caches the password for the user account named MikeDan on the domain controller named br1-rodc1:

Copy Code
repadmin /prp add br1-rodc1 allow cn=MikeDan,ou=user-groups,dc=contoso,dc=com

Additional references

Command-Line Syntax Key

Repadmin


Repadmin /queue

Applies To: Windows Server 2003,Windows Server 2003 with SP2,Windows Server 2003 R2,Windows Server 2008,Windows Server 2008 R2,Windows Server 2003 with SP1

Displays inbound replication requests that the domain controller has to issue to become consistent with its source replication partners.

Growth in the number of items in the queue of an online domain controller can be caused by any of the following factors:

  • Too many concurrent replication partners

  • High change rates to objects in Active Directory Domain Services (AD DS)

  • Insufficient CPU or network bandwidth for the amount of data that the domain controller is replicating

For examples of how to use this command, see Examples.

Syntax

Copy Code
repadmin /queue [DSA_LIST]

Parameters

Parameter | Description
DSA_LIST | Specifies the host name of a domain controller or a list of domain controllers that are separated in the list by a single space. For detailed syntax, see Repadmin.

Examples

The following example returns the queue of inbound replication requests that a bridgehead server named Contoso-DC-01 has not yet processed:

Copy Code
repadmin /queue Contoso-DC-01

Additional references

Command-Line Syntax Key

Repadmin


Repadmin /replicate

Applies To: Windows Server 2003 with SP1,Windows Server 2008 R2,Windows Server 2008,Windows Server 2003 R2,Windows Server 2003 with SP2,Windows Server 2003

Triggers the immediate replication of the specified directory partition to a destination domain controller from a source domain controller.

The /replicate command tests replication success after you remove suspected fault conditions without waiting for the replication schedule to open.

You can refer to the source or destination domain controller in any of the following ways:

  • By its single-label host name

  • By its fully qualified host name

  • By the globally unique identifier (GUID) that is assigned to the NTDS Settings object for the domain controller

You can obtain the GUID for the directory system agent (DSA) object from the header of the output of the following command:

Copy Code
repadmin /showrepl <name of domain controller>.

The computer where you run Repadmin, the destination domain controller, and the source domain controller must use the same network protocols that are used by the relevant connection object and have network connectivity over the same ports that are used by that connection object.

For examples of how to use this command, see Examples.

Syntax

Copy Code
repadmin /replicate <Dest_DSA_List> <Naming Context> /allsources [/force] [/async] [/full] [/addref] [/readonly]
repadmin /replicate <Dest_DSA_List> <Source_DSA_Name> <Naming Context> [/force]

Parameters

Parameter Description

<Dest_DSA_List>

Specifies the single-label host name of a domain controller or a list of domain controllers that are separated in the list by single spaces. For detailed syntax, see Repadmin.

<Source_DSA_Name>

Specifies the host name of a source domain controller.

/allsources

Specifies that replication on the destination domain controllers occurs with all replication partners.

Note
In Windows Server 2008 R2, the /allsources parameter is deprecated.

/force

Allows the caller to override connections that an administrator has disabled by using repadmin /options and allows replication with corrupt and divergent partners. Do not use this parameter if you suspect that Update Sequence Number (USN) Rollback has occurred.

/async

Specifies that replication is asynchronous. That is, Repadmin starts the replication event, but it does not expect an immediate response from the destination domain controller. Use this parameter to start the KCC, if you do not want to wait for KCC to finish.

/full

Requests that the source domain controller replicate all changes again for the specified partition. This command resets the up-to-dateness vector (UTDVEC) and the high watermark

This parameter does not remove lingering objects on the destination domain controller.

Do not use this parameter if you suspect USN Rollbacks has occurred.

/addref

Enables change notification between the source and destination domain controllers.

/readonly

Specifies that the destination domain controller holds a read-only copy of the partition that is replicated.

Examples

The following example replicates the Contoso naming context from source-dc01 to dest-dc01:

Copy Code
repadmin /replicate dest-dc01 source-dc01 DC=contoso,DC=com

The following command replicates the Mayberry naming context from source-dc01 to dest-dc01 and specifies that the naming context is read-only on the destination domain controller:

Copy Code
repadmin /replicate dest-dc01 source-dc01 DC=Mayberry,DC=contoso,DC=com /readonly

Additional references

Command-Line Syntax Key

Repadmin


Repadmin /replsingleobj

Applies To: Windows Server 2003,Windows Server 2003 with SP2,Windows Server 2003 R2,Windows Server 2008,Windows Server 2008 R2,Windows Server 2003 with SP1

Replicates a single object between any two domain controllers that have common directory partitions.

The two domain controllers do not have a replication agreement. That is, neither domain controller has an inbound connection object for the other domain controller.

You can use the repadmin /showrepl or the repadmin /showconn command to show replication agreements.

For examples of how to use this command, see Examples.

Syntax

Copy Code
repadmin /replsingleobj <DSA_LIST> <Source_DSA_Name> <obj dn>

Parameters

Parameter | Description
DSA_LIST | Specifies the host name of a domain controller or a list of domain controllers that are separated in the list by single spaces. For detailed syntax, see Repadmin.
<Source_DSA_Name> | Specifies the host name of a source domain controller.
<obj dn> | Specifies the distinguished name of the object that you want to replicate.

Examples

The following example triggers replication of the object named VPSales from source-dc01 to dest-dc01:

Copy Code
repadmin /replsingleobj dest-dc01 source-dc01 cn=VPSales,ou=execs,dc=contoso,dc=com

Additional references

Command-Line Syntax Key

Repadmin

Repadmin /showrepl


Repadmin /replsummary

Applies To: Windows Server 2003 with SP1,Windows Server 2008 R2,Windows Server 2008,Windows Server 2003 R2,Windows Server 2003 with SP2,Windows Server 2003

Identifies domain controllers that are failing inbound replication or outbound replication, and summarizes the results in a report.

When it begins to collect data for the replication summary, this command displays a series of dots. Each dot represents a domain controller that is specified in the DSA_LIST parameter (plus some extra dots for preprocessing). Fifty dots are displayed on each line of the output. For example, four lines of dots represent about 200 domain controllers that are specified by the DSA_LIST parameter. The dots help you gauge throughput and completion time in large environments.

For examples of how to use this command, see Examples.

Syntax

Copy Code
repadmin /replsummary [DSA_LIST] [/bysrc] [/bydest] [/errorsonly] [/sort:{delta | partners | failures | error | percent | unresponsive}]

Parameters

Parameter Description

DSA_LIST

Specifies the host name of a domain controller or a list of domain controllers. For detailed syntax, see Repadmin.

/bysrc

Summarizes the replication status for all domain controllers that a given source domain controller replicates to. This parameter does not display the destination domain controller.

/bydest

Summarizes the replication status for all domain controllers that a given destination domain controller replicates from. This parameter does not display the source domain controller.

/errorsonly

Shows only the domain controllers where the partner error is non-zero.

/sort

Sorts the output by columns that are in the following list:

  • delta: Sorts the results according to the least current naming context for each source or destination domain controller.

  • partners: Sorts the results list by the number of replication partners for each domain controller.

  • failures: Sorts the results list by the number of partner replication failures for each domain controller.

  • error: Sorts the results list by the last replication result (the error code) that is blocking replication for each domain controller. This helps you troubleshoot the root cause of failure for domain controllers that fail with common errors.

  • percent: Sorts the results list by the partner replication failure percentage for each domain controller. (This is calculated by dividing the number of failures by the total number of attempts, and then multiplying by 100; that is, failures/total attempts * 100.) This helps you prioritize your troubleshooting efforts by identifying the domain controllers that are experiencing the highest frequency of replication errors.

  • unresponsive: Sorts the results list by the names of partners that do not respond to replication requests for each domain controller.

Remarks

  • You can specify the /bysrc and /bydest parameters at the same time. If you do so, then Repadmin displays the /bysrc parameter table first and the /bydest parameter table next.

  • If the parameters /bysrc and /bydest are both absent, Repadmin displays the one with the least number of partner errors.

Examples

The following example targets all domain controllers in the forest to retrieve summary replication status from each. The example lists the output in a table that has columns for source and destination, and sorts the results based on the longest time since the last successful replication:

Copy Code
repadmin /replsum * /bysrc /bydest /sort:delta

Additional references

Command-Line Syntax Key

Repadmin


Repadmin /rodcpwdrepl

Applies To: Windows Server 2003,Windows Server 2003 with SP2,Windows Server 2003 R2,Windows Server 2008,Windows Server 2008 R2,Windows Server 2003 with SP1

Triggers replication of passwords for the specified users from a writable Windows Server 2008 source domain controller to one or more read-only domain controllers (RODCs).

For each destination RODC, the source domain controller enforces the Password Replication Policy (PRP) before it performs the operation. If the PRP does not permit replicating the password to an RODC for a specified user, the operation for that user and RODC combination fails.

For examples of how to use this command, see Examples.

Syntax

Copy Code
repadmin /rodcpwdrepl [DSA_LIST] <Hub DC> <User1 DN> [<User2 DN> <User3 DN>...]

Parameters

Parameter | Description
<DSA_LIST> | Specifies the host name of a domain controller or a list of domain controllers that are separated in the list by single spaces. For detailed syntax, see Repadmin.
<Hub DC> | Specifies the writable Windows Server 2008 domain controller that enforces the PRP of the RODC.
<Usern DN> | Specifies the distinguished name of the user account whose password must be cached (prepopulated) on the RODC.

Examples

The following example triggers replication of the passwords for the user account named JaneOh from the source domain controller named source-dc01 to all RODCs that have the name prefix dest-rodc:

Copy Code
repadmin /rodcpwdrepl dest-rodc* source-dc01 cn=JaneOh,ou=execs,dc=contoso,dc=com

Additional references

Command-Line Syntax Key

Repadmin


Repadmin /showattr

Applies To: Windows Server 2003 with SP1,Windows Server 2008 R2,Windows Server 2008,Windows Server 2003 R2,Windows Server 2003 with SP2,Windows Server 2003

Displays the attributes of an object.

Although the repadmin /showobjmeta command displays the number of times that the attributes on an object have changed and which domain controller made those changes, the repadmin /showattr command displays the actual values for an object. The repadmin /showattr command can also display the values for objects that are returned by a command-line Lightweight Directory Access Protocol (LDAP) query.

An object can be referenced by its distinguished name or by its object globally unique identifier (GUID).

By default, repadmin /showattr uses Lightweight Directory Access Protocol (LDAP) port 389 to query writable directory partitions. However, repadmin /showattr can optionally use LDAP port 3268 to query the read-only partitions of a global catalog server.

For examples of how to use this command, see Examples.

Syntax

Copy Code
/showattr <DSA_LIST> <OBJ_LIST> [OBJ_LIST Options] [/atts:<att1>,<att2>...] [/allvalues] [/long] [/dumpallblob]

Parameters

Parameter | Description
<DSA_LIST> | Specifies the host name of a domain controller or a list of domain controllers that are separated in the list by single spaces. For detailed syntax, see Repadmin.
<OBJ_LIST> [OBJ_LIST Options} | Specifies the distinguished name or object GUID of the object whose attributes you want to enumerate. When you perform an LDAP query from a command prompt, this parameter forms the base distinguished name path for the search. Enclose distinguished names that contain spaces in quotation marks.
/atts | Returns values for specified attributes only. You can display values for multiple attributes by separating them with commas.
/allvalues | Displays all attribute values. By default, this parameter displays only 20 attribute values for an attribute.
/gc | Specifies the use of TCP port 3268 to query read-only global catalog partitions.
/long | Displays one line for each attribute value.
/dumpallblob | Displays all binary attribute values. This command is similar to /allvalues, but it displays binary attribute values.

Examples

The following example queries a specific domain controller and shows all attributes for an object using its distinguished name:

Copy Code
repadmin /showattr hq-dc-01 "cn=enterprise administrators,cn=users,dc=contoso,dc=com"

The following example queries a specific domain controller and shows all attributes for an object using its object GUID:

Copy Code
repadmin /showattr hq-dc-01 "<GUID=20b11743-1272-45c0-88fb-ea9a753d53f8>"

The following example queries all domain controllers whose computer names start with HQ-DC and shows the value for a specific attribute, msDS-Behavior-Version, which denotes the domain functional level:

Copy Code
Repadmin /showattr hq-dc* "DC=contoso,DC=com" /atts:msDS-Behavior-Version

The following example queries a single domain controller named hq-dc-01 and returns the attributes operating system version and service pack revision for all domain controller computers, targeted by primary group ID = 516, which identifies enterprise domain controllers:

Copy Code
repadmin /showattr hq-dc-01 ncobj:domain: /filter:"(&(objectCategory=computer)(primaryGroupID=516))" /subtree /atts:operatingSystem,operatingSystemVersion,operatingSystemServicePack

The following example queries the read-only partitions (/gc) of all global catalogs ("gc:") in the forest to see if those partitions contain a copy of a specific object that is referenced by its object GUID. This command is useful for determining which domain controllers replicated an important change or contain a lingering object:

Copy Code
repadmin /showattr gc: "<GUID=20b11743-1272-45c0-88fb-ea9a753d53f8>" /gc

Additional references

Command-Line Syntax Key

Repadmin

Repadmin /showobjmeta


Repadmin /showobjmeta

Applies To: Windows Server 2003,Windows Server 2003 with SP2,Windows Server 2003 R2,Windows Server 2008,Windows Server 2008 R2,Windows Server 2003 with SP1

Displays the replication metadata for a specified object stored in Active Directory Domain Services (AD DS), such as the attribute ID, a version number, the originating and local Update Sequence Numbers (USNs), the globally unique identifier (GUID) of the originating server, and the date and time stamp.

By comparing the replication metadata for the same object on different domain controllers, you can determine whether replication has occurred or which domain controller added, modified, or deleted an attribute or object. You can reference an object by its distinguished name path, object GUID, or security identifier (SID). If the distinguished name path includes a space, enclose it in quotation marks.

For examples of how to use this command, see Examples.

Syntax

Copy Code
repadmin /showobjmeta [DSA_LIST] <Object DN> [/nocache] [/linked]

Parameters

Parameter | Description
<DSA_LIST> | Specifies the host name of a domain controller or a list of domain controllers that are separated in the list by single spaces. For detailed syntax, see Repadmin.
<Object DN> | Specifies the distinguished name of the object for which you want to display metadata.
/nocache | Specifies that GUIDs are left in hexadecimal form. By default, GUIDs are translated into strings.
/linked | Displays the metadata for linked attributes, such as the member attribute of a security group object. This parameter is valid only if the forest functional level is Windows Server 2003.

Examples

The following example targets all domain controllers that have a name prefixed with the string "dst" (such as dst-01, dst-02, and so on) and requests the replication metadata for an object by specifying the distinguished name. The distinguished name path is enclosed within quotation marks because it contains a space:

Copy Code
repadmin /showobjmeta dst* "CN=Joe Smith,OU=UserAccounts,DC=contoso,DC=com"

The following example targets all domain controllers that have a name prefixed with the string "dst" and requests the replication metadata for an object by specifying the distinguished name:

Copy Code
repadmin /showobjmeta dst* CN=Finance,OU=UserGroups,DC=contoso,DC=com /linked

The following example targets a specific domain controller and requests the replication metadata for an object by specifying the object GUID:

Copy Code
repadmin /showobjmeta destdc01 "<GUID=93f2ab2b-f140-4f74-b018-652566d8bdbd>"

The following example targets a specific domain controller and requests the replication metadata for an object by specifying the object SID:

Copy Code
repadmin /showobjmeta destdc01 "<SID=S-1-5-21-1721254763-462695806-1538882281-35372>"

Additional references

Command-Line Syntax Key

Repadmin


Repadmin /showrepl

Applies To: Windows Server 2003 with SP1,Windows Server 2008 R2,Windows Server 2008,Windows Server 2003 R2,Windows Server 2003 with SP2,Windows Server 2003

Displays the replication status when the specified domain controller last attempted to perform inbound replication of Active Directory partitions.

The repadmin /showrepl command helps you understand the replication topology and replication failures. It reports status for each source domain controller from which the destination has an inbound connection object. The status report is categorized by directory partition.

The administrative workstation on which you run Repadmin must have remote procedure call (RPC) network connectivity to all domain controllers that are targeted by the DSA_LIST parameter.

Replication errors may be caused by the source domain controller; destination domain controller; or any component of the replication process, including the underlying network.

In Windows Server 2003 and Windows Server 2008, Repadmin does not display outbound partners for intrasite replication as it did in the Microsoft Windows 2000 Server operating system. Use the /repsto parameter to display outbound partners.

For examples of how to use this command, see Examples.

Syntax

Copy Code
repadmin /showrepl [DSA_LIST [Source DSA object GUID]] [Naming Context] [/verbose] [/nocache] [/repsto] [/conn] [/all] [/errorsonly] [/intersite] [/csv]

Parameters

Parameter | Description
DSA_LIST | Specifies the host name of a domain controller or a list of domain controllers that are separated in the list by single spaces. For detailed syntax, see Repadmin.
Source DSA object GUID | Specifies the unique hexadecimal number that identifies the object whose replication events are listed.
Naming Context | Specifies the distinguished name of the directory partition to replicate.
/verbose | Displays additional information about the source partners from which the destination domain controller performs inbound replication. The information includes fully qualified CNAME, invocation ID, replication flags, and update sequence number (USN) values for originating update and replicated updates.
/nocache | Specifies that globally unique identifiers (GUIDs) are left in hexadecimal form. By default, GUIDs are translated into strings.
/repsto | Lists the partner domain controllers with which the targeted domain controllers use change notification to perform outbound replication. (Partner domain controllers in this case are domain controllers in the same Active Directory site as the source domain controller and domain controllers that are in remote sites where change notification has been enabled.) This list is appended under OUTBOUND NEIGHBORS FOR CHANGE NOTIFICATIONS of the Repadmin output.
/conn | Appends a KCC CONNECTION OBJECTS section to the Repadmin output that lists all connections and why they were created.
/all | Runs both the /repsto and the /conn parameters.
/errorsonly | Displays replication status only for source domain controllers with which the destination domain controller encounters replication errors.
/intersite | Displays the replication status for connections from domain controllers in remote sites from which the domain controller that is listed in the DSA_LIST parameter performs inbound replication.
/csv | Displays the results in a comma-separated-value (CSV) format.

Examples

The following example reports the inbound replication status for all domain controllers in the forest output in CSV format that is ideal for viewing forest-wide replication status in a spreadsheet application such as Microsoft Excel:

Copy Code
repadmin /showrepl * /csv
Note
For more information about how to import a CSV file to Excel, see Import or export text files (http://go.microsoft.com/fwlink/?LinkId=104206).

The following example reports the inbound replication status for all domain controllers in the forest that are experiencing a replication error:

Copy Code
repadmin /showrepl * /errorsonly

The following example reports the inbound replication status for all domain controllers in the site named HQ that perform inbound replication of a read-only or writable copy of the mayberry.contoso.com domain partition:

Copy Code
repadmin /showrepl site:HQ DC=Mayberry,DC=Contoso,dc=Com

Additional references

Command-Line Syntax Key

Repadmin


Repadmin /showutdvec

Applies To: Windows Server 2003,Windows Server 2003 with SP2,Windows Server 2003 R2,Windows Server 2008,Windows Server 2008 R2,Windows Server 2003 with SP1

Displays the highest committed Update Sequence Number (USN) that Active Directory Domain Services (AD DS) on the targeted domain controller shows as committed for itself and its transitive partners.

The up-to-dateness vector (UTDVEC) shows the highest USN that the destination domain controller has received by replication, in the form of changes it has received from its direct and transitive replication partners for the specified partition.

Destination domain controllers start with the last received USNchanged attribute when they request changes from a specified source.

All USNs for a specified source domain controller appear in the context of the local USN for that source, not the USNs on the destination domain controller.

The UTDVEC for a local domain controller shows the highest committed USN on which the domain controller has performed inbound replication or that it originated.

This command output lists current and historical replication partners, including transitive replication partners.

By comparing the USNs from this command output on a source and destination domain controller, you can determine how current a destination domain controller is compared to its source partner.

You may detect USN rollbacks if you run this command when the destination domain controller has a higher committed USN than the source domain controller. For best results, and to avoid false USN rollbacks, obtain this command output from destination domain controllers immediately followed by source domain controllers.

For examples of how to use this command, see Examples.

Syntax

Copy Code
repadmin /showutdvec <DSA_LIST> <Naming Context> [/nocache] [/latency]

Parameters

Parameter | Description
<DSA_LIST> | Specifies the host name of a domain controller or a list of domain controllers that are separated in the list by single spaces. For detailed syntax, see Repadmin.
<Naming Context> | Specifies the distinguished name of the directory partition.
/nocache | Specifies that globally unique identifiers (GUIDs) are left in hexadecimal form. By default, GUIDs are translated into strings.
/latency | Orders the entries in the UTDVEC from least current to most current.

Examples

The following example shows the highest committed USN on a domain controller named dc1 for the contoso.com directory partition:

Copy Code
repadmin /showutdvec dc1 dc=contoso,dc=com

The following example shows the highest USN on the local domain controller for the mayberry.contoso.com directory partition, and orders the entries from least current to most current:

Copy Code
repadmin /showutdvec localhost dc=mayberry,dc=contoso,dc=com /latency

Additional references

Command-Line Syntax Key

Repadmin


Repadmin /syncall

Applies To: Windows Server 2003 with SP1,Windows Server 2008 R2,Windows Server 2008,Windows Server 2003 R2,Windows Server 2003 with SP2,Windows Server 2003

Synchronizes a specified domain controller with all of its replication partners.

By default, if no directory partition is provided in the <Naming Context> parameter, the command performs its operations on the configuration directory partition.

For examples of how to use this command, see Examples.

Syntax

Copy Code
repadmin /syncall <DSA> [<Naming Context>] [<flags>]

Parameters

Parameter Description

DSA

Specifies the host name of a domain controller. For detailed syntax, see Repadmin.

<Naming Context>

Specifies the distinguished name of the directory partition.

<flags>

The flags in the following list are supported.

  • /a Aborts, if any server is unavailable.

  • /A Synchronizes all naming contexts that are held on the home server.

  • /d Identifies servers by distinguished name in messages.

  • /e Synchronizes domain controllers across all sites in the enterprise. By default, this command does not synchronize domain controllers in other sites.

  • /h Displays Help.

  • /i Iterates indefinitely.

  • /I Runs the repadmin /showrepl command on each server pair in the path instead of synchronizing.

  • /j Synchronizes adjacent servers only.

  • /p Pauses after every message to allow the user to abort the command.

  • /P Pushes changes outward from the specified domain controller.

  • /q Runs in quiet mode, which suppresses call back messages.

  • /Q Runs in very quiet mode, which reports fatal errors only.

  • /s Does not synchronize.

  • /S Skips the initial server response check.

Examples

The following example synchronizes the target domain controller will all its partners, including domain controllers in other sites. The output displays the partners by their distinguished names, rather than their globally unique identifiers (GUIDs). This example aborts the command if any one partner is not available:

Copy Code
repadmin /syncall dst-dc01 dc=contoso,dc=com /d /e /a

Additional references

Command-Line Syntax Key

Repadmin


Replace

Applies To: Windows Vista,Windows Server 2008,Windows Server 2008 R2

Replaces files. If used with the /a option, replace adds new files to a directory instead of replacing existing files.

For examples of how to use this command, see Examples.

Syntax

Copy Code
replace [<Drive1>:][<Path1>]<FileName> [<Drive2>:][<Path2>] [/a] [/p] [/r] [/w]
replace [<Drive1>:][<Path1>]<FileName> [<Drive2>:][<Path2>] [/p] [/r] [/s] [/w] [/u]

Parameters

Parameter | Description
[<Drive1>:][<Path1>]<FileName> | Specifies the location and name of the source file or set of files. FileName is required, and can include wildcard characters (* and ?).
[<Drive2>:][<Path2>] | Specifies the location of the destination file. You cannot specify a file name for files you replace. If you do not specify a drive or path, replace uses the current drive and directory as the destination.
/a | Adds new files to the destination directory instead of replacing existing files. You cannot use this command-line option with the /s or /u command-line option.
/p | Prompts you for confirmation before replacing a destination file or adding a source file.
/r | Replaces Read-only and unprotected files. If you attempt to replace a Read-only file, but you do not specify /r, an error results and stops the replacement operation.
/w | Waits for you to insert a disk before the search for source files begins. If you do not specify /w, replace begins replacing or adding files immediately after you press ENTER.
/s | Searches all subdirectories in the destination directory and replaces matching files. You cannot use /s with the /a command-line option. The replace command does not search subdirectories that are specified in Path1.
/u | Replaces only those files on the destination directory that are older than those in the source directory. You cannot use /u with the /a command-line option.
/? | Displays help at the command prompt.

Remarks

  • As replace adds or replaces files, the file names are displayed on the screen. After replace is finished, a summary line is displayed in one of the following formats:

    Copy Code
    nnn files added
nnn files replaced
no file added
no file replaced
  • If you are using floppy disks and you need to switch disks during the replace operation, you can specify the /w command-line option so that replace will wait for you to switch the disks.

  • You cannot use replace to update hidden files or system files.

  • The following table shows each exit code and a brief description of its meaning:

    Exit code Description

    0

    The replace command successfully replaced or added the files.

    1

    The replace command encountered an incorrect version of MS-DOS.

    2

    The replace command could not find the source files.

    3

    The replace command could not find the source or destination path.

    5

    The user does not have access to the files that you want to replace.

    8

    There is insufficient system memory to carry out the command.

    11

    The user used the wrong syntax on the command line.

Note
You can use the ERRORLEVEL parameter on the if command line in a batch program to process exit codes that are returned by replace.

Examples

To update all the versions of a file named Phones.cli (which appear in multiple directories on drive C), with the latest version of the Phones.cli file from a floppy disk in drive A, type:

replace a:\phones.cli c:\ /s

Additional references

Command-Line Syntax Key


Reset session

Applies To: Windows Server 2008,Windows Vista

Enables you to reset (delete) a session on a terminal server.

For examples of how to use this command, see Examples.

Syntax

Copy Code
reset session {<SessionName> | <SessionID>} [/server:<ServerName>] [/v]

Parameters

Parameter | Description
<SessionName> | Specifies the name of the session that you want to reset. To determine the name of the session, use the query session command.
<SessionID> | Specifies the ID of the session to reset.
/server:<ServerName> | Specifies the terminal server containing the session that you want to reset. Otherwise, the current terminal server is used.
/v | Displays information about the actions being performed.
/? | Displays help at the command prompt.

Remarks

  • You can always reset your own sessions, but you must have Full Control access permission to reset another user's session.

  • Be aware that resetting a user's session without warning the user can result in the loss of data at the session.

  • You should reset a session only when it malfunctions or appears to have stopped responding.

  • The /server parameter is required only if you use reset session from a remote server.

Examples

  • To reset the session designated rdp-tcp#6, type:

    Copy Code
    reset session rdp-tcp#6
  • To reset the session that uses session ID 3, type:

    Copy Code
    reset session 3

Additional references

Command-Line Syntax Key

Terminal Services Command Reference


Rexec

Applies To: Windows Server 2003 with SP1,Windows XP,Windows Server 2003 R2,Windows Server 2003,Windows Server 2003 with SP2

Rexec is deprecated, and is not guaranteed to be supported in future releases of Windows.

This tool is included in Windows Server 2003. For more information see Rexec.


Rmdir

Applies To: Windows Vista,Windows Server 2008

This command is the same as the rd command. See Rd for syntax and parameters.


Robocopy

Applies To: Windows Server 2008 R2,Windows Server 2008

Copies file data.

Syntax

Copy Code
robocopy <Source> <Destination> [<File>[ ...]] [<Options>]

Parameters

Parameter | Description
<Source> | Specifies the path to the source directory.
<Destination> | Specifies the path to the destination directory.
<File> | Specifies the file or files to be copied. You can use wildcard characters (* or ?), if you want. If the File parameter is not specified, *.* is used as the default value.
<Options> | Specifies options to be used with the robocopy command.

Copy options

Option | Description
/s | Copies subdirectories. Note that this option excludes empty directories.
/e | Copies subdirectories. Note that this option includes empty directories. For additional information, see Remarks.
/lev:<N> | Copies only the top N levels of the source directory tree.
/z | Copies files in Restart mode.
/b | Copies files in Backup mode.
/zb | Uses Restart mode. If access is denied, this option uses Backup mode.
/efsraw | Copies all encrypted files in EFS RAW mode.
/copy:<CopyFlags> | Specifies the file properties to be copied. The following are the valid values for this option: D Data A Attributes T Time stamps S NTFS access control list (ACL) O Owner information U Auditing information The default value for CopyFlags is DAT (data, attributes, and time stamps).
/dcopy:T | Copies directory time stamps.
/sec | Copies files with security (equivalent to /copy:DAT).
/copyall | Copies all file information (equivalent to /copy:DATSOU).
/nocopy | Copies no file information (useful with /purge).
/secfix | Fixes file security on all files, even skipped ones.
/timfix | Fixes file times on all files, even skipped ones.
/purge | Deletes destination files and directories that no longer exist in the source. For additional information, see Remarks.
/mir | Mirrors a directory tree (equivalent to /e plus /purge). For additional information, see Remarks.
/mov | Moves files, and deletes them from the source after they are copied.
/move | Moves files and directories, and deletes them from the source after they are copied.
/a+:[RASHCNET] | Adds the specified attributes to copied files.
/a-:[RASHCNET] | Removes the specified attributes from copied files.
/create | Creates a directory tree and zero-length files only.
/fat | Creates destination files by using 8.3 character-length FAT file names only.
/256 | Turns off support for very long paths (longer than 256 characters).
/mon:<N> | Monitors the source, and runs again when more than N changes are detected.
/mot:<M> | Monitors source, and runs again in M minutes if changes are detected.
/rh:hhmm-hhmm | Specifies run times when new copies may be started.
/pf | Checks run times on a per-file (not per-pass) basis.
/ipg:n | Specifies the inter-packet gap to free bandwidth on slow lines.
/sl | Copies the symbolic link instead of the target.
Important
When using the /SECFIX copy option, specify the type of security information you want to copy by also using one of these additional copy options:

  • /COPYALL

  • /COPY:O

  • /COPY:S

  • /COPY:U

  • /SEC

File selection options

Option | Description
/a | Copies only files for which the Archive attribute is set.
/m | Copies only files for which the Archive attribute is set, and resets the Archive attribute.
/ia:[RASHCNETO] | Includes only files for which any of the specified attributes are set.
/xa:[RASHCNETO] | Excludes files for which any of the specified attributes are set.
/xf <FileName>[ ...] | Excludes files that match the specified names or paths. Note that FileName can include wildcard characters (* and ?).
/xd <Directory>[ ...] | Excludes directories that match the specified names and paths.
/xct | Excludes changed files.
/xn | Excludes newer files.
/xo | Excludes older files.
/xx | Excludes extra files and directories.
/xl | Excludes "lonely" files and directories.
/is | Includes the same files.
/it | Includes "tweaked" files.
/max:<N> | Specifies the maximum file size (to exclude files bigger than N bytes).
/min:<N> | Specifies the minimum file size (to exclude files smaller than N bytes).
/maxage:<N> | Specifies the maximum file age (to exclude files older than N days or date).
/minage:<N> | Specifies the minimum file age (exclude files newer than N days or date).
/maxlad:<N> | Specifies the maximum last access date (excludes files unused since N).
/minlad:<N> | Specifies the minimum last access date (excludes files used since N) If N is less than 1900, N specifies the number of days. Otherwise, N specifies a date in the format YYYYMMDD.
/xj | Excludes junction points, which are normally included by default.
/fft | Assumes FAT file times (two-second precision).
/dst | Compensates for one-hour DST time differences.
/xjd | Excludes junction points for directories.
/xjf | Excludes junction points for files.

Retry options

Option | Description
/r:<N> | Specifies the number of retries on failed copies. The default value of N is 1,000,000 (one million retries).
/w:<N> | Specifies the wait time between retries, in seconds. The default value of N is 30 (wait time 30 seconds).
/reg | Saves the values specified in the /r and /w options as default settings in the registry.
/tbd | Specifies that the system will wait for share names to be defined (retry error 67).

Logging options

Option | Description
/l | Specifies that files are to be listed only (and not copied, deleted, or time stamped).
/x | Reports all extra files, not just those that are selected.
/v | Produces verbose output, and shows all skipped files.
/ts | Includes source file time stamps in the output.
/fp | Includes the full path names of the files in the output.
/bytes | Prints sizes, as bytes.
/ns | Specifies that file sizes are not to be logged.
/nc | Specifies that file classes are not to be logged.
/nfl | Specifies that file names are not to be logged.
/ndl | Specifies that directory names are not to be logged.
/np | Specifies that the progress of the copying operation (the number of files or directories copied so far) will not be displayed.
/eta | Shows the estimated time of arrival (ETA) of the copied files.
/log:<LogFile> | Writes the status output to the log file (overwrites the existing log file).
/log+:<LogFile> | Writes the status output to the log file (appends the output to the existing log file).
/unicode | Displays the status output as Unicode text.
/unilog:<LogFile> | Writes the status output to the log file as Unicode text (overwrites the existing log file).
/unilog+:<LogFile> | Writes the status output to the log file as Unicode text (appends the output to the existing log file).
/tee | Writes the status output to the console window, as well as to the log file.
/njh | Specifies that there is no job header.
/njs | Specifies that there is no job summary.

Job options

Option | Description
/job:<JobName> | Specifies that parameters are to be derived from the named job file.
/save:<JobName> | Specifies that parameters are to be saved to the named job file.
/quit | Quits after processing command line (to view parameters)./nosd:
/nodd | Indicates that no destination directory is specified.
/if | Includes the specified files.

Remarks

  • The /mir option is equivalent to the /e plus /purge options with one small difference in behavior:

    • With the /e plus /purge options, if the destination directory exists, the destination directory security settings are not overwritten.

    • With the /mir option, if the destination directory exists, the destination directory security settings are overwritten.

Additional references

Command-Line Syntax Key


Route
See Also

Applies To: Windows Server 2003 R2,Windows 7,Windows Vista,Windows Server 2003,Windows Server 2000,Windows XP,Windows Server 2008 R2,Windows Server 2008

Route

Displays and modifies the entries in the local IP routing table. Used without parameters, route displays help.
Syntax

route [-f] [-p] [Command [Destination] [mask Netmask] [Gateway] [metric Metric]] [if Interface]]

Parameters
-f

Clears the routing table of all entries that are not host routes (routes with a netmask of 255.255.255.255), the loopback network route (routes with a destination of 127.0.0.0 and a netmask of 255.0.0.0), or a multicast route (routes with a destination of 224.0.0.0 and a netmask of 240.0.0.0). If this is used in conjunction with one of the commands (such as add, change, or delete), the table is cleared prior to running the command.

-p

When used with the add command, the specified route is added to the registry and is used to initialize the IP routing table whenever the TCP/IP protocol is started. By default, added routes are not preserved when the TCP/IP protocol is started. When used with the print command, the list of persistent routes is displayed. This parameter is ignored for all other commands. Persistent routes are stored in the registry location HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\PersistentRoutes.

Command

Specifies the command you want to run. The following table lists valid commands.

Command Purpose

add

Adds a route.

change

Modifies an existing route.

delete

Deletes a route or routes.

print

Prints a route or routes.
Destination

Specifies the network destination of the route. The destination can be an IP network address (where the host bits of the network address are set to 0), an IP address for a host route, or 0.0.0.0 for the default route.

mask Netmask

Specifies the netmask (also known as a subnet mask) associated with the network destination. The subnet mask can be the appropriate subnet mask for an IP network address, 255.255.255.255 for a host route, or 0.0.0.0 for the default route. If omitted, the subnet mask 255.255.255.255 is used. Because of the relationship between the destination and the subnet mask in defining routes, the destination cannot be more specific than its corresponding subnet mask. In other words, there cannot be a bit set to 1 in the destination if the corresponding bit in the subnet mask is a 0.

Gateway

Specifies the forwarding or next hop IP address over which the set of addresses defined by the network destination and subnet mask are reachable. For locally attached subnet routes, the gateway address is the IP address assigned to the interface that is attached to the subnet. For remote routes, available across one or more routers, the gateway address is a directly reachable IP address that is assigned to a neighboring router.

metric Metric

Specifies an integer cost metric (ranging from 1 to 9999) for the route, which is used when choosing among multiple routes in the routing table that most closely match the destination address of a packet being forwarded. The route with the lowest metric is chosen. The metric can reflect the number of hops, the speed of the path, path reliability, path throughput, or administrative properties.

if Interface

Specifies the interface index for the interface over which the destination is reachable. For a list of interfaces and their corresponding interface indexes, use the display of the route print command. You can use either decimal or hexadecimal values for the interface index. For hexadecimal values, precede the hexadecimal number with 0x. When the if parameter is omitted, the interface is determined from the gateway address.

/?

Displays help at the command prompt.

Remarks
  • Large values in the metric column of the routing table are the result of allowing TCP/IP to automatically determine the metric for routes in the routing table based on the configuration of IP address, subnet mask, and default gateway for each LAN interface. Automatic determination of the interface metric, enabled by default, determines the speed of each interface and adjusts the metrics of routes for each interface so that the fastest interface creates the routes with the lowest metric. To remove the large metrics, disable the automatic determination of the interface metric from the advanced properties of the TCP/IP protocol for each LAN connection.

  • Names can be used for Destination if an appropriate entry exists in the local Networks file stored in the systemroot\System32\Drivers\Etc folder. Names can be used for the gateway as long as they can be resolved to an IP address through standard host name resolution techniques such as Domain Name System (DNS) queries, use of the local Hosts file stored in the systemroot\system32\drivers\etc folder, and NetBIOS name resolution.

  • If the command is print or delete, the Gateway parameter can be omitted and wildcards can be used for the destination and gateway. The Destination value can be a wildcard value specified by an asterisk (*). If the destination specified contains an asterisk (*) or a question mark (?), it is treated as a wildcard and only matching destination routes are printed or deleted. The asterisk matches any string, and the question mark matches any single character. For example, 10.*.1, 192.168.*, 127.*, and *224* are all valid uses of the asterisk wildcard.

  • Using an invalid combination of a destination and subnet mask (netmask) value displays a "Route: bad gateway address netmask" error message. This error message appears when the destination contains one or more bits set to 1 in bit locations where the corresponding subnet mask bit is set to 0. To test this condition, express the destination and subnet mask using binary notation. The subnet mask in binary notation consists of a series of 1 bits, representing the network address portion of the destination, and a series of 0 bits, representing the host address portion of the destination. Check to determine whether there are bits in the destination that are set to 1 for the portion of the destination that is the host address (as defined by the subnet mask).

  • The -p parameter is only supported on the route command for Windows NT 4.0, Windows 2000, Windows Millennium Edition, Windows XP, and the Windows Server 2003 family. This parameter is not supported by the route command for Windows 95 or Windows 98.

  • This command is available only if the Internet Protocol (TCP/IP) protocol is installed as a component in the properties of a network adapter in Network Connections.

Examples

To display the entire contents of the IP routing table, type:

route print

To display the routes in the IP routing table that begin with 10., type:

route print 10.*

To add a default route with the default gateway address of 192.168.12.1, type:

route add 0.0.0.0 mask 0.0.0.0 192.168.12.1

To add a route to the destination 10.41.0.0 with the subnet mask of 255.255.0.0 and the next hop address of 10.27.0.1, type:

route add 10.41.0.0 mask 255.255.0.0 10.27.0.1

To add a persistent route to the destination 10.41.0.0 with the subnet mask of 255.255.0.0 and the next hop address of 10.27.0.1, type:

route -p add 10.41.0.0 mask 255.255.0.0 10.27.0.1

To add a route to the destination 10.41.0.0 with the subnet mask of 255.255.0.0, the next hop address of 10.27.0.1, and the cost metric of 7, type:

route add 10.41.0.0 mask 255.255.0.0 10.27.0.1 metric 7

To add a route to the destination 10.41.0.0 with the subnet mask of 255.255.0.0, the next hop address of 10.27.0.1, and using the interface index 0x3, type:

route add 10.41.0.0 mask 255.255.0.0 10.27.0.1 if 0x3

To delete the route to the destination 10.41.0.0 with the subnet mask of 255.255.0.0, type:

route delete 10.41.0.0 mask 255.255.0.0

To delete all routes in the IP routing table that begin with 10., type:

route delete 10.*

To change the next hop address of the route with the destination of 10.41.0.0 and the subnet mask of 255.255.0.0 from 10.27.0.1 to 10.27.0.25, type:

route change 10.41.0.0 mask 255.255.0.0 10.27.0.25

Formatting legend

Format | Meaning
Italic | Information that the user must supply
Bold | Elements that the user must type exactly as shown
Ellipsis (...) | Parameter that can be repeated several times in a command line
Between brackets ([]) | Optional items
Between braces ({}); choices separated by pipe (|). Example: {even|odd} | Set of choices from which the user must choose only one
Courier font | Code or program output

See Also

Command-line reference A-ZCommand shell overviewTCP/IP utilities and servicesThe IP routing table


Rsh

Applies To: Windows Server 2008,Windows Server 2008 R2

Runs commands on remote computers running the RSH service or daemon. This command has been deprecated. You can install the Subsystem for UNIX-based Applications using the Add Features Wizard. For more information, see Windows Server 2008 UNIX Interoperability Components at the Microsoft Web site. After installation, you can then open a C Shell or Korn Shell command window and run rsh. For more information, type man rsh at the C Shell or Korn Shell prompt.


Runas

Applies To: Windows Server 2008,Windows HPC Server 2008 R2,Windows XP,Windows Server 2003 with SP1,Windows Vista,Windows Server 2003,Windows Server 2000,Windows Server 2003 R2,Windows 7

Allows a user to run specific tools and programs with different permissions than the user's current logon provides.

Runas is a command-line tool that is built into Windows Vista. To use runas at the command line, open a command prompt, type runas with the appropriate parameters, and then press ENTER.

In the user interface for Windows Vista, the Run as… command has been changed to Run as administrator. However, you should rarely have to use the Run as administrator command because Windows Vista will automatically prompt you for an administrator password when it is needed.

For examples of how this command can be used, see Examples.

Syntax

Copy Code
runas [{/profile | /noprofile}] [/env] [{/netonly | /savecred}] [/smartcard] [/showtrustlevels] [/trustlevel] /user:<UserAccountName> "<ProgramName> <PathToProgramFile>"

Parameters

Parameter | Description
/profile | Loads the user's profile. This is the default. This parameter cannot be used with the /netonly parameter.
/no profile | Specifies that the user's profile is not to be loaded. This allows the application to load more quickly, but it can also cause a malfunction in some applications.
/env | Specifies that the current network environment be used instead of the user's local environment.
/netonly | Indicates that the user information specified is for remote access only. This parameter cannot be used with the /profile parameter.
/savecred | Indicates if the credentials have been previously saved by this user. This parameter is not available and will be ignored on Windows Vista Home or Windows Vista Starter Editions. This parameter cannot be used with the /smartcard parameter.
/smartcard | Indicates whether the credentials are to be supplied from a smartcard. This parameter cannot be used with the /savecred parameter.
/showtrustlevels | Displays the trust levels that can be used as arguments to /trustlevel.
/trustlevel | Specifies the level of authorization at which the application is to run. Use /showtrustlevels to see the trust levels available.
/user:<UserAccountName> "<ProgramName> <PathToProgramFile>" | Specifies the name of the user account under which to run the program, the program name, and the path to the program file. The user account name format should be <User>@<Domain> or <Domain>\<UserAccountName>.
/? | Displays help at the command prompt.

Remarks

  • Enter the user's password only when prompted.

  • It is good practice for administrators to use an account with restrictive permissions to perform routine, nonadministrative tasks, and to use an account with broader permissions only when performing specific administrative tasks. To accomplish this without logging off and back on, log on with a regular user account, and then use the runas command to run the tools that require the broader permissions.

  • The use of runas is not restricted to administrator accounts, although that is the most common use. Any user with multiple accounts can use runas to run a program, MMC console, or Control Panel item with alternate credentials.

  • If you want to use the Administrator account on your computer, for the /user: parameter, type one of the following:

    /user:<AdministratorAccountName>@<ComputerName>

    /user:<ComputerName>\<AdministratorAccountName>

  • If you want to use this command as a domain administrator, type one of the following:

    /user:<AdministratorAccountName>@<DomainName>

    /user:<DomainName>\<AdministratorAccountName>

  • With the runas command, you can run programs (*.exe), saved MMC consoles (*.msc), shortcuts to programs and saved MMC consoles, and Control Panel items. You can run them as an administrator while you are logged on to your computer as a member of another group, such as the Users or Power Users group.

  • You can use the runas command to start any program, MMC console, or Control Panel item. As long as you provide the appropriate user account and password information, the user account has the ability to log on to the computer, and the program, MMC console, or Control Panel item is available on the system and to the user account.

  • With the runas command, you can administer a server in another domain or forest (the computer from which you run a tool and the server you administer are in different domains or forests).

  • If you try to start a program, MMC console, or Control Panel item from a network location using runas, it might fail because the credentials used to connect to the shared network resource are different from the credentials used to start the program. The latter credentials may not be able to gain access to the same shared network resource.

  • Some items, such as the Printers folder and desktop items, are opened indirectly and cannot be started with the runas command.

  • If the runas command fails, the Secondary Logon service might not be running or the user account you are using might not be valid. To check the status of the Secondary Logon service, in Computer Management, click Services and Applications, and then click Services. To test the user account, try logging on to the appropriate domain using the account.

Examples

The following command starts an instance of the command prompt as an administrator on the local computer:

Copy Code
runas /user:<localmachinename>\administrator cmd

When prompted, type the administrator account password.

The following command starts an instance of the Computer Management snap-in using a domain administrator account called contoso\domainadmin:

Copy Code
runas /user:contoso\domainadmin "mmc %windir%\system32\compmgmt.msc"

When prompted, type the domain administrator account password.

The following command starts an instance of Notepad (and a file named my_file.txt) using a domain administrator account called jayj in a domain called domain.contoso.com:

Copy Code
runas /user:jayj@domain.contoso.com "notepad my_file.txt"

When prompted, type the domain administrator account password.

The following command starts an instance of a command prompt window, saved MMC console, Control Panel item, or program that will administer a server in another forest:

Copy Code
runas /netonly /user:<Domain>\<User_Name> "<Command>"

<Domain>\<User_Name> must be a user with sufficient permissions to administer the server. When prompted, type the account password.

Additional references

Command-Line Syntax Key


Rpcinfo

Applies To: Windows Server 2008,Windows Vista

You can use rpcinfo to list programs on remote computers.

Syntax

List all programs registered with the port mapper:

rpcinfo -p [Node]

Request a response from network nodes that have a specified program:

rpcinfo -b Program Version

Use Transmission Control Protocol (TCP) to call a program:

rpcinfo -t Node Program [Version]

Use User Datagram Protocol (UDP) to call a program:

rpcinfo -u Node Program [Version]

Description

The rpcinfo command-line utility makes a remote procedure call (RPC) to an RPC server and reports what it finds.

The rpcinfo utility accepts the following options:

-p [Node]

Lists all programs registered with the port mapper on the specified host. If you do not specify a node (computer) name, the program queries the port mapper on the local host.

-b Program Version

Requests a response from all network nodes that have the specified program and version registered with the port mapper. You must specify both a program name or number and a version number.

-t Node Program [Version]

Uses the TCP transport protocol to call the specified program. You must specify both a node (computer) name and a program name. If you do not specify a version, the program calls all versions.

-u Node Program [Version]

Uses the UDP transport protocol to call the specified program. You must specify both a node (computer) name and a program name. If you do not specify a version, the program calls all versions.


Rwinsta

Applies To: Windows Vista,Windows Server 2008

Enables you to reset (delete) a session on a terminal server.

Remarks

This command is the same as the reset session command.

Additional references

Reset session

Command-Line Syntax Key

Terminal Services Command Reference


Sc

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Server 2003 with SP1,Windows Vista,Windows Server 2003,Windows Server 2003 with SP2,Windows Server 2003 R2,Windows 7

Communicates with the Service Controller and installed services. The SC.exe program provides capabilities similar to those provided in Services in the Control Panel.

For the syntax of any of the commands in the following table, click the command name.

Sc Commands

Sc command | Description
Sc boot | Indicates whether the last boot should be saved as the last-known good boot configuration.
Sc config | Modifies the value of a service's entries in the registry and in the Service Control Manager database.
Sc continue | Sends a CONTINUE control request to a paused service.
Sc control | Sends a control to a service.
Sc create | Creates a subkey and entries for the service in the registry and in the Service Control Manager database.
Sc delete | Deletes a service subkey from the registry.
Sc description | Sets the description string for a service.
Sc enumdepend | Lists the services that cannot run unless the specified service is running.
Sc failure | Specifies one or more actions to be taken if a particular service fails.
Sc failureflag | Specifies whether to trigger recovery actions when a service stops as the result of an error.
Sc getdisplayname | Gets the display name associated with a particular service.
Sc getkeyname | Gets the key name associated with a particular service, using the display name as input.
Sc interrogate | Sends an INTERROGATE control request to a service.
Sc lock | Locks the Service Control Manager's database.
Sc pause | Sends a PAUSE control request to a service.
Sc qc | Queries the configuration information for a service.
Sc qdescription | Displays a service's description string.
Sc qfailure | Displays the actions that will be performed if the specified service fails.
Sc query | Obtains and displays information about the specified service, driver, type of service, or type of driver.
Sc queryex | Obtains and displays detailed information about the specified service, driver, type of service, or type of driver.
Sc querylock | Queries and displays the lock status for the Service Control Manager database.
Sc sdset | Sets a service's security descriptor, using Security Descriptor Definition Language (SDDL).
Sc sdshow | Displays a service's security descriptor, using SDDL.
Sc start | Starts a service.
Sc stop | Sends a STOP control request to a service.

Remarks

  • SC.exe retrieves and sets control information about services.

  • You can use SC.exe for testing and debugging service programs.

  • Service properties stored in the registry can be set to control how service applications are started at boot time and can be run as background processes.

  • You can use the SC.exe parameters to configure a specific service, retrieve the current status of a service, and stop and start a service.

  • You can create batch files that call various SC.exe commands to automate the startup or shutdown sequence of services.

Additional references

Command-Line Syntax Key


Sc boot

Applies To: Windows Server 2003 R2,Windows 7,Windows Server 2003 with SP2,Windows Server 2003,Windows Vista,Windows Server 2003 with SP1,Windows Server 2008,Windows Server 2008 R2

Indicates whether the last boot should be saved as the last-known good boot configuration.

For examples of how to use this command, see Examples.

Syntax

Copy Code
sc [<ServerName>] boot [{bad | ok}]

Parameters

Parameter | Description
<ServerName> | Specifies the name of the remote server on which the service is located. The name must use the Universal Naming Convention (UNC) format (for example, \\myserver). To run SC.exe locally, omit this parameter.
{bad | ok} | Specifies whether the last boot was bad or whether it should be saved as the last-known good boot configuration.
? | Displays help at the command prompt.

Examples

To mark the last boot as the last-known good boot configuration, type:

Copy Code
sc boot ok

To mark the last boot as bad, type:

Copy Code
sc boot bad

Additional references

Command-Line Syntax Key


Sc config

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Server 2003 with SP1,Windows Server 2003,Windows Vista,Windows Server 2003 with SP2,Windows 7,Windows Server 2003 R2

Modifies the value of a service's entries in the registry and in the Service Control Manager database.

For examples of how to use this command, see Examples.

Syntax

Copy Code
sc [<ServerName>] config [<ServiceName>] [type= {own | share | kernel | filesys | rec | adapt | interact type= {own | share}}] [start= {boot | system | auto | demand | disabled | delayed-auto}] [error= {normal | severe | critical | ignore}] [binpath= <BinaryPathName>] [group= <LoadOrderGroup>] [tag= {yes | no}] [depend= <dependencies>] [obj= {<AccountName> | <ObjectName>}] [displayname= <DisplayName>] [password= <Password>]

Parameters

Parameter Description

<ServerName>

Specifies the name of the remote server on which the service is located. The name must use the Universal Naming Convention (UNC) format (for example, \\myserver). To run SC.exe locally, omit this parameter.

<ServiceName>

Specifies the service name returned by the getkeyname operation.

type= {own | share | kernel | filesys | rec | adapt | interact type= {own | share}}

Specifies the service type.

own - Specifies a service that runs in its own process. It does not share an executable file with other services. This is the default value.

share - Specifies a service that runs as a shared process. It shares an executable file with other services.

kernel - Specifies a driver.

filesys - Specifies a file system driver.

rec - Specifies a file system-recognized driver that identifies file systems used on the computer.

adapt - Specifies an adapter driver that identifies hardware devices such as keyboards, mice, and disk drives.

interact - Specifies a service that can interact with the desktop, receiving input from users. Interactive services must be run under the LocalSystem account. This type must be used in conjunction with type= own or type= shared (for example, type= interact type= own). Using type= interact by itself will generate an error.

start= {boot | system | auto | demand | disabled | delayed-auto}

Specifies the start type for the service.

boot - Specifies a device driver that is loaded by the boot loader.

system - Specifies a device driver that is started during kernel initialization.

auto - Specifies a service that automatically starts each time the computer is restarted and runs even if no one logs on to the computer.

demand - Specifies a service that must be started manually. This is the default value if start= is not specified.

disabled - Specifies a service that cannot be started. To start a disabled service, change the start type to some other value.

delayed-auto - Specifies a service that starts automatically a short time after other auto services are started.

error= {normal | severe | critical | ignore}

Specifies the severity of the error if the service fails to start at boot time.

normal - Specifies that the error is logged and a message box is displayed, informing the user that a service has failed to start. Startup will continue. This is the default setting.

severe - Specifies that the error is logged (if possible). The computer attempts to restart with the last-known good configuration. This could result in the computer being able to restart, but the service may still be unable to run.

critical - Specifies that the error is logged (if possible). The computer attempts to restart with the last-known good configuration. If the last-known good configuration fails, startup also fails, and the boot process halts with a Stop error.

ignore - Specifies that the error is logged and startup continues. No notification is given to the user beyond recording the error in the Event Log.

binpath= <BinaryPathName>

Specifies a path to the service binary file.

group= <LoadOrderGroup>

Specifies the name of the group of which this service is a member. The list of groups is stored in the registry, in the HKLM\System\CurrentControlSet\Control\ServiceGroupOrder subkey. The default value is null.

tag= {yes | no}

Specifies whether or not to obtain a TagID from the CreateService call. Tags are used only for boot-start and system-start drivers.

depend= <dependencies>

Specifies the names of services or groups that must start before this service. The names are separated by forward slashes (/).

obj= {<AccountName> | <ObjectName>}

Specifies a name of an account in which a service will run, or specifies a name of the Windows driver object in which the driver will run. The default setting is LocalSystem.

displayname= <DisplayName>

Specifies a descriptive name for identifying the service in user interface programs. For example, the subkey name of one particular service is wuauserv, which has a more friendly display name of Automatic Updates.

password= <Password>

Specifies a password. This is required if an account other than the LocalSystem account is used.

/?

Displays help at the command prompt.

Remarks

  • For each command-line option (parameter), the equal sign is part of the option name.

  • A space is required between an option and its value (for example, type= own. If the space is omitted, the operation will fail.

Examples

To specify a binary path for the NEWSERVICE service, type:

Copy Code
sc config NewService binpath= "ntsd -d c:\windows\system32\NewServ.exe"

Additional references

Command-Line Syntax Key


Sc continue

Applies To: Windows Server 2003 R2,Windows 7,Windows Server 2003 with SP2,Windows Server 2003,Windows Vista,Windows Server 2003 with SP1,Windows Server 2008,Windows Server 2008 R2

Resumes a paused service by sending a CONTINUE control request to the service.

For examples of how to use this command, see Examples.

Syntax

Copy Code
sc [<ServerName>] continue [<ServiceName>]

Parameters

Parameter | Description
<ServerName> | Specifies the name of the remote server on which the service is located. The name must use the Universal Naming Convention (UNC) format (for example, \\myserver). To run SC.exe locally, omit this parameter.
<ServiceName> | Specifies the service name returned by the getkeyname operation.
/? | Displays help at the command prompt.

Examples

To continue the TAPISRV service if it is currently paused, type:

Copy Code
sc continue tapisrv

Additional references

Command-Line Syntax Key


Sc control

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Server 2003 with SP1,Windows Vista,Windows Server 2003,Windows Server 2003 with SP2,Windows 7,Windows Server 2003 R2

Sends a control to a service.

Syntax

Copy Code
sc [<ServerName>] control [<ServiceName>] [{paramchange | netbindadd | netbindremove | netbindenable | netbinddisable | <UserDefinedControlB>}]

Parameters

Parameter | Description
<ServerName> | Specifies the name of the remote server on which the service is located. The name must use the Universal Naming Convention (UNC) format (for example, \\myserver). To run SC.exe locally, omit this parameter.
<ServiceName> | Specifies the service name returned by the getkeyname operation.
{paramchange | netbindadd | netbindremove | netbindenable | netbinddisable | <UserDefinedControlB>} | Specifies a control to be sent to a service.
/? | Displays help at the command prompt.

Additional references

Command-Line Syntax Key


Sc create

Applies To: Windows Server 2003 R2,Windows 7,Windows Server 2003 with SP2,Windows Server 2003,Windows Vista,Windows Server 2003 with SP1,Windows Server 2008,Windows Server 2008 R2

Creates a subkey and entries for a service in the registry and in the Service Control Manager database.

For examples of how to use this command, see Examples.

Syntax

Copy Code
sc [<ServerName>] create [<ServiceName>] [type= {own | share | kernel | filesys | rec | interact type= {own | share}}] [start= {boot | system | auto | demand | disabled}] [error= {normal | severe | critical | ignore}] [binpath= <BinaryPathName>] [group= <LoadOrderGroup>] [tag= {yes | no}] [depend= <dependencies>] [obj= {<AccountName> | <ObjectName>}] [displayname= <DisplayName>] [password= <Password>]

Parameters

Parameter Description

<ServerName>

Specifies the name of the remote server on which the service is located. The name must use the Universal Naming Convention (UNC) format (for example, \\myserver). To run SC.exe locally, omit this parameter.

<ServiceName>

Specifies the service name returned by the getkeyname operation.

type= {own | share | kernel | filesys | rec | interact type= {own | share}}

Specifies the service type. The default setting is type= own.

own - Specifies that the service runs in its own process. It does not share an executable file with other services. This is the default setting.

share - Specifies that the service runs as a shared process. It shares an executable file with other services.

kernel - Specifies a driver.

filesys - Specifies a file system driver.

rec - Specifies a file system recognized driver (identifies file systems used on the computer).

interact - Specifies that the service can interact with the desktop, receiving input from users. Interactive services must be run under the LocalSystem account. This type must be used in conjunction with type= own or type= shared. Using type= interact by itself will generate an "invalid parameter" error.

start= {boot | system | auto | demand | disabled}

Specifies the start type for the service. The default setting is start= demand.

boot - Specifies a device driver that is loaded by the boot loader.

system - Specifies a device driver that is started during kernel initialization.

auto - Specifies a service that automatically starts each time the computer is restarted. Note that the service runs even if no one logs on to the computer.

demand - Specifies a service that must be started manually. This is the default value if start= is not specified.

disabled - Specifies a service that cannot be started. To start a disabled service, change the start type to some other value.

error= {normal | severe | critical | ignore}

Specifies the severity of the error if the service fails when the computer is started. The default setting is error= normal.

normal - Specifies that the error is logged. A message box is displayed, informing the user that a service has failed to start. Startup will continue. This is the default setting.

severe - Specifies that the error is logged (if possible). The computer attempts to restart with the last-known good configuration. This could result in the computer being able to restart, but the service may still be unable to run.

critical - Specifies that the error is logged (if possible). The computer attempts to restart with the last-known good configuration. If the last-known good configuration fails, startup also fails, and the boot process halts with a Stop error.

ignore - Specifies that the error is logged and startup continues. No notification is given to the user beyond recording the error in the event log.

binpath= <BinaryPathName>

Specifies a path to the service binary file. There is no default for binpath=, and this string must be supplied.

group= <LoadOrderGroup>

Specifies the name of the group of which this service is a member. The list of groups is stored in the registry in the HKLM\System\CurrentControlSet\Control\ServiceGroupOrder subkey. The default value is null.

tag= {yes | no}

Specifies whether or not a TagID is to be obtained from the CreateService call. Tags are used only for boot-start and system-start drivers.

depend= <dependencies>

Specifies the names of services or groups that must start before this service starts. The names are separated by forward slashes (/).

obj= {<AccountName> | <ObjectName>}

Specifies the name of an account in which a service will run, or specifies a name of the Windows driver object in which the driver will run.

displayname= <DisplayName>

Specifies a friendly name that can be used by user interface programs to identify the service.

password= <Password>

Specifies a password. This is required if an account other than LocalSystem is used.

/?

Displays help at the command prompt.

Remarks

  • For each command-line option, the equal sign is part of the option name.

  • A space is required between an option and its value (for example, type= own. If the space is omitted the operation will fail.

Examples

The following examples show how you can use the sc create command:

Copy Code
sc \\myserver create NewService binpath= c:\windows\system32\NewServ.exe
sc create NewService binpath= c:\windows\system32\NewServ.exe type= share start= auto depend= "+TDI Netbios"

Additional references

Command-Line Syntax Key


Sc delete

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Server 2003 with SP1,Windows Vista,Windows Server 2003,Windows Server 2003 with SP2,Windows Server 2003 R2,Windows 7

Deletes a service subkey from the registry. If the service is running or if another process has an open handle to the service, the service is marked for deletion.

For examples of how to use this command, see Examples.

Syntax

Copy Code
sc [<ServerName>] delete [<ServiceName>]

Parameters

Parameter | Description
<ServerName> | Specifies the name of the remote server on which the service is located. The name must use the Universal Naming Convention (UNC) format (for example, \\myserver). To run SC.exe locally, omit this parameter.
<ServiceName> | Specifies the service name returned by the getkeyname operation.
? | Displays help at the command prompt.

Remarks

Use Add or Remove Programs on Control Panel to delete DHCP, DNS, or any other built-in operating system services. Note that Add or Remove Programs will not only remove the registry subkey for the service, but it will also uninstall the service and delete any shortcuts to it.

Examples

To delete the service subkey NewServ from the registry on the local computer, type:

Copy Code
sc delete newserv

Additional references

Command-Line Syntax Key


Sc description

Applies To: Windows Server 2003 R2,Windows 7,Windows Server 2003 with SP2,Windows Vista,Windows Server 2003,Windows Server 2003 with SP1,Windows Server 2008,Windows Server 2008 R2

Sets the description string for a service.

For examples of how to use this command, see Examples.

Syntax

Copy Code
sc [<ServerName>] description [<ServiceName>] [<Description>]

Parameters

Parameter | Description
<ServerName> | Specifies the name of the remote server on which the service is located. The name must use the Universal Naming Convention (UNC) format (for example, \\myserver). To run SC.exe locally, omit this parameter.
<ServiceName> | Specifies the service name returned by the getkeyname operation.
<Description> | Specifies a description for the specified service. If no string is specified, the description of the service is not modified. There is no limit to the number of characters in the service description.
/? | Displays help at the command prompt.

Examples

To add the description "Runs diagnostic of service control" to the NewServ service on the local computer, type:

Copy Code
sc description newserv "Runs diagnostic of service control."

Additional references

Command-Line Syntax Key


Sc enumdepend

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Server 2003 with SP1,Windows Server 2003,Windows Vista,Windows Server 2003 with SP2,Windows 7,Windows Server 2003 R2

Lists the services that depend on the specified service.

For examples of how to use this command, see Examples.

Syntax

Copy Code
sc [<ServerName>] enumdepend [<ServiceName>] [<BufferSize>]

Parameters

Parameter | Description
<ServerName> | Specifies the name of the remote server on which the service is located. The name must use the Universal Naming Convention (UNC) format (for example, \\myserver). To run SC.exe locally, omit this parameter.
<ServiceName> | Specifies the service name returned by the getkeyname operation.
<BufferSize> | Specifies the size (in bytes) of the enumeration buffer. The default buffer size is 1,024 bytes.
/? | Displays help at the command prompt.

Remarks

If the buffer is not big enough, the enumdepend command will display dependencies only partially, and it will specify the additional buffer size required to display all dependencies. If the output is truncated, rerun the operation and specify the larger buffer size.

Examples

To list the local services that will not run unless the TAPISRV service is running, type:

Copy Code
sc enumdepend tapisrv

For the next example, suppose that the following message is displayed after you run the sc enumdepend rpcss command:

Copy Code
[SC] EnumDependentServices: more data, need 6971 bytes

To list the local services that depend on the RPCSS service, and to specify a buffer size of 6,971 bytes, type:

Copy Code
sc enumdepend rpcss 6971

Additional references

Command-Line Syntax Key


Sc failure

Applies To: Windows Server 2003 R2,Windows 7,Windows Server 2003 with SP2,Windows Server 2003,Windows Vista,Windows Server 2003 with SP1,Windows Server 2008,Windows Server 2008 R2

Specifies one or more actions to take if a service fails.

For examples of how to use this command, see Examples.

Syntax

Copy Code
sc [<ServerName>] failure [<ServiceName>] [reset= <ErrorFreePeriod>] [reboot= <BroadcastMessage>] [command= <CommandLine>] [actions= {"" | {[run/<MS>] | [restart/<MS>] | [reboot/<MS>]}[/...]]

Parameters

Parameter | Description
<ServerName> | Specifies the name of the remote server on which the service is located. The name must use the Universal Naming Convention (UNC) format (for example, \\myserver). To run SC.exe locally, omit this parameter.
<ServiceName> | Specifies the service name returned by the getkeyname operation.
reset= <ErrorFreePeriod> | Specifies the length of the period (in seconds) with no failures after which the failure count should be reset to 0 (zero). Note that this parameter requires the actions= parameter.
reboot= <BroadcastMessage> | Specifies the message to be broadcast when a service fails.
command= <CommandLine> | Specifies the command-line command to be run when the specified service fails. For more information about how to run a batch or VBS file on failure, see Remarks.
actions= {"" | {[run/<MS>] | [restart/<MS>] | [reboot/<MS>]}[/...] | Specifies one or more failure actions and their delay times (in milliseconds), separated by a forward slash (/). Valid actions are run, restart, and reboot. If more than one action is specified, each action must be separated by a forward slash. Use actions= "" to take no action a service fails. Note that this parameter requires the reset= parameter.
/? | Displays help at the command prompt.

Remarks

  • Not all services allow changes to their failure options. Some run as part of a service set.

  • To run a batch file when a service fails, specify command= Cmd.exe Drive:\FileName.bat, where Drive:\FileName.bat is the fully qualified name of the batch file.

  • To run a VBS file when a service fails, specify command= Cscript Drive:\MyScript.vbs, where Drive:\MyScript.vbs is the fully qualified name of the script file.

  • You can specify up to three separate actions with the actions= parameter, to be used the first, second, and third times that a service fails.

  • For each command-line option (parameter), the equal sign is part of the option name.

  • A space is required between an option and its value (for example, actions= restart). If the space is omitted, the operation will fail.

Examples

The following examples show how you can use the sc failure command:

Copy Code
sc failure msftpsvc reset= 30 actions= restart/5000
sc failure dfs reset= 60 command= c:\windows\services\restart_dfs.exe actions= run/5000
sc failure dfs reset= 60 actions= reboot/30000
sc failure dfs reset= 60 reboot= "The Distributed File System service has failed. Because of this, the computer will reboot in 30 seconds."  actions= reboot/30000
sc failure myservice reset= 3600 reboot= "MyService crashed -- rebooting machine" command= "%windir%\MyServiceRecovery.exe" actions= restart/5000/run/10000/reboot/60000

Additional references

Command-Line Syntax Key


Sc failureflag

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Server 2003 with SP1,Windows Vista,Windows Server 2003,Windows Server 2003 with SP2,Windows 7,Windows Server 2003 R2

Specifies whether recovery actions will be triggered when a service stops as the result of an error.

For examples of how to use this command, see Examples.

Syntax

Copy Code
sc [<ServerName>] failureflag [<ServiceName>] [<Flag>]

Parameters

Parameter | Description
<ServerName> | Specifies the name of the remote server on which the service is located. The name must use the Universal Naming Convention (UNC) format (for example, \\myserver). To run SC.exe locally, omit this parameter.
<ServiceName> | Specifies the service name returned by the getkeyname operation.
<Flag> | The default value is 0 (no action). If this parameter is set to 1, and if the user has already configured recovery actions for service failures, the recovery actions will also be triggered if the service stops because of an error.
/? | Displays help at the command prompt.

Remarks

Set this flag if your service fails but can usually be restarted without any problem.

Examples

To trigger an existing recovery action for service failures, type:

Copy Code
sc failureflag flag=1

Additional references

Command-Line Syntax Key


Sc getdisplayname

Applies To: Windows Server 2003 R2,Windows 7,Windows Server 2003 with SP2,Windows Server 2003,Windows Vista,Windows Server 2003 with SP1,Windows Server 2008,Windows Server 2008 R2

Gets the display name associated with a particular service.

For examples of how to use this command, see Examples.

Syntax

Copy Code
sc [<ServerName>] getdisplayname [<ServiceName>] [<BufferSize>]

Parameters

Parameter | Description
<ServerName> | Specifies the name of the remote server on which the service is located. The name must use the Universal Naming Convention (UNC) format (for example, \\myserver). To run SC.exe locally, omit this parameter.
<ServiceName> | Specifies the service name returned by the getkeyname operation.
<BufferSize> | Specifies the size (in bytes) of the buffer. The default buffer size is 1,024 bytes.
/? | Displays help at the command prompt.

Examples

To get the display name associated with the TAPISRV service, type:

Copy Code
sc getdisplayname tapisrv

Output similar to the following is displayed:

Copy Code
[SC] GetServiceDisplayName SUCCESS
Name = Telephony

To get the display name associated with the SHAREDACCESS service, type:

Copy Code
sc getdisplayname sharedaccess

Output similar to the following is displayed:

Copy Code
[SC] GetServiceDisplayName SUCCESS
Name = Internet Connection Sharing (ICS)
Note
If sc getdisplayname cannot find the specified service, the following error message is displayed:

Copy Code
[SC] GetServiceDisplayName FAILED 1060:
The specified service does not exist as an installed service.

Additional references

Command-Line Syntax Key


Sc getkeyname

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Server 2003 with SP1,Windows Server 2003,Windows Vista,Windows Server 2003 with SP2,Windows 7,Windows Server 2003 R2

Gets the key name associated with a particular service, using the display name as input.

For examples of how to use this command, see Examples.

Syntax

Copy Code
sc [<ServerName>] getkeyname [<ServiceDisplayName>] [<BufferSize>]

Parameters

Parameter | Description
<ServerName> | Specifies the name of the remote server on which the service is located. The name must use the Universal Naming Convention (UNC) format (for example, \\myserver). To run SC.exe locally, omit this parameter.
<ServiceDisplayName> | Specifies the display name of the service.
<BufferSize> | Specifies the size (in bytes) of the buffer. The default buffer size is 1,024 bytes.
/? | Displays help at the command prompt.

Remarks

  • If ServiceDisplayName contains spaces, enclose the text in quotation marks (for example, "internet connection sharing").

  • ServiceDisplayName is not case-sensitive.

Examples

To get the key name associated with the service whose display name is "Remote Procedure Call (RPC)," type:

Copy Code
sc getkeyname "remote procedure call (rpc)"

To get the key name associated with the service whose display name is "Internet Connection Sharing (ICS)," type:

Copy Code
sc getkeyname "internet connection sharing"

To get the key name associated with the service whose display name is "Clipbook," type:

Copy Code
sc getkeyname clipbook

Additional references

Command-Line Syntax Key


Sc interrogate

Applies To: Windows Server 2003 R2,Windows 7,Windows Server 2003 with SP2,Windows Vista,Windows Server 2003,Windows Server 2003 with SP1,Windows Server 2008,Windows Server 2008 R2

Sends an INTERROGATE control request to a service.

For examples of how to use this command, see Examples.

Syntax

Copy Code
sc [<ServerName>] interrogate [<ServiceName>]

Parameters

Parameter | Description
<ServerName> | Specifies the name of the remote server on which the service is located. The name must use the Universal Naming Convention (UNC) format (for example, \\myserver). To run SC.exe locally, omit this parameter.
<ServiceName> | Specifies the service name returned by the getkeyname operation.
/? | Displays help at the command prompt.

Remarks

Sending INTERROGATE to a service causes the service to update its status with the Service Control Manager.

Examples

To update the status of the RPCSS service with the Service Control Manager, type:

Copy Code
sc interrogate rpcss

Additional references

Command-Line Syntax Key


Sc lock

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Server 2003 with SP1,Windows Server 2003,Windows Vista,Windows Server 2003 with SP2,Windows Server 2003 R2,Windows 7

Locks the Service Control Manager database.

For examples of how to use this command, see Examples.

Syntax

Copy Code
sc [<ServerName>] lock

Parameters

Parameter | Description
<ServerName> | Specifies the name of the remote server on which the service is located. The name must use the Universal Naming Convention (UNC) format (for example, \\myserver). To run SC.exe locally, omit this parameter.
/? | Displays help at the command prompt.

Remarks

  • Locking the Service Control Manager's database prevents any services from starting. Use this command if you want to make sure that a service will not be started after it has been stopped. This will enable you to perform an action (for example, deleting the service) without interference.

  • Using the lock operation locks the Service Control Manager database and then enables you to unlock the database by typing u. You can also stop the process from which you locked the database.

Examples

To lock the Server Control Manager database on the local computer, type:

Copy Code
sc lock

Additional references

Command-Line Syntax Key


Sc pause

Applies To: Windows Server 2003 R2,Windows 7,Windows Server 2003 with SP2,Windows Server 2003,Windows Vista,Windows Server 2003 with SP1,Windows Server 2008,Windows Server 2008 R2

Sends a PAUSE control request to a service.

For examples of how to use this command, see Examples.

Syntax

Copy Code
sc [<ServerName>] pause [<ServiceName>]

Parameters

Parameter | Description
<ServerName> | Specifies the name of the remote server on which the service is located. The name must use the Universal Naming Convention (UNC) format (for example, \\myserver). To run SC.exe locally, omit this parameter.
<ServiceName> | Specifies the service name returned by the getkeyname operation.
/? | Displays help at the command prompt.

Remarks

  • Use the pause command to pause a service before shutting it down.

  • Not all services can be paused.

  • Not all services perform the same when paused. Some services continue to service existing clients but refuse to accept new clients. Others cease to service existing clients and also refuse to accept new clients.

Examples

To send a PAUSE control request to the TAPISRV service on the local computer, type:

Copy Code
sc pause tapisrv

Additional references

Command-Line Syntax Key


Sc qc

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Server 2003 with SP1,Windows Server 2003,Windows Vista,Windows Server 2003 with SP2,Windows 7,Windows Server 2003 R2

Queries the configuration information for a specified service.

For examples of how to use this command, see Examples.

Syntax

Copy Code
sc [<ServerName>] qc [<ServiceName>] [<BufferSize>]

Parameters

Parameter | Description
<ServerName> | Specifies the name of the remote server on which the service is located. The name must use the Universal Naming Convention (UNC) format (for example, \\myserver). To run SC.exe locally, omit this parameter.
<ServiceName> | Specifies the service name returned by the getkeyname operation.
<BufferSize> | Specifies the size (in bytes) of the buffer. The default buffer size is 1,024 bytes.
/? | Displays help at the command prompt.

Remarks

  • The qc command displays the following information about a service: SERVICE_NAME (service's registry subkey name), TYPE, ERROR_CONTROL, BINARY_PATH_NAME, LOAD_ORDER_GROUP, TAG, DISPLAY_NAME, DEPENDENCIES, and SERVICE_START_NAME.

  • Administrators can use Sc commands to determine the binary name of any service and find out whether it shares a process with other services. They do this by typing the following at the command prompt (where ServiceName is an actual service name):

    Copy Code
    sc qc ServiceName
    Sc can help match up services in the Services node of Microsoft Management Console (MMC) with processes in System Monitor. If the binary name is Services.exe, the service shares the Service Controller process.

    The Services.exe program starts all services. To conserve system resources, several Win32 services developed for Windows are written to share the Services.exe process. These services are not listed as separate processes in System Monitor or Task Manager. The same is true of Svchost.exe, a service host process that is shared by many operating services.

    There might not be a process for every Win32 service because third-party Win32 services can also be configured to share processes. You can use Sc to get configuration information about these services. If a service does not share its process with other services, however, there will be a process for it in System Monitor when the service is running.

  • Sc commands can be useful for developers of services because it provides more detailed and accurate information about services than does Services.exe, which is included with Windows. Services.exe can determine whether a service is running, stopped, or paused. Although these tools are adequate for a debugged application that is running smoothly, the information they provide about a service being developed can be misleading. For example, a service that is starting is shown as started whether it is actually running or not.

    Note that Sc implements calls to all Windows service control application programming interface (API) functions. Set the parameters to these functions by specifying them at the command prompt.

    Using Sc commands, you can query the service status and retrieve the values stored in the status structure fields. Services.exe cannot provide you with the complete status of a service, but Sc shows the exact state of the service, as well as the last checkpoint number and wait hint. You can use the checkpoint as a debugging tool because it indicates how far the initialization progressed before the program stopped responding. In addition, Sc enables you to specify the name of a remote computer so that you can call the service API functions or view the service status structures on a remote computer.

Examples

To query the configuration information for the NEWSRVICE service running on a remote computer called "MyServer," type:

Copy Code
sc qc \\myserver newsrvice

To query the configuration information for the RPCSS service on the local computer, type:

Copy Code
sc qc rpcss

Additional references

Command-Line Syntax Key


Sc qdescription

Applies To: Windows Server 2003 R2,Windows 7,Windows Server 2003 with SP2,Windows Vista,Windows Server 2003,Windows Server 2003 with SP1,Windows Server 2008,Windows Server 2008 R2

Displays the description string for a specified service.

For examples of how to use this command, see Examples.

Syntax

Copy Code
sc [<ServerName>] qdescription [<ServiceName>] [<BufferSize>]

Parameters

Parameter | Description
<ServerName> | Specifies the name of the remote server on which the service is located. The name must use the Universal Naming Convention (UNC) format (for example, \\myserver). To run SC.exe locally, omit this parameter.
<ServiceName> | Specifies the service name returned by the getkeyname operation.
<BufferSize> | Specifies the size (in bytes) of the buffer. The default buffer size is 1,024 bytes.
/? | Displays help at the command prompt.

Examples

To display the description string for the RPCSS service, type:

Copy Code
sc qdescription rpcss

Additional references

Command-Line Syntax Key


Sc qfailure

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Server 2003 with SP1,Windows Server 2003,Windows Vista,Windows Server 2003 with SP2,Windows 7,Windows Server 2003 R2

Displays the actions that will be performed if the specified service fails.

For examples of how to use this command, see Examples.

Syntax

Copy Code
sc [<ServerName>] qfailure [<ServiceName>] [<BufferSize>]

Parameters

Parameter | Description
<ServerName> | Specifies the name of the remote server on which the service is located. The name must use the Universal Naming Convention (UNC) format (for example, \\myserver). To run SC.exe locally, omit this parameter.
<ServiceName> | Specifies the service name returned by the getkeyname operation.
<BufferSize> | Specifies the size (in bytes) of the buffer. The default buffer size is 1,024 bytes.
/? | Displays help at the command prompt.

Remarks

The qfailure command displays the following information about a service: SERVICE_NAME (service's registry subkey name), RESET_PERIOD, REBOOT_MESSAGE, COMMAND_LINE, and FAILURE_ACTIONS.

Examples

To display the actions that will take place if the RPCSS service fails, type:

Copy Code
sc qfailure rpcss

To display the actions that will take place if the RPCSS service fails, and to specify a buffer size of 2,048 bytes, type:

Copy Code
sc qfailure rpcss 2048

Additional references

Command-Line Syntax Key


Sc query

Applies To: Windows Server 2003 R2,Windows 7,Windows Server 2003 with SP2,Windows Vista,Windows Server 2003,Windows Server 2003 with SP1,Windows Server 2008,Windows Server 2008 R2

Obtains and displays information about the specified service, driver, type of service, or type of driver.

For examples of how to use this command, see Examples.

Syntax

Copy Code
sc [<ServerName>] query [<ServiceName>] [type= {driver | service | all}] [type= {own | share | interact | kernel | filesys | rec | adapt}] [state= {active | inactive | all}] [bufsize= <BufferSize>] [ri= <ResumeIndex>] [group= <GroupName>]

Parameters

Parameter Description

<ServerName>

Specifies the name of the remote server on which the service is located. The name must use the Universal Naming Convention (UNC) format (for example, \\myserver). To run SC.exe locally, omit this parameter.

<ServiceName>

Specifies the service name returned by the getkeyname operation. This query parameter is not used in conjunction with other query parameters (other than ServerName).

type= {driver | service | all}

Specifies what to enumerate. The default value for the first type is service.

Value | Description
driver | Specifies that only drivers are enumerated.
service | Specifies that only services are enumerated.
all | Specifies that both drivers and services are enumerated.

type= {own | share | interact | kernel | filesys | rec | adapt}

Specifies the type of services or type of drivers to be enumerated. The default value for the second type is own.

Value | Description
own | Specifies that the service runs in its own process. It does not share an executable file with other services.
share | Specifies that the service runs as a shared process. It shares an executable file with other services.
interact | Specifies that the service can interact with the desktop, receiving input from users. Interactive services must be run under the LocalSystem account.
kernel | Specifies a driver.
filesys | Specifies a file system driver.

state= {active | inactive | all}

Specifies the started state of the service to be enumerated. The default state is active.

Value | Description
active | Specifies all active services.
inactive | Specifies all paused or stopped services.
all | Specifies all services.

bufsize= <BufferSize>

Specifies the size (in bytes) of the enumeration buffer. The default buffer size is 1,024 bytes. You should increase the size of the enumeration buffer when the display resulting from a query exceeds 1,024 bytes.

ri= <ResumeIndex>

Specifies the index number at which enumeration is to begin or resume. The default value is 0 (zero). Use this parameter in conjunction with the bufsize= parameter when more information is returned by a query than the default buffer can display.

group= <GroupName>

Specifies the service group to be enumerated. By default, all groups are enumerated (group= "").

/?

Displays help at the command prompt.

Remarks

  • Without a space between a parameter and its value (that is, type= own, not type=own), the operation will fail.

  • The query operation displays the following information about a service: SERVICE_NAME (service's registry subkey name), TYPE, STATE (as well as states which are not available), WIN32_EXIT_B, SERVICE_EXIT_B, CHECKPOINT, and WAIT_HINT.

  • The type= parameter can be used twice in some cases. The first appearance of the type= parameter specifies whether to query services, drivers, or both (all). The second appearance of the type= parameter specifies a type from the create operation to further narrow a query's scope.

  • When the display resulting from a query command exceeds the size of the enumeration buffer, a message similar to the following is displayed:

    Copy Code
    Enum: more data, need 1822 bytes start resume at index 79
    To display the remaining query information, rerun query, setting bufsize= to be the number of bytes and setting ri= to the specified index. For example, the remaining output would be displayed by typing the following at the command prompt:

    Copy Code
    sc query bufsize= 1822 ri= 79

Examples

To display information for active services only, type either of the following commands:

Copy Code
sc query
sc query type= service

To display information for active services, and to specify a buffer size of 2,000 bytes, type:

Copy Code
sc query type= all bufsize= 2000

To display information for the WUAUSERV service, type:

Copy Code
sc query wuauserv

To display information for all services (active and inactive), type:

Copy Code
sc query state= all

To display information for all services (active and inactive), beginning at line 56, type:

Copy Code
sc query state= all ri= 56

To display information for interactive services, type:

Copy Code
sc query type= service type= interact

To display information for drivers only, type:

Copy Code
sc query type= driver

To display information for drivers in the Network Driver Interface Specification (NDIS) group, type:

Copy Code
sc query type= driver group= ndis

Additional references

Command-Line Syntax Key


Sc queryex

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Server 2003 with SP1,Windows Server 2003,Windows Vista,Windows Server 2003 with SP2,Windows 7,Windows Server 2003 R2

Obtains and displays extended information about the specified service, driver, type of service, or type of driver.

For examples of how to use this command, see Examples.

Syntax

Copy Code
sc [<ServerName>] queryex [type= {driver | service | all}] [type= {own | share | interact | kernel | filesys | rec | adapt}] [state= {active | inactive | all}] [bufsize= <BufferSize>] [ri= <ResumeIndex>][group= {"" | <GroupName>}]

Parameters

Parameter Description

<ServerName>

Specifies the name of the remote server on which the service is located. The name must use the Universal Naming Convention (UNC) format (for example, \\myserver). To run SC.exe locally, omit this parameter.

<ServiceName>

Specifies the service name returned by the getkeyname operation. This queryex parameter is not used in conjunction with any other queryex parameters except ServerName.

type= {driver | service | all}

Specifies what to enumerate. The default value for the first type is service.

Value | Description
driver | Specifies that only drivers are enumerated.
service | Specifies that only services are enumerated.
all | Specifies that both drivers and services are enumerated.

type= {own | share | interact | kernel | filesys | rec | adapt}

Specifies the type of services or type of drivers to enumerate. The default value for the second type is own.

Value | Description
own | The service runs in its own process. It does not share an executable file with other services.
share | The service runs as a shared process. It shares an executable file with other services.
interact | The service can interact with the desktop, receiving input from users. Interactive services must be run under the LocalSystem account.
kernel | Driver.
filesys | File system driver.

state= {active | inactive | all}

Specifies the started state of the service for which to enumerate. The default state is active.

Value | Description
active | Specifies all active services.
inactive | Specifies all paused or stopped services.
all | Specifies all services.

bufsize= <BufferSize>

Specifies the size (in bytes) of the enumeration buffer. The default buffer size is 1024 bytes.

ri= <ResumeIndex>

Specifies the index number at which to begin or resume the enumeration. The default value is 0.

group= <GroupName>

Specifies the service group to enumerate. By default, all groups are enumerated (group= "").

/?

Displays help at the command prompt.

Remarks

  • For each command-line option, the equal sign is part of the option name.

  • A space is required between an option and its value (for example, type= own. If the space is omitted, the operation will fail.

  • The queryex command displays the following information about a service: SERVICE_NAME (service's registry subkey name), TYPE, STATE (as well as states that are not available), WIN32_EXIT_B, SERVICE_EXIT_B, CHECKPOINT, WAIT_HINT, PID, and FLAGS.

  • You can use the type= parameter twice in some cases. The first appearance of the type= parameter specifies whether to query services, drivers, or both (all). The second appearance of the type= parameter specifies a type from the create operation to further narrow a query's scope.

  • When the display resulting from a queryex command exceeds the size of the enumeration buffer, a message similar to the following is displayed:

    Enum: more data, need 2130 bytes start resume at index 75

    To display the remaining queryex information, rerun queryex, setting bufsize= to be the number of bytes and setting ri= to the specified index. For example, the remaining output would be displayed by typing the following at the command prompt:

    Copy Code
    sc queryex bufsize= 2130 ri= 75

Examples

To display extended information about the MESSENGER service, type:

Copy Code
sc queryex messenger

To display extended information about all service groups, type:

Copy Code
sc queryex group= ""

Additional references

Command-Line Syntax Key


Sc querylock

Applies To: Windows Server 2003 R2,Windows 7,Windows Server 2003 with SP2,Windows Vista,Windows Server 2003,Windows Server 2003 with SP1,Windows Server 2008,Windows Server 2008 R2

Queries and displays the lock status for the Service Control Manager database.

For examples of how to use this command, see Examples.

Syntax

Copy Code
sc [<ServerName>] querylock

Parameter

Parameter | Description
<ServerName> | Specifies the name of the remote server on which the service is located. The name must use the Universal Naming Convention (UNC) format (for example, \\myserver). To run SC.exe locally, omit this parameter.
/? | Displays help at the command prompt.

Examples

To display the lock status for the Service Control Manager database on the local computer, type:

Copy Code
sc querylock

Additional references

Command-Line Syntax Key


Sc sdset

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Server 2003 with SP1,Windows Server 2003,Windows Vista,Windows Server 2003 with SP2,Windows 7,Windows Server 2003 R2

Sets a service's security descriptor, using the Service Descriptor Definition Language (SDDL).

Syntax

Copy Code
sc [<ServerName>] sdset <ServiceName> <ServiceSecurityDescriptor>

Parameters

Parameter | Description
<ServerName> | Specifies the name of the remote server on which the service is located. The name must use the Universal Naming Convention (UNC) format (for example, \\myserver). To run SC.exe locally, omit this parameter.
<ServiceName> | Specifies the service name returned by the getkeyname operation.
<ServiceSecurityDescriptor> | Specifies the service descriptor in SDDL.
/? | Displays help at the command prompt.

Remarks

For more information about SDDL, see "Security Descriptor Definition Language" on the Microsoft Web site (http://go.microsoft.com/fwlink/?LinkID=570).

Additional references

Command-Line Syntax Key


Sc sdshow

Applies To: Windows Server 2003 R2,Windows 7,Windows Server 2003 with SP2,Windows Vista,Windows Server 2003,Windows Server 2003 with SP1,Windows Server 2008,Windows Server 2008 R2

Displays a service's security descriptor, using the Security Descriptor Definition Language (SDDL).

For examples of how to use this command, see Examples.

Syntax

Copy Code
sc [<ServerName>] sdshow <ServiceName>

Parameters

Parameter | Description
<ServerName> | Specifies the name of the remote server on which the service is located. The name must use the Universal Naming Convention (UNC) format (for example, \\myserver). To run SC.exe locally, omit this parameter.
<ServiceName> | Specifies the service name returned by the getkeyname operation.
/? | Displays help at the command prompt.

Remarks

For more information about SDDL, see "Security Descriptor Definition Language" on the Microsoft Web site (http://go.microsoft.com/fwlink/?LinkID=570).

Examples

To display the security descriptor for the RPCSS service by using SDDL, type:

Copy Code
sc sdshow rpcss

Additional references

Command-Line Syntax Key


Sc start

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Server 2003 with SP1,Windows Server 2003,Windows Vista,Windows Server 2003 with SP2,Windows 7,Windows Server 2003 R2

Starts a service.

For examples of how to use this command, see Examples.

Syntax

Copy Code
sc [<ServerName>] start <ServiceName> [<ServiceArguments>]

Parameters

Parameter | Description
<ServerName> | Specifies the name of the remote server on which the service is located. The name must use the Universal Naming Convention (UNC) format (for example, \\myserver). To run SC.exe locally, omit this parameter.
<ServiceName> | Specifies the service name returned by the getkeyname operation.
<ServiceArguments> | Specifies the service arguments to pass to the service to be started.
/? | Displays help at the command prompt.

Examples

To start the TAPISRV service on the local computer, type:

Copy Code
sc start tapisrv

Additional references

Command-Line Syntax Key


Sc stop

Applies To: Windows 7,Windows Server 2003 R2,Windows Server 2003 with SP2,Windows Vista,Windows Server 2003,Windows Server 2003 with SP1,Windows Server 2008,Windows Server 2008 R2

Sends a STOP control request to a service.

Caution
Incorrectly editing the registry may severely damage your system. Before making changes to the registry, you should back up any valued data on the computer.

For examples of how to use this command, see Examples.

Syntax

Copy Code
sc [<ServerName>] stop <ServiceName>

Parameters

Parameter | Description
<ServerName> | Specifies the name of the remote server on which the service is located. The name must use the Universal Naming Convention (UNC) format (for example, \\myserver). To run SC.exe locally, omit this parameter.
<ServiceName> | Specifies the service name returned by the getkeyname operation.
/? | Displays help at the command prompt.

Remarks

Not all services can be stopped.

Examples

To stop the TAPISRV service, type:

Copy Code
sc stop tapisrv

Additional references

Command-Line Syntax Key


Schtasks

Applies To: Windows Server 2008

Schedules commands and programs to run periodically or at a specific time. Adds and removes tasks from the schedule, starts and stops tasks on demand, and displays and changes scheduled tasks.

To view the command syntax, click one of the following commands:

  • schtasks create

  • schtasks change

  • schtasks run

  • schtasks end

  • schtasks delete

  • schtasks query

Remarks

  • SchTasks.exe performs the same operations as Scheduled Tasks in Control Panel. You can use these tools together and interchangeably.

  • Schtasks replaces At.exe, a tool included in previous versions of Windows. Although At.exe is still included in the Windows Server 2003 family, schtasks is the recommended command-line task scheduling tool.

  • The parameters in a schtasks command can appear in any order. Typing schtasks without any parameters performs a query.

  • Permissions for schtasks

    • You must have permission to run the command. Any user can schedule a task on the local computer, and they can view and change the tasks that they scheduled. Members of the Administrators group can schedule, view, and change all tasks on the local computer.

    • To schedule, view, or change a task on a remote computer, you must be member of the Administrators group on the remote computer, or you must use the /u parameter to provide the credentials of an Administrator of the remote computer.

    • You can use the /u parameter in a /create or /change operation only when the local and remote computers are in the same domain or the local computer is in a domain that the remote computer domain trusts. Otherwise, the remote computer cannot authenticate the user account specified and it cannot verify that the account is a member of the Administrators group.

    • The task must have permission to run. The permissions required vary with the task. By default, tasks run with the permissions of the current user of the local computer, or with the permissions of the user specified by the /u parameter, if one is included. To run a task with permissions of a different user account or with system permissions, use the /ru parameter.

  • To verify that a scheduled task ran or to find out why a scheduled task did not run, see the Task Scheduler service transaction log, SystemRoot\SchedLgU.txt. This log records attempted runs initiated by all tools that use the service, including Scheduled Tasks and SchTasks.exe.

  • On rare occasions, task files become corrupted. Corrupted tasks do not run. When you try to perform an operation on corrupted tasks, SchTasks.exe displays the following error message:

    Copy Code
    ERROR: The data is invalid.
    You cannot recover corrupted tasks. To restore the task scheduling features of the system, use SchTasks.exe or Scheduled Tasks to delete the tasks from the system and reschedule them.

schtasks create

Schedules a task.

Schtasks uses different parameter combinations for each schedule type. To see the combined syntax for creating tasks or to see the syntax for creating a task with a particular schedule type, click one of the following options.

  • Combined syntax and parameter descriptions

  • To schedule a task that runs every N minutes

  • To schedule a task that runs every N hours

  • To schedule a task that runs every N days

  • To schedule a task that runs every N weeks

  • To schedule a task that runs every N months

  • To schedule a task that runs on a specific day of the week

  • To schedule a task that runs on a specific week of the month

  • To schedule a task that runs on a specific date each month

  • To schedule a task that runs on a the last day of a month

  • To schedule a task that runs once

  • To schedule a task that runs every time the system starts

  • To schedule a task that runs when a user logs on

  • To schedule a task that runs when the system is idle

  • To schedule a task that runs now

  • To schedule a task that runs with different permissions

  • To schedule a task that runs with system permissions

  • To schedule a task that runs more than one program

  • To schedule a task that runs on a remote computer

Combined syntax and parameter descriptions

Syntax
Copy Code
schtasks /create /sc <ScheduleType> /tn <TaskName> /tr <TaskRun> [/s <Computer> [/u [<Domain>\]<User> [/p <Password>]]] [/ru {[<Domain>\]<User> | System}] [/rp <Password>] [/mo <Modifier>] [/d <Day>[,<Day>...] | *] [/m <Month>[,<Month>...]] [/i <IdleTime>] [/st <StartTime>] [/ri <Interval>] [{/et <EndTime> | /du <Duration>} [/k]] [/sd <StartDate>] [/ed <EndDate>] [/it] [/z] [/f]
Parameters
/sc <ScheduleType>

Specifies the schedule type. Valid values are MINUTE, HOURLY, DAILY, WEEKLY, MONTHLY, ONCE, ONSTART, ONLOGON, ONIDLE.

Schedule type | Description
MINUTE, HOURLY, DAILY, WEEKLY, MONTHLY | Specifies the time unit for the schedule.
ONCE | The task runs once at a specified date and time.
ONSTART | The task runs every time the system starts. You can specify a start date, or run the task the next time the system starts.
ONLOGON | The task runs whenever a user (any user) logs on. You can specify a date, or run the task the next time the user logs on.
ONIDLE | The task runs whenever the system is idle for a specified period of time. You can specify a date, or run the task the next time the system is idle.
/tn <TaskName>

Specifies a name for the task. Each task on the system must have a unique name. The name must conform to the rules for file names and must not exceed 238 characters. Use quotation marks to enclose names that include spaces.

/tr <TaskRun>

Specifies the program or command that the task runs. Type the fully qualified path and file name of an executable file, script file, or batch file. The path name must not exceed 262 characters. If you omit the path, schtasks assumes that the file is in the SystemRoot\System32 directory.

/s <Computer>

Schedules a task on the specified remote computer. Type the name or IP address of a remote computer (with or without backslashes). The default is the local computer. The /u and /p parameters are valid only when you use /s.

/u [<Domain>\]<User>

Runs this command with the permissions of the specified user account. The default is the permissions of the current user of the local computer. The /u and /p parameters are valid only for scheduling a task on a remote computer (/s).

The permissions of the specified account are used to schedule the task and to run the task. To run the task with the permissions of a different user, use the /ru parameter.

The user account must be a member of the Administrators group on the remote computer. Also, the local computer must be in the same domain as the remote computer, or must be in a domain that is trusted by the remote computer domain.

/p <Password>

Provides the password for the user account specified in the /u parameter. If you use the /u parameter, but omit the /p parameter or the password argument, schtasks prompts you for a password and obscures the text you type.

The /u and /p parameters are valid only for scheduling a task on a remote computer (/s).

/ru {[<Domain>\]<User> | System}

Runs the task with permissions of the specified user account. By default, the task runs with the permissions of the current user of the local computer, or with the permission of the user specified by the /u parameter, if one is included. The /ru parameter is valid when scheduling tasks on local or remote computers.

Value | Description
[<Domain>\]<User> | Specifies an alternate user account.
System or "" | Specifies the local System account, a highly privileged account used by the operating system and system services.
/rp <Password>

Provides the password for the user account that is specified in the /ru parameter. If you omit this parameter when specifying a user account, SchTasks.exe prompts you for the password and obscures the text you type.

Do not use the /rp parameter for tasks run with System account credentials (/ru System). The System account does not have a password and SchTasks.exe does not prompt for one.

/mo <Modifier>

Specifies how often the task runs within its schedule type. This parameter is valid, but optional, for a MINUTE, HOURLY, DAILY, WEEKLY, and MONTHLY schedule. The default value is 1.

Schedule type | Modifier values | Description
MINUTE | 1 - 1439 | The task runs every <N> minutes.
HOURLY | 1 - 23 | The task runs every <N> hours.
DAILY | 1 - 365 | The task runs every <N> days.
WEEKLY | 1 - 52 | The task runs every <N> weeks.
ONCE | No modifiers. | The task runs once.
ONSTART | No modifiers. | The task runs at startup.
ONLOGON | No modifiers. | The task runs when the user specified by the /u parameter logs on.
ONIDLE | No modifiers. | The task runs after the system is idle for the number of minutes specified by the /i parameter, which is required for use with ONIDLE.
MONTHLY | 1 - 12 | The task runs every <N> months.
MONTHLY | LASTDAY | The task runs on the last day of the month.
MONTHLY | FIRST, SECOND, THIRD, FOURTH, LAST | Use with the /d<Day> parameter to run a task on a particular week and day. For example, on the third Wednesday of the month.
/d Day[,Day...] | *

Specifies a day (or days) of the week or a day (or days) of a month. Valid only with a WEEKLY or MONTHLY schedule.

Schedule type | Modifier | Day values (/d) | Description
WEEKLY | 1 - 52 | MON - SUN[,MON - SUN...] | * | Optional. MON is the default. The wildcard value (*) means every day.
MONTHLY | FIRST, SECOND, THIRD, FOURTH, LAST | MON - SUN | Required for a specific week schedule.
MONTHLY | None or {1 - 12} | 1 - 31 | Optional and valid only with no modifier (/mo) parameter (a specific date schedule) or when the /mo is 1 - 12 (an "every <N> months" schedule). The default is day 1 (the first day of the month).
/m Month[,Month...]

Specifies a month or months of the year during which the scheduled task should run. Valid values are JAN - DEC and * (every month). The /m parameter is valid only with a MONTHLY schedule. It is required when the LASTDAY modifier is used. Otherwise, it is optional and the default value is * (every month).

/i <IdleTime>

Specifies how many minutes the computer is idle before the task starts. A valid value is a whole number from 1 to 999. This parameter is valid only with an ONIDLE schedule, and then it is required.

/st <StartTime>

Specifies the time of day that the task starts (each time it starts) in <HH:MM> 24-hour format. The default value is the current time on the local computer. The /st parameter is valid with MINUTE, HOURLY, DAILY, WEEKLY, MONTHLY, and ONCE schedules. It is required for a ONCE schedule.

/ri <Interval>

Specifies the repetition interval in minutes. This is not applicable for schedule types: MINUTE, HOURLY, ONSTART, ONLOGON, and ONIDLE. Valid range is 1 to 599940 minutes (599940 minutes = 9999 hours). If either /ET or /DU is specified, then the repetition interval defaults to 10 minutes.

/et <EndTime>

Specifies the time of day that a minute or hourly task schedule ends in <HH:MM> 24-hour format. After the specified end time, schtasks does not start the task again until the start time recurs. By default, task schedules have no end time. This parameter is optional and valid only with a MINUTE or HOURLY schedule.

For an example, see:

  • "To schedule a task that runs every 100 minutes during non-business hours" in the To schedule a task that runs every <N> minutes section.

/du <Duration>

Specifies a maximum length of time for a minute or hourly schedule in <HHHH:MM> 24-hour format. After the specified time elapses, schtasks does not start the task again until the start time recurs. By default, task schedules have no maximum duration. This parameter is optional and valid only with a MINUTE or HOURLY schedule.

For an example, see:

  • "To schedule a task that runs every 3 hours for 10 hours" in the To schedule a task that runs every <N> hours section.

/k

Stops the program that the task runs at the time specified by /et or /du. Without /k, schtasks does not start the program again after it reaches the time specified by /et or /du, but it does not stop the program if it is still running. This parameter is optional and valid only with a MINUTE or HOURLY schedule.

For an example, see:

  • "To schedule a task that runs every 100 minutes during non-business hours" in the To schedule a task that runs every <N> minutes section.

/sd <StartDate>

Specifies the date on which the task schedule starts. The default value is the current date on the local computer. The /sd parameter is valid and optional for all schedule types.

The format for StartDate varies with the locale selected for the local computer in Regional and Language Options in Control Panel. Only one format is valid for each locale.

The valid date formats are listed in the following table. Use the format most similar to the format selected for Short date in Regional and Language Options in Control Panel on the local computer.

Value | Description
<MM>/<DD>/<YYYY> | Use for month-first formats, such as English (United States) and Spanish (Panama).
<DD>/<MM>/<YYYY> | Use for day-first formats, such as Bulgarian and Dutch (Netherlands).
<YYYY>/<MM>/<DD> | Use for year-first formats, such as Swedish and French (Canada).

/ed <EndDate>

Specifies the date on which the schedule ends. This parameter is optional. It is not valid in a ONCE, ONSTART, ONLOGON, or ONIDLE schedule. By default, schedules have no ending date.

The format for EndDate varies with the locale selected for the local computer in Regional and Language Options in Control Panel. Only one format is valid for each locale.

The valid date formats are listed in the following table. Use the format most similar to the format selected for Short date in Regional and Language Options in Control Panel on the local computer.

<MM>/<DD>/<YYYY> | Use for month-first formats, such as English (United States) and Spanish (Panama).
<DD>/<MM>/<YYYY> | Use for day-first formats, such as Bulgarian and Dutch (Netherlands).
<YYYY>/<MM>/<DD> | Use for year-first formats, such as Swedish and French (Canada).
/it

Specifies to run the task only when the "run as" user (the user account under which the task runs) is logged on to the computer. This parameter has no effect on tasks that run with system permissions.

By default, the "run as" user is the current user of the local computer when the task is scheduled or the account specified by the /u parameter, if one is used. However, if the command includes the /ru parameter, then the "run as" user is the account specified by the /ru parameter.

For examples, see:

  • "To schedule a task that runs every 70 days if I am logged on" in the To schedule a task that runs every N days section.

  • "To run a task only when a particular user is logged on" in the To schedule a task that runs with different permissions section.

/z

Specifies to delete the task upon completion of its schedule.

/f

Specifies to create the task and suppress warnings if the specified task already exists.

/?

Displays help at the command prompt.

To schedule a task that runs every N minutes

Minute Schedule Syntax
Copy Code
schtasks /create /tn <TaskName> /tr <TaskRun> /sc minute [/mo {1 - 1439}] [/st <HH:MM>] [/sd <StartDate>] [/ed <EndDate>] [{/et <HH:MM> | /du <HHHH:MM>} [/k]] [/it] [/ru {[<Domain>\]<User> [/rp <Password>] | System}] [/s <Computer> [/u [<Domain>\]<User> [/p <Password>]]]
Remarks

In a minute schedule, the /sc minute parameter is required. The /mo (modifier) parameter is optional and specifies the number of minutes between each run of the task. The default value for /mo is 1 (every minute). The /et (end time) and /du (duration) parameters are optional and can be used with or without the /k (end task) parameter.

Examples
To schedule a task that runs every 20 minutes

The following command schedules a security script, Sec.vbs, to run every 20 minutes. The command uses the /sc parameter to specify a minute schedule and the /mo parameter to specify an interval of 20 minutes.

Because the command does not include a starting date or time, the task starts 20 minutes after the command completes, and runs every 20 minutes thereafter whenever the system is running. Notice that the security script source file is located on a remote computer, but that the task is scheduled and executes on the local computer.

Copy Code
schtasks /create /sc minute /mo 20 /tn "Security Script" /tr \\central\data\scripts\sec.vbs
To schedule a task that runs every 100 minutes during non-business hours

The following command schedules a security script, Sec.vbs, to run on the local computer every 100 minutes between 5:00 P.M. and 7:59 A.M. each day. The command uses the /sc parameter to specify a minute schedule and the /mo parameter to specify an interval of 100 minutes. It uses the /st and /et parameters to specify the start time and end time of each day's schedule. It also uses the /k parameter to stop the script if it is still running at 7:59 A.M. Without /k, schtasks would not start the script after 7:59 A.M., but if the instance started at 6:20 A.M. was still running, it would not stop it.

Copy Code
schtasks /create /tn "Security Script" /tr sec.vbs /sc minute /mo 100 /st 17:00 /et 08:00 /k

To schedule a task that runs every N hours

Hourly Schedule Syntax
Copy Code
schtasks /create /tn <TaskName> /tr <TaskRun> /sc hourly [/mo {1 - 23}] [/st <HH:MM>] [/sd <StartDate>] [/ed <EndDate>] [{/et <HH:MM> | /du <HHHH:MM>} [/k]] [/it] [/ru {[<Domain>\]<User> [/rp <Password>] | System}] [/s <Computer> [/u [<Domain>\]<User> [/p <Password>]]]
Remarks

In an hourly schedule, the /sc hourly parameter is required. The /mo (modifier) parameter is optional and specifies the number of hours between each run of the task. The default value for /mo is 1 (every hour). The /k (end task) parameter is optional and can be used with either /et (end at the specified time) or /du (end after the specified interval).

Examples
To schedule a task that runs every five hours

The following command schedules the MyApp program to run every five hours beginning on the first day of March 2002. It uses the /mo parameter to specify the interval and the /sd parameter to specify the start date. Because the command does not specify a start time, the current time is used as the start time.

Because the local computer is set to use the English (Zimbabwe) option in Regional and Language Options in Control Panel, the format for the start date is MM/DD/YYYY (03/01/2002).

Copy Code
schtasks /create /sc hourly /mo 5 /sd 03/01/2002 /tn "My App" /tr c:\apps\myapp.exe
To schedule a task that runs every hour at five minutes past the hour

The following command schedules the MyApp program to run hourly beginning at five minutes past midnight. Because the /mo parameter is omitted, the command uses the default value for the hourly schedule, which is every (1) hour. If this command runs after 12:05 A.M., the program does not run until the next day.

Copy Code
schtasks /create /sc hourly /st 00:05 /tn "My App" /tr c:\apps\myapp.exe
To schedule a task that runs every 3 hours for 10 hours

The following command schedules the MyApp program to run every 3 hours for 10 hours.

The command uses the /sc parameter to specify an hourly schedule and the /mo parameter to specify the interval of 3 hours. It uses the /st parameter to start the schedule at midnight and the /du parameter to end the recurrences after 10 hours. Because the program runs for just a few minutes, the /k parameter, which stops the program if it is still running when the duration expires, is not necessary.

Copy Code
schtasks /create /tn "My App" /tr myapp.exe /sc hourly /mo 3 /st 00:00 /du 0010:00

In this example, the task runs at 12:00 A.M., 3:00 A.M., 6:00 A.M., and 9:00 A.M. Because the duration is 10 hours, the task is not run again at 12:00 P.M. Instead, it starts again at 12:00 A.M. the next day.

To schedule a task that runs every N days

Daily Schedule Syntax
Copy Code
schtasks /create /tn <TaskName> /tr <TaskRun> /sc daily [/mo {1 - 365}] [/st <HH:MM>] [/sd <StartDate>] [/ed <EndDate>] [/it] [/ru {[<Domain>\]<User> [/rp <Password>] | System}] [/s <Computer> [/u [<Domain>\]<User> [/p <Password>]]]
Remarks

In a daily schedule, the /sc daily parameter is required. The /mo (modifier) parameter is optional and specifies the number of days between each run of the task. The default value for /mo is 1 (every day).

Examples
To schedule a task that runs every day

The following example schedules the MyApp program to run once a day, every day, at 8:00 A.M. until December 31, 2002. Because it omits the /mo parameter, the default interval of 1 is used to run the command every day.

In this example, because the local computer system is set to the English (United Kingdom) option in Regional and Language Options in Control Panel, the format for the end date is DD/MM/YYYY (31/12/2002)

Copy Code
schtasks /create /tn "My App" /tr c:\apps\myapp.exe /sc daily /st 08:00 /ed 31/12/2002
To schedule a task that runs every 12 days

The following example schedules the MyApp program to run every twelve days at 1:00 P.M. (13:00) beginning on December 31, 2002. The command uses the /mo parameter to specify an interval of two (2) days and the /sd and /st parameters to specify the date and time.

In this example, because the system is set to the English (Zimbabwe) option in Regional and Language Options in Control Panel, the format for the end date is MM/DD/YYYY (12/31/2002)

Copy Code
schtasks /create /tn "My App" /tr c:\apps\myapp.exe /sc daily /mo 12 /sd 12/31/2002 /st 13:00
To schedule a task that runs every 70 days if I am logged on

The following command schedules a security script, Sec.vbs, to run every 70 days. The command uses the /mo parameter to specify an interval of 70 days. It also uses the /it parameter to specify that the task runs only when the user under whose account the task runs is logged onto the computer. Because the task will run with the permissions of my user account, then the task will run only when I am logged on.

Copy Code
schtasks /create /tn "Security Script" /tr sec.vbs /sc daily /mo 70 /it
Note
To identify tasks with the interactive-only (/it) property, use a verbose query (/query /v). In a verbose query display of a task with /it, the Logon Mode field has a value of Interactive only.

To schedule a task that runs every N weeks

Weekly Schedule Syntax
Copy Code
schtasks /create /tn <TaskName> /tr <TaskRun> /sc weekly [/mo {1 - 52}] [/d {<MON - SUN>[,MON - SUN...] | *}] [/st <HH:MM>] [/sd <StartDate>] [/ed <EndDate>] [/it] [/ru {[<Domain>\]<User> [/rp <Password>] | System}] [/s <Computer> [/u [<Domain>\]<User> [/p <Password>]]]
Remarks

In a weekly schedule, the /sc weekly parameter is required. The /mo (modifier) parameter is optional and specifies the number of weeks between each run of the task. The default value for /mo is 1 (every week).

Weekly schedules also have an optional /d parameter to schedule the task to run on specified days of the week, or on all days (*). The default is MON (Monday). The every day (*) option is equivalent to scheduling a daily task.

Examples
To schedule a task that runs every six weeks

The following command schedules the MyApp program to run on a remote computer every six weeks. The command uses the /mo parameter to specify the interval. Because the command omits the /d parameter, the task runs on Mondays.

This command also uses the /s parameter to specify the remote computer and the /u parameter to run the command with the permissions of the user's Administrator account. Because the /p parameter is omitted, SchTasks.exe prompts the user for the Administrator account password.

Also, because the command is run remotely, all paths in the command, including the path to MyApp.exe, refer to paths on the remote computer.

Copy Code
schtasks /create /tn "My App" /tr c:\apps\myapp.exe /sc weekly /mo 6 /s Server16 /u Admin01
To schedule a task that runs every other week on Friday

The following command schedules a task to run every other Friday. It uses the /mo parameter to specify the two-week interval and the /d parameter to specify the day of the week. To schedule a task that runs every Friday, omit the /mo parameter or set it to 1.

Copy Code
schtasks /create /tn "My App" /tr c:\apps\myapp.exe /sc weekly /mo 2 /d FRI

To schedule a task that runs every N months

Syntax
Copy Code
schtasks /create /tn <TaskName> /tr <TaskRun> /sc monthly [/mo {1 - 12}] [/d {1 - 31}] [/st <HH:MM>] [/sd <StartDate>] [/ed <EndDate>] [/it] [/ru {[<Domain>\]<User> [/rp <Password>] | System}] [/s <Computer> [/u [<Domain>\]<User> [/p <Password>]]]
Remarks

In this schedule type, the /sc monthly parameter is required. The /mo (modifier) parameter, which specifies the number of months between each run of the task, is optional and the default is 1 (every month). This schedule type also has an optional /d parameter to schedule the task to run on a specified date of the month. The default is 1 (the first day of the month).

Examples
To schedule a task that runs on the first day of every month

The following command schedules the MyApp program to run on the first day of every month. Because a value of 1 is the default for both the /mo (modifier) parameter and the /d (day) parameter, these parameters are omitted from the command.

Copy Code
schtasks /create /tn "My App" /tr myapp.exe /sc monthly
To schedule a task that runs every three months

The following command schedules the MyApp program to run every three months. It uses the /mo parameter to specify the interval.

Copy Code
schtasks /create /tn "My App" /tr c:\apps\myapp.exe /sc monthly /mo 3
To schedule a task that runs at midnight on the 21st day of every other month

The following command schedules the MyApp program to run every other month on the 21st day of the month at midnight. The command specifies that this task should run for one year, from July 2, 2002 to June 30, 2003.

The command uses the /mo parameter to specify the monthly interval (every two months), the /d parameter to specify the date, and the /st to specify the time. It also uses the /sd and /ed parameters to specify the start date and end date, respectively. Because the local computer is set to the English (South Africa) option in Regional and Language Options in Control Panel, the dates are specified in the local format, YYYY/MM/DD.

Copy Code
schtasks /create /tn "My App" /tr c:\apps\myapp.exe /sc monthly /mo 2 /d 21 /st 00:00 /sd 2002/07/01 /ed 2003/06/30

To schedule a task that runs on a specific day of the week

Weekly Schedule Syntax
Copy Code
schtasks /create /tn <TaskName> /tr <TaskRun> /sc weekly [/d {<MON - SUN>[,MON - SUN...] | *}] [/mo {1 - 52}] [/st <HH:MM>] [/sd <StartDate>] [/ed <EndDate>] [/it] [/ru {[<Domain>\]<User> [/rp <Password>] | System}] [/s <Computer> [/u [<Domain>\]<User> [/p <Password>]]]
Remarks

The "day of the week" schedule is a variation of the weekly schedule. In a weekly schedule, the /sc weekly parameter is required. The /mo (modifier) parameter is optional and specifies the number of weeks between each run of the task. The default value for /mo is 1 (every week). The /d parameter, which is optional, schedules the task to run on specified days of the week, or on all days (*). The default is MON (Monday). The every day option (/d *) is equivalent to scheduling a daily task.

Examples
To schedule a task that runs every Wednesday

The following command schedules the MyApp program to run every week on Wednesday. The command uses the /d parameter to specify the day of the week. Because the command omits the /mo parameter, the task runs every week.

Copy Code
schtasks /create /tn "My App" /tr c:\apps\myapp.exe /sc weekly /d WED
To schedule a task that runs every eight weeks on Monday and Friday

The following command schedules a task to run on Monday and Friday of every eighth week. It uses the /d parameter to specify the days and the /mo parameter to specify the eight-week interval.

Copy Code
schtasks /create /tn "My App" /tr c:\apps\myapp.exe /sc weekly /mo 8 /d MON,FRI

To schedule a task that runs on a specific week of the month

Specific Week Syntax
Copy Code
schtasks /create /tn <TaskName> /tr <TaskRun> /sc monthly /mo {FIRST | SECOND | THIRD | FOURTH | LAST} /d MON - SUN [/m {JAN - DEC[,JAN - DEC...] | *}] [/st <HH:MM>] [/sd <StartDate>] [/ed <EndDate>] [/it] [/ru {[<Domain>\]<User> [/rp <Password>] | System}] [/s <Computer> [/u [<Domain>\]<User> [/p <Password>]]]
Remarks

In this schedule type, the /sc monthly parameter, the /mo (modifier) parameter, and the /d (day) parameter are required. The /mo (modifier) parameter specifies the week on which the task runs. The /d parameter specifies the day of the week. (You can specify only one day of the week for this schedule type.) This schedule also has an optional /m (month) parameter that lets you schedule the task for particular months or every month (*). The default for the /m parameter is every month (*).

Examples
To schedule a task for the second Sunday of every month

The following command schedules the MyApp program to run on the second Sunday of every month. It uses the /mo parameter to specify the second week of the month and the /d parameter to specify the day.

Copy Code
schtasks /create /tn "My App" /tr c:\apps\myapp.exe /sc monthly /mo SECOND /d SUN
To schedule a task for the first Monday in March and September

The following command schedules the MyApp program to run on the first Monday in March and September. It uses the /mo parameter to specify the first week of the month and the /d parameter to specify the day. It uses /m parameter to specify the month, separating the month arguments with a comma.

Copy Code
schtasks /create /tn "My App" /tr c:\apps\myapp.exe /sc monthly /mo FIRST /d MON /m MAR,SEP

To schedule a task that runs on a specific date each month

Specific date syntax
Copy Code
schtasks /create /tn <TaskName> /tr <TaskRun> /sc monthly /d {1 - 31} [/m {JAN - DEC[,JAN - DEC...] | *}] [/st <HH:MM>] [/sd <StartDate>] [/ed <EndDate>] [/it] [/ru {[<Domain>\]<User> [/rp <Password>] | System}] [/s <Computer> [/u [<Domain>\]<User> [/p <Password>]]]
Remarks

In the specific date schedule type, the /sc monthly parameter and the /d (day) parameter are required. The /d parameter specifies a date of the month (1 - 31), not a day of the week. You can specify only one day in the schedule. The /mo (modifier) parameter is not valid with this schedule type.

The /m (month) parameter is optional for this schedule type and the default is every month (*). Schtasks does not let you schedule a task for a date that does not occur in a month specified by the /m parameter. However, if omit the /m parameter, and schedule a task for a date that does not appear in every month, such as the 31st day, then the task does not run in the shorter months. To schedule a task for the last day of the month, use the last day schedule type.

Examples
To schedule a task for the first day of every month

The following command schedules the MyApp program to run on the first day of every month. Because the default modifier is none (no modifier), the default day is day 1, and the default month is every month, the command does not need any additional parameters.

Copy Code
schtasks /create /tn "My App" /tr c:\apps\myapp.exe /sc monthly
To schedule a task for the 15th days of May and June

The following command schedules the MyApp program to run on May 15 and June 15 at 3:00 P.M. (15:00). It uses the /m parameter to specify the date and the /m parameter to specify the months. It also uses the /st parameter to specify the start time.

Copy Code
schtasks /create /tn "My App" /tr c:\apps\myapp.exe /sc monthly /d 15 /m MAY,JUN /st 15:00

To schedule a task that runs on a the last day of a month

Last day syntax
Copy Code
schtasks /create /tn <TaskName> /tr <TaskRun> /sc monthly /mo LASTDAY /m {JAN - DEC[,JAN - DEC...] | *} [/st <HH:MM>] [/sd <StartDate>] [/ed <EndDate>] [/it] [/ru {[<Domain>\]<User> [/rp <Password>] | System}] [/s <Computer> [/u [<Domain>\]<User> [/p <Password>]]]
Remarks

In the last day schedule type, the /sc monthly parameter, the /mo LASTDAY (modifier) parameter, and the /m (month) parameter are required. The /d (day) parameter is not valid.

Examples
To schedule a task for the last day of every month

The following command schedules the MyApp program to run on the last day of every month. It uses the /mo parameter to specify the last day and the /m parameter with the wildcard character (*) to indicate that the program runs every month.

Copy Code
schtasks /create /tn "My App" /tr c:\apps\myapp.exe /sc monthly /mo lastday /m *
To schedule a task at 6:00 P.M. on the last days of February and March

The following command schedules the MyApp program to run on the last day of February and the last day of March at 6:00 P.M. It uses the /mo parameter to specify the last day, the /m parameter to specify the months, and the /st parameter to specify the start time.

Copy Code
schtasks /create /tn "My App" /tr c:\apps\myapp.exe /sc monthly /mo lastday /m FEB,MAR /st 18:00

To schedule a task that runs once

Syntax
Copy Code
schtasks /create /tn <TaskName> /tr <TaskRun> /sc once /st <HH:MM> [/sd <StartDate>] [/it] [/ru {[<Domain>\]<User> [/rp <Password>] | System}] [/s <Computer> [/u [<Domain>\]<User> [/p <Password>]]]
Remarks

In the run-once schedule type, the /sc once parameter is required. The /st parameter, which specifies the time that the task runs, is required. The /sd parameter, which specifies the date that the task runs, is optional. The /mo (modifier) and /ed (end date) parameters are not valid for this schedule type.

Schtasks does not permit you to schedule a task to run once if the date and time specified are in the past, based on the time of the local computer. To schedule a task that runs once on a remote computer in a different time zone, you must schedule it before that date and time occurs on the local computer.

Examples
To schedule a task that runs one time

The following command schedules the MyApp program to run at midnight on January 1, 2003. It uses the /sc parameter to specify the schedule type and the /sd and st to specify the date and time.

Because the local computer uses the English (United States) option in Regional and Language Options in Control Panel, the format for the start date is MM/DD/YYYY.

Copy Code
schtasks /create /tn "My App" /tr c:\apps\myapp.exe /sc once /sd 01/01/2003 /st 00:00

To schedule a task that runs every time the system starts

Syntax
Copy Code
schtasks /create /tn <TaskName> /tr <TaskRun> /sc onstart [/sd <StartDate>] [/it] [/ru {[<Domain>\]<User> [/rp <Password>] | System}] [/s <Computer> [/u [<Domain>\]<User> [/p <Password>]]]
Remarks

In the on-start schedule type, the /sc onstart parameter is required. The /sd (start date) parameter is optional and the default is the current date.

Examples
To schedule a task that runs when the system starts

The following command schedules the MyApp program to run every time the system starts, beginning on March 15, 2001:

Because the local computer is uses the English (United States) option in Regional and Language Options in Control Panel, the format for the start date is MM/DD/YYYY.

Copy Code
schtasks /create /tn "My App" /tr c:\apps\myapp.exe /sc onstart /sd 03/15/2001

To schedule a task that runs when a user logs on

Syntax
Copy Code
schtasks /create /tn <TaskName> /tr <TaskRun> /sc onlogon [/sd <StartDate>] [/it] [/ru {[<Domain>\]<User> [/rp <Password>] | System}] [/s <Computer> [/u [<Domain>\]<User> [/p <Password>]]]
Remarks

The "on logon" schedule type schedules a task that runs whenever any user logs on to the computer. In the "on logon" schedule type, the /sc onlogon parameter is required. The /sd (start date) parameter is optional and the default is the current date.

Examples
To schedule a task that runs when a user logs on to a remote computer

The following command schedules a batch file to run every time a user (any user) logs on to the remote computer. It uses the /s parameter to specify the remote computer. Because the command is remote, all paths in the command, including the path to the batch file, refer to a path on the remote computer.

Copy Code
schtasks /create /tn "Start Web Site" /tr c:\myiis\webstart.bat /sc onlogon /s Server23

To schedule a task that runs when the system is idle

Syntax
Copy Code
schtasks /create /tn <TaskName> /tr <TaskRun> /sc onidle /i {1 - 999} [/sd <StartDate>] [/it] [/ru {[<Domain>\]<User> [/rp <Password>] | System}] [/s <Computer> [/u [<Domain>\]<User> [/p <Password>]]]
Remarks

The "on idle" schedule type schedules a task that runs whenever there is no user activity during the time specified by the /i parameter. In the "on idle" schedule type, the /sc onidle parameter and the /i parameter are required. The /sd (start date) is optional and the default is the current date.

Examples
To schedule a task that runs whenever the computer is idle

The following command schedules the MyApp program to run whenever the computer is idle. It uses the required /i parameter to specify that the computer must remain idle for ten minutes before the task starts.

Copy Code
schtasks /create /tn "My App" /tr c:\apps\myapp.exe /sc onidle /i 10

To schedule a task that runs now

Schtasks does not have a "run now" option, but you can simulate that option by creating a task that runs once and starts in a few minutes.
Syntax
Copy Code
schtasks /create /tn <TaskName> /tr <TaskRun> /sc once [/st <HH:MM>] /sd <MM/DD/YYYY> [/it] [/ru {[<Domain>\]<User> [/rp <Password>] | System}] [/s <Computer> [/u [<Domain>\]<User> [/p <Password>]]]
Examples
To schedule a task that runs a few minutes from now.

The following command schedules a task to run once, on November 13, 2002 at 2:18 P.M. local time.

Because the local computer is uses the English (United States) option in Regional and Language Options in Control Panel, the format for the start date is MM/DD/YYYY.

Copy Code
schtasks /create /tn "My App" /tr c:\apps\myapp.exe /sc once /st 14:18 /sd 11/13/2002

To schedule a task that runs with different permissions

You can schedule tasks of all types to run with permissions of an alternate account on both the local and a remote computer. In addition to the parameters required for the particular schedule type, the /ru parameter is required and the /rp parameter is optional.
Examples
To run a task with Administrator permissions on the local computer

The following command schedules the MyApp program to run on the local computer. It uses the /ru to specify that the task should run with the permissions of the user's Administrator account (Admin06). In this example, the task is scheduled to run every Tuesday, but you can use any schedule type for a task run with alternate permissions.

Copy Code
schtasks /create /tn "My App" /tr myapp.exe /sc weekly /d TUE /ru Admin06

In response, SchTasks.exe prompts for the "run as" password for the Admin06 account and then displays a success message.

Copy Code
Please enter the run as password for Admin06: ********
SUCCESS: The scheduled task "My App" has successfully been created.
To run a task with alternate permissions on a remote computer

The following command schedules the MyApp program to run on the Marketing computer every four days.

The command uses the /sc parameter to specify a daily schedule and /mo parameter to specify an interval of four days.

The command uses the /s parameter to provide the name of the remote computer and the /u parameter to specify an account with permission to schedule a task on the remote computer (Admin01 on the Marketing computer). It also uses the /ru parameter to specify that the task should run with the permissions of the user's non-Administrator account (User01 in the Reskits domain). Without the /ru parameter, the task would run with the permissions of the account specified by /u.

Copy Code
schtasks /create /tn "My App" /tr myapp.exe /sc daily /mo 4 /s Marketing /u Marketing\Admin01 /ru Reskits\User01

Schtasks first requests the password of the user named by the /u parameter (to run the command) and then requests the password of the user named by the /ru parameter (to run the task). After authenticating the passwords, schtasks displays a message indicating that the task is scheduled.

Copy Code
Type the password for Marketing\Admin01:********

Please enter the run as password for Reskits\User01: ********

SUCCESS: The scheduled task "My App" has successfully been created.
To run a task only when a particular user is logged on

The following command schedules the AdminCheck.exe program to run on the Public computer every Friday at 4:00 A.M., but only if the administrator of the computer is logged on.

The command uses the /sc parameter to specify a weekly schedule, the /d parameter to specify the day, and the /st parameter to specify the start time.

The command uses the /s parameter to provide the name of the remote computer and the /u parameter to specify an account with permission to schedule a task on the remote computer. It also uses the /ru parameter to configure the task to run with the permissions of the administrator of the Public computer (Public\Admin01) and the /it parameter to indicate that the task runs only when the Public\Admin01 account is logged on.

Copy Code
schtasks /create /tn "Check Admin" /tr AdminCheck.exe /sc weekly /d FRI /st 04:00 /s Public /u Domain3\Admin06 /ru Public\Admin01 /it

Note

  • To identify tasks with the interactive-only (/it) property, use a verbose query (/query /v). In a verbose query display of a task with /it, the Logon Mode field has a value of Interactive only.

To schedule a task that runs with system permissions

Tasks of all types can run with permissions of the System account on both the local and a remote computer. In addition to the parameters required for the particular schedule type, the /ru system (or /ru "") parameter is required and the /rp parameter is not valid.

Important

  • The System account does not have interactive logon rights. Users cannot see or interact with programs or tasks run with system permissions.

  • The /ru parameter determines the permissions under which the task runs, not the permissions used to schedule the task. Only Administrators can schedule tasks, regardless of the value of the /ru parameter.

Note

To identify tasks that run with system permissions, use a verbose query (/query /v). In a verbose query display of a system-run task, the Run As User field has a value of NT AUTHORITY\SYSTEM and the Logon Mode field has a value of Background only.
Examples
To run a task with system permissions

The following command schedules the MyApp program to run on the local computer with permissions of the System account. In this example, the task is scheduled to run on the fifteenth day of every month, but you can use any schedule type for a task run with system permissions.

The command uses the /ru System parameter to specify the system security context. Because system tasks do not use a password, the /rp parameter is omitted.

Copy Code
schtasks /create /tn "My App" /tr c:\apps\myapp.exe /sc monthly /d 15 /ru System

In response, SchTasks.exe displays an informational message and a success message. It does not prompt for a password.

Copy Code
INFO: The task will be created under user name ("NT AUTHORITY\SYSTEM").
SUCCESS: The Scheduled task "My App" has successfully been created.
To run a task with system permissions on a remote computer

The following command schedules the MyApp program to run on the Finance01 computer every morning at 4:00 A.M. with system permissions.

The command uses the /tn parameter to name the task and the /tr parameter to specify the remote copy of the MyApp program. It uses the /sc parameter to specify a daily schedule, but omits the /mo parameter because 1 (every day) is the default. It uses the /st parameter to specify the start time, which is also the time the task will run each day.

The command uses the /s parameter to provide the name of the remote computer and the /u parameter to specify an account with permission to schedule a task on the remote computer. It also uses the /ru parameter to specify that the task should run under the System account. Without the /ru parameter, the task would run with the permissions of the account specified by /u.

Copy Code
schtasks /create /tn "My App" /tr myapp.exe /sc daily /st 04:00 /s Finance01 /u Admin01 /ru System

Schtasks requests the password of the user named by the /u parameter and, after authenticating the password, displays a message indicating that the task is created and that it will run with permissions of the System account.

Copy Code
Type the password for Admin01:**********

INFO: The Schedule Task "My App" will be created under user name ("NT AUTHORITY\
SYSTEM").
SUCCESS: The scheduled task "My App" has successfully been created.

To schedule a task that runs more than one program

Each task runs only one program. However, you can create a batch file that runs multiple programs and then schedule a task to run the batch file. The following procedure demonstrates this method:

  1. Create a batch file that starts the programs you want to run.

    In this example, you create a batch file that starts Event Viewer (Eventvwr.exe) and System Monitor (Perfmon.exe).

    • Open a text editor, such as Notepad.

    • Type the name and fully qualified path to the executable file for each program. In this case, the file includes the following statements.

      Copy Code
      C:\Windows\System32\Eventvwr.exe
C:\Windows\System32\Perfmon.exe
    • Save the file as MyApps.bat.

  2. Use Schtasks.exe to create a task that runs MyApps.bat.

    The following command creates the Monitor task, which runs whenever anyone logs on. It uses the /tn parameter to name the task, and the /tr parameter to run MyApps.bat. It uses the /sc parameter to indicate the OnLogon schedule type and the /ru parameter to run the task with the permissions of the user's Administrator account.

    Copy Code
    schtasks /create /tn Monitor /tr C:\MyApps.bat /sc onlogon /ru Reskit\Administrator
    As a result of this command, whenever a user logs on to the computer, the task starts both Event Viewer and System Monitor.

To schedule a task that runs on a remote computer

To schedule a task to run on a remote computer, you must add the task to the remote computer's schedule. Tasks of all types can be scheduled on a remote computer, but the following conditions must be met.

  • You must have permission to schedule the task. As such, you must be logged on to the local computer with an account that is a member of the Administrators group on the remote computer, or you must use the /u parameter to provide the credentials of an Administrator of the remote computer.

  • You can use the /u parameter only when the local and remote computers are in the same domain or the local computer is in a domain that the remote computer domain trusts. Otherwise, the remote computer cannot authenticate the user account specified and it cannot verify that the account is a member of the Administrators group.

  • The task must have sufficient permission to run on the remote computer. The permissions required vary with the task. By default, the task runs with the permission of the current user of the local computer or, if the /u parameter is used, the task runs with the permission of the account specified by the /u parameter. However, you can use the /ru parameter to run the task with permissions of a different user account or with system permissions.
Examples
An Administrator schedules a task on a remote computer

The following command schedules the MyApp program to run on the SRV01 remote computer every ten days starting immediately. The command uses the /s parameter to provide the name of the remote computer. Because the local current user is an Administrator of the remote computer, the /u parameter, which provides alternate permissions for scheduling the task, is not necessary.

Please note that when scheduling tasks on a remote computer, all parameters refer to the remote computer. Therefore, the executable file specified by the /tr parameter refers to the copy of MyApp.exe on the remote computer.

Copy Code
schtasks /create /s SRV01 /tn "My App" /tr "c:\program files\corpapps\myapp.exe" /sc daily /mo 10

In response, schtasks displays a success message indicating that the task is scheduled.

A user schedules a command on a remote computer (Case 1)

The following command schedules the MyApp program to run on the SRV06 remote computer every three hours. Because Administrator permissions are required to schedule a task, the command uses the /u and /p parameters to provide the credentials of the user's Administrator account (Admin01 in the Reskits domain). By default, these permissions are also used to run the task. However, because the task doesn't need Administrator permissions to run, the command includes the /u and /rp parameters to override the default and run the task with permission of the user's non-Administrator account on the remote computer.

Copy Code
schtasks /create /s SRV06 /tn "My App" /tr "c:\program files\corpapps\myapp.exe" /sc hourly /mo 3 /u reskits\admin01 /p R43253@4$ /ru SRV06\user03 /rp MyFav!!Pswd

In response, schtasks displays a success message indicating that the task is scheduled.

A user schedules a command on a remote computer (Case 2)

The following command schedules the MyApp program to run on the SRV02 remote computer on the last day of every month. Because the local current user (user03) is not an Administrator of the remote computer, the command uses the /u parameter to provide the credentials of the user's Administrator account (Admin01 in the Reskits domain). The Administrator account permissions will be used to schedule the task and to run the task.

Copy Code
schtasks /create /s SRV02 /tn "My App" /tr "c:\program files\corpapps\myapp.exe" /sc monthly /mo LASTDAY /m * /u reskits\admin01

Because the command did not include the /p (password) parameter, schtasks prompts for the password. Then it displays a success message and, in this case, a warning.

Copy Code
Type the password for reskits\admin01:********

SUCCESS: The scheduled task "My App" has successfully been created.

WARNING: The Scheduled task "My App" has been created, but may not run because
the account information could not be set.

This warning indicates that the remote domain could not authenticate the account specified by the /u parameter. In this case, the remote domain could not authenticate the user account because the local computer is not a member of a domain that the remote computer domain trusts. When this occurs, the task job appears in the list of scheduled tasks, but the task is actually empty and it will not run.

The following display from a verbose query exposes the problem with the task. In the display, note that the value of Next Run Time is Never and that the value of Run As User is Could not be retrieved from the task scheduler database.

Had this computer been a member of the same domain or a trusted domain, the task would have been successfully scheduled and would have run as specified.

Copy Code
HostName: SRV44
TaskName: My App
Next Run Time: Never
Status:
Logon mode: Interactive/Background
Last Run Time: Never
Last Result: 0
Creator: user03
Schedule: At 3:52 PM on day 31 of every month, start
 starting 12/14/2001
Task To Run: c:\program files\corpapps\myapp.exe
Start In: myapp.exe
Comment: N/A
Scheduled Task State: Disabled
Scheduled Type: Monthly
Start Time: 3:52:00 PM
Start Date: 12/14/2001
End Date: N/A
Days: 31
Months: JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OCT,NO
V,DEC
Run As User: Could not be retrieved from the task sched
uler database
Delete Task If Not Rescheduled: Enabled
Stop Task If Runs X Hours and X Mins: 72:0
Repeat: Every: Disabled
Repeat: Until: Time: Disabled
Repeat: Until: Duration: Disabled
Repeat: Stop If Still Running: Disabled
Idle Time: Disabled
Power Management: Disabled
Remarks
  • To run a /create command with the permissions of a different user, use the /u parameter. The /u parameter is valid only for scheduling tasks on remote computers.

  • To view more schtasks /create examples, type schtasks /create /? at a command prompt.

  • To schedule a task that runs with permissions of a different user, use the /ru parameter. The /ru parameter is valid for tasks on local and remote computers.

  • To use the /u parameter, the local computer must be in the same domain as the remote computer or must be in a domain that the remote computer domain trusts. Otherwise, either the task is not created, or the task job is empty and the task does not run.

  • Schtasks always prompts for a password unless you provide one, even when you schedule a task on the local computer using the current user account. This is normal behavior for schtasks.

  • Schtasks does not verify program file locations or user account passwords. If you do not enter the correct file location or the correct password for the user account, the task is created, but it does not run. Also, if the password for an account changes or expires, and you do not change the password saved in the task, then the task does not run.

  • The System account does not have interactive logon rights. Users do not see and cannot interact with programs run with system permissions.

  • Each task runs only one program. However, you can create a batch file that starts multiple tasks, and then schedule a task that runs the batch file.

  • You can test a task as soon as you create it. Use the run operation to test the task and then check the SchedLgU.txt file (SystemRoot\SchedLgU.txt) for errors.

schtasks change

Changes one or more of the following properties of a task.

  • The program that the task runs (/tr).

  • The user account under which the task runs (/ru).

  • The password for the user account (/rp).

  • Adds the interactive-only property to the task (/it).
Syntax
Copy Code
schtasks /change /tn <TaskName> [/s <Computer> [/u [<Domain>\]<User> [/p <Password>]]] [/ru {[<Domain>\]<User> | System}] [/rp <Password>] [/tr <TaskRun>] [/st <StartTime>] [/ri <Interval>] [{/et <EndTime> | /du <Duration>} [/k]] [/sd <StartDate>] [/ed <EndDate>] [/{ENABLE | DISABLE}] [/it] [/z]
Parameters

Term Definition

/tn <TaskName>

Identifies the task to be changed. Enter the task name.

/s <Computer>

Specifies the name or IP address of a remote computer (with or without backslashes). The default is the local computer.

/u [<Domain>\]<User>

Runs this command with the permissions of the specified user account. The default is the permissions of the current user of the local computer. The specified user account must be a member of the Administrators group on the remote computer. The /u and /p parameters are valid only for changing a task on a remote computer (/s).

/p <Password>

Specifies the password of the user account specified in the /u parameter. If you use the /u parameter, but omit the /p parameter or the password argument, schtasks prompts you for a password.

The /u and /p parameters are valid only when you use /s.

/ru {[<Domain>\]<User> | System}

Specifies to change the user account under which the task runs. For specifying the local System account, valid entries are "", "NT AUTHORITY\SYSTEM", or "SYSTEM".

When you change the user account, you must also change the user password. If a command has an /ru parameter but not an /rp parameter, schtasks prompts for a new password.

Tasks run with permissions of the local System account do not require or prompt for a password.

/rp <Password>

Specifies a new password for the existing user account, or the user account specified by the /ru parameter. This parameter is ignored with used with the local System account.

/tr <TaskRun>

Changes the program that the task runs. Enter the fully qualified path and file name of an executable file, script file, or batch file. If you omit the path, schtasks assumes that the file is in the <systemroot>\System32 directory. The specified program replaces the original program run by the task.

/st <Starttime>

Specifies the start time for the task, using the 24-hour time format, HH:mm. For example, a value of 14:30 is equivalent to the 12-hour time of 2:30 PM.

/ri <Interval>

Specifies the repetition interval for the scheduled task, in minutes. Valid range is 1 - 599940 (599940 minutes = 9999 hours).

/et <EndTime>

Specifies the end time for the task, using the 24-hour time format, HH:mm. For example, a value of 14:30 is equivalent to the 12-hour time of 2:30 PM.

/du <Duration>

Specifies to close the task at the <EndTime> or <Duration>, if specified.

/k

Stops the program that the task runs at the time specified by /et or /du. Without /k, schtasks does not start the program again after it reaches the time specified by /et or /du, but it does not stop the program if it is still running. This parameter is optional and valid only with a MINUTE or HOURLY schedule.

/sd <StartDate>

Specifies the first date on which the task should be run. The date format is MM/DD/YYYY.

/ed <EndDate>

Specifies the last date on which the task should be run. The format is MM/DD/YYYY.

/ENABLE

Specifies to enable the scheduled task.

/DISABLE

Specifies to disable the scheduled task.

/it

Specifies to run the scheduled task only when the "run as" user (the user account under which the task runs) is logged on to the computer.

This parameter has no effect on tasks that run with system permissions or tasks that already have the interactive-only property set. You can not use a change command to remove the interactive-only property from a task.

By default, the "run as" user is the current user of the local computer when the task is scheduled or the account specified by the /u parameter, if one is used. However, if the command includes the /ru parameter, then the "run as" user is the account specified by the /ru parameter.

/z

Specifies to delete the task upon the completion of its schedule.

/?

Displays help at the command prompt.

Remarks
  • The /tn and /s parameters identify the task. The /tr, /ru, and /rp parameters specify properties of the task that you can change.

  • The /ru, and /rp parameters specify the permissions under which the task runs. The /u and /p parameters specify the permissions used to change the task.

  • To change tasks on a remote computer, the user must be logged on to the local computer with an account that is a member of the Administrators group on the remote computer.

  • To run a /change command with the permissions of a different user (/u, /p), the local computer must be in the same domain as the remote computer or must be in a domain that the remote computer domain trusts.

  • The System account does not have interactive logon rights. Users do not see and cannot interact with programs run with system permissions.

  • To identify tasks with the /it property, use a verbose query (/query /v). In a verbose query display of a task with /it, the Logon Mode field has a value of Interactive only.

Examples
To change the program that a task runs

The following command changes the program that the Virus Check task runs from VirusCheck.exe to VirusCheck2.exe. This command uses the /tn parameter to identify the task and the /tr parameter to specify the new program for the task. (You cannot change the task name.)

Copy Code
schtasks /change /tn "Virus Check" /tr C:\VirusCheck2.exe

In response, SchTasks.exe displays the following success message:

Copy Code
SUCCESS: The parameters of the scheduled task "Virus Check" have been changed.

As a result of this command, the Virus Check task now runs VirusCheck2.exe.

To change the password for a remote task

The following command changes the password of the user account for the RemindMe task on the remote computer, Svr01. The command uses the /tn parameter to identify the task and the /s parameter to specify the remote computer. It uses the /rp parameter to specify the new password, p@ssWord3.

This procedure is required whenever the password for a user account expires or changes. If the password saved in a task is no longer valid, then the task does not run.

Copy Code
schtasks /change /tn RemindMe /s Svr01 /rp p@ssWord3

In response, SchTasks.exe displays the following success message:

Copy Code
SUCCESS: The parameters of the scheduled task "RemindMe" have been changed.

As a result of this command, the RemindMe task now runs under its original user account, but with a new password.

To change the program and user account for a task

The following command changes the program that a task runs and changes the user account under which the task runs. Essentially, it uses an old schedule for a new task. This command changes the ChkNews task, which starts Notepad.exe every morning at 9:00 A.M., to start Internet Explorer instead.

The command uses the /tn parameter to identify the task. It uses the /tr parameter to change the program that the task runs and the /ru parameter to change the user account under which the task runs.

The /ru, and /rp parameter, which provides the password for the user account, is omitted. You must provide a password for the account, but you can use the /ru, and /rp parameter and type the password in clear text, or wait for SchTasks.exe to prompt you for a password, and then enter the password in obscured text.

Copy Code
schtasks /change /tn ChkNews /tr "c:\program files\Internet Explorer\iexplore.exe" /ru DomainX\Admin01

In response, SchTasks.exe requests the password for the user account. It obscures the text you type, so the password is not visible.

Copy Code
Please enter the password for DomainX\Admin01:

Note that the /tn parameter identifies the task and that the /tr and /ru parameters change the properties of the task. You cannot use another parameter to identify the task and you cannot change the task name.

In response, SchTasks.exe displays the following success message:

Copy Code
SUCCESS: The parameters of the scheduled task "ChkNews" have been changed.

As a result of this command, the ChkNews task now runs Internet Explorer with the permissions of an Administrator account.

To change a program to the System account

The following command changes the SecurityScript task so that it runs with permissions of the System account. It uses the /ru "" parameter to indicate the System account.

Copy Code
schtasks /change /tn SecurityScript /ru ""

In response, SchTasks.exe displays the following success message:

Copy Code
INFO: The run as user name for the scheduled task "SecurityScript" will be changed to "NT AUTHORITY\SYSTEM".
SUCCESS: The parameters of the scheduled task "SecurityScript" have been changed.

Because tasks run with System account permissions do not require a password, SchTasks.exe does not prompt for one.

To run a program only when I am logged on

The following command adds the interactive-only property to MyApp, an existing task. This property assures that the task runs only when the "run as" user, that is, the user account under which the task runs, is logged on to the computer.

The command uses the /tn parameter to identify the task and the /it parameter to add the interactive-only property to the task. Because the task already runs with the permissions of my user account, I do not need to change the /ru parameter for the task.

Copy Code
schtasks /change /tn MyApp /it

In response, SchTasks.exe displays the following success message.

Copy Code
SUCCESS: The parameters of the scheduled task "MyApp" have been changed.

schtasks run

Starts a scheduled task immediately. The run operation ignores the schedule, but uses the program file location, user account, and password saved in the task to run the task immediately.
Syntax
Copy Code
schtasks /run /tn <TaskName> [/s <Computer> [/u [<Domain>\]<User> [/p <Password>]]]
Parameters

Term Definition

/tn <TaskName>

Required. Identifies the task.

/s <Computer>

Specifies the name or IP address of a remote computer (with or without backslashes). The default is the local computer.

/u [<Domain>\]<User>

Runs this command with the permissions of the specified user account. By default, the command runs with the permissions of the current user of the local computer.

The specified user account must be a member of the Administrators group on the remote computer. The /u and /p parameters are valid only when you use /s.

/p <Password>

Specifies the password of the user account specified in the /u parameter. If you use the /u parameter, but omit the /p parameter or the password argument, schtasks prompts you for a password.

The /u and /p parameters are valid only when you use /s.

/?

Displays help at the command prompt.

Remarks
  • Use this operation to test your tasks. If a task does not run, check the Task Scheduler Service transaction log, <Systemroot>\SchedLgU.txt, for errors.

  • Running a task does not affect the task schedule and does not change the next run time scheduled for the task.

  • To run a task remotely, the task must be scheduled on the remote computer. When you run it, the task runs only on the remote computer. To verify that a task is running on a remote computer, use Task Manager or the Task Scheduler transaction log, <Systemroot>\SchedLgU.txt.

Examples
To run a task on the local computer

The following command starts the "Security Script" task.

Copy Code
schtasks /run /tn "Security Script"

In response, SchTasks.exe starts the script associated with the task and displays the following message:

Copy Code
SUCCESS: Attempted to run the scheduled task "Security Script".

As the message implies, schtasks tries to start the program, but it cannot very that the program actually started.

To run a task on a remote computer

The following command starts the Update task on a remote computer, Svr01:

Copy Code
schtasks /run /tn Update /s Svr01

In this case, SchTasks.exe displays the following error message:

Copy Code
ERROR: Unable to run the scheduled task "Update".

To find the cause of the error, look in the Scheduled Tasks transaction log, C:\Windows\SchedLgU.txt on Svr01. In this case, the following entry appears in the log:

Copy Code
"Update.job" (update.exe) 3/26/2001 1:15:46 PM ** ERROR **
The attempt to log on to the account associated with the task failed, therefore, the task did not run.
The specific error is:
0x8007052e: Logon failure: unknown user name or bad password.
Verify that the task's Run-as name and password are valid and try again.

Apparently, the user name or password in the task is not valid on the system. The following schtasks /change command updates the user name and password for the Update task on Svr01:

Copy Code
schtasks /change /tn Update /s Svr01 /ru Administrator /rp PassW@rd3

After the change command completes, the run command is repeated. This time, the Update.exe program starts and SchTasks.exe displays the following message:

Copy Code
SUCCESS: Attempted to run the scheduled task "Update".

As the message implies, schtasks tries to start the program, but it cannot very that the program actually started.

schtasks end

Stops a program started by a task.
Syntax
Copy Code
schtasks /end /tn <TaskName> [/s <Computer> [/u [<Domain>\]<User> [/p <Password>]]]
Parameters

Term | Definition
/tn <TaskName> | Required. Identifies the task that started the program.
/s <Computer> | Specifies the name or IP address of a remote computer. The default is the local computer.
/u [<Domain>\]<User> | Runs this command with the permissions of the specified user account. By default, the command runs with the permissions of the current user of the local computer. The specified user account must be a member of the Administrators group on the remote computer. The /u and /p parameters are valid only when you use /s.
/p <Password> | Specifies the password of the user account specified in the /u parameter. If you use the /u parameter, but omit the /p parameter or the password argument, schtasks prompts you for a password. The /u and /p parameters are valid only when you use /s.
/? | Displays help.
Remarks

SchTasks.exe ends only the instances of a program started by a scheduled task. To stop other processes, use TaskKill, a tool included in Windows XP Professional. For more information about TaskKill, see Taskkill

Examples
To end a task on a local computer

The following command stops the instance of Notepad.exe that was started by the My Notepad task:

Copy Code
schtasks /end /tn "My Notepad"

In response, SchTasks.exe stops the instance of Notepad.exe that the task started, and it displays the following success message:

Copy Code
SUCCESS: The scheduled task "My Notepad" has been terminated successfully.
To end a task on a remote computer

The following command stops the instance of Internet Explorer that was started by the InternetOn task on the remote computer, Svr01:

Copy Code
schtasks /end /tn InternetOn /s Svr01

In response, SchTasks.exe stops the instance of Internet Explorer that the task started, and it displays the following success message:

Copy Code
SUCCESS: The scheduled task "InternetOn" has been terminated successfully.

schtasks delete

Deletes a scheduled task.
Syntax
Copy Code
schtasks /delete /tn {<TaskName> | *} [/f] [/s <Computer> [/u [<Domain>\]<User> [/p <Password>]]]
Parameters

Term Definition

/tn {<TaskName>| *}

Required. Identifies the task being deleted.

<TaskName> - Deletes the named task.

<*> - Deletes all scheduled tasks on the computer.

/f

Suppresses the confirmation message. The task is deleted without warning.

/s <Computer>

Specifies the name or IP address of a remote computer (with or without backslashes). The default is the local computer.

/u [<Domain>\]<User>

Runs this command with the permissions of the specified user account. By default, the command runs with the permissions of the current user of the local computer.

The specified user account must be a member of the Administrators group on the remote computer. The /u and /p parameters are valid only when you use /s.

/p <Password>

Specifies the password of the user account specified in the /u parameter. If you use the /u parameter, but omit the /p parameter or the password argument, schtasks prompts you for a password.

The /u and /p parameters are valid only when you use /s.

/?

Displays help at the command prompt.

Remarks
  • The delete operation deletes the task from the schedule. It does not delete the program that the task runs or interrupt a running program.

  • The delete * command deletes all tasks scheduled for the computer, not just the tasks scheduled by the current user.

Examples
To delete a task from the schedule of a remote computer

The following command deletes the "Start Mail" task from the schedule of a remote computer. It uses the /s parameter to identify the remote computer.

Copy Code
schtasks /delete /tn "Start Mail" /s Svr16

In response, SchTasks.exe displays the following confirmation message. To delete the task, press Y. To cancel the command, type n:

Copy Code
WARNING: Are you sure you want to remove the task "Start Mail" (Y/N )?
SUCCESS: The scheduled task "Start Mail" was successfully deleted.
To delete all tasks scheduled for the local computer

The following command deletes all tasks from the schedule of the local computer, including tasks scheduled by other users. It uses the /tn * parameter to represent all tasks on the computer and the /f parameter to suppress the confirmation message.

Copy Code
schtasks /delete /tn * /f

In response, SchTasks.exe displays the following success messages indicating that the only task scheduled, SecureScript, is deleted.

SUCCESS: The scheduled task "SecureScript" was successfully deleted.

schtasks query

Displays tasks scheduled to run on the computer.
Syntax
Copy Code
schtasks [/query] [/fo {TABLE | LIST | CSV}] [/nh] [/v] [/s <Computer> [/u [<Domain>\]<User> [/p <Password>]]]
Parameters

Term Definition

[/query]

The operation name is optional. Typing schtasks without any parameters performs a query.

/fo {TABLE| LIST| CSV}

Specifies the output format. TABLE is the default.

/nh

Omits column headings from the table display. This parameter is valid with the TABLE and CSV output formats.

/v

Adds advanced properties of the tasks to the display.

Queries using /v should be formatted as LIST or CSV.

/s <Computer>

Specifies the name or IP address of a remote computer (with or without backslashes). The default is the local computer.

/u [<Domain>\]<User>

Runs this command with the permissions of the specified user account. By default, the command runs with the permissions of the current user of the local computer.

The specified user account must be a member of the Administrators group on the remote computer. The /u and /p parameters are valid only when you use /s.

/p <Password>

Specifies the password of the user account specified in the /u parameter. If you use /u, but omit /p or the password argument, schtasks prompts you for a password.

The /u and /p parameters are valid only when you use /s.

/?

Displays help at the command prompt.

Remarks

The query operation lists all tasks that the user has permission to view. Administrators can view all tasks on the computer. Users can view only the tasks that they scheduled.

Examples
To display the scheduled tasks on the local computer

The following commands display all tasks scheduled for the local computer. These commands produce the same result and can be used interchangeably.

Copy Code
schtasks
schtasks /query

In response, SchTasks.exe displays the tasks in the default, simple table format, as shown in the following table:

Copy Code
TaskName Next Run Time Status
========================= ======================== ==============
Microsoft Outlook At logon time
SecureScript 14:42:00 PM , 2/4/2001
To display advanced properties of scheduled tasks

The following command requests a detailed display of the tasks on the local computer. It uses the /v parameter to request a detailed (verbose) display and the /fo LIST parameter to format the display as a list for easy reading. You can use this command to verify that a task you created has the intended recurrence pattern.

schtasks /query /fo LIST /v

In response, SchTasks.exe displays a detailed property list for all tasks. The following display shows the task list for a task scheduled to run at 4:00 A.M. on the last Friday of every month:

Copy Code
HostName: RESKIT01
TaskName: SecureScript
Next Run Time: 4:00:00 AM , 3/30/2001
Status: Not yet run
Logon mode: Interactive/Background
Last Run Time: Never
Last Result: 0
Creator: user01
Schedule: At 4:00 AM on the last Fri of every month, starting 3/24/2001
Task To Run: C:\WINDOWS\system32\notepad.exe
Start In: notepad.exe
Comment: N/A
Scheduled Task State: Enabled
Scheduled Type: Monthly
Modifier: Last FRIDAY
Start Time: 4:00:00 AM
Start Date: 3/24/2001
End Date: N/A
Days: FRIDAY
Months: JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OCT,NOV,DEC
Run As User: RESKIT\user01
Delete Task If Not Rescheduled: Enabled
Stop Task If Runs X Hours and X Mins: 72:0
Repeat: Until Time: Disabled
Repeat: Duration: Disabled
Repeat: Stop If Still Running: Disabled
Idle: Start Time(For IDLE Scheduled Type): Disabled
Idle: Only Start If Idle for X Minutes: Disabled
Idle: If Not Idle Retry For X Minutes: Disabled
Idle: Stop Task If Idle State End: Disabled
Power Mgmt: No Start On Batteries: Disabled
Power Mgmt: Stop On Battery Mode: Disabled
To log tasks scheduled for a remote computer

The following command requests a list of tasks scheduled for a remote computer, and adds the tasks to a comma-separated log file on the local computer. You can use this command format to collect and track tasks that are scheduled for multiple computers.

The command uses the /s parameter to identify the remote computer, Reskit16, the /fo parameter to specify the format and the /nh parameter to suppress the column headings. The >> append symbol redirects the output to the task log, p0102.csv, on the local computer, Svr01. Because the command runs on the remote computer, the local computer path must be fully qualified.

Copy Code
schtasks /query /s Reskit16 /fo csv /nh >> \\svr01\data\tasklogs\p0102.csv

In response, SchTasks.exe adds the tasks scheduled for the Reskit16 computer to the p0102.csv file on the local computer, Svr01.

Additional references

Command-Line Syntax Key


Set

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows XP,Windows Server 2003,Windows Vista,Windows Server 2000,Windows Server 2003 R2,Windows 7

Displays, sets, or removes CMD.EXE environment variables. If used without parameters, set displays the current environment variable settings.

For examples of how to use this command, see Examples.

Syntax

Copy Code
set [<Variable>=[<String>]]
set [/p] <Variable>=[<PromptString>]
set /a <Variable>=<Expression>

Parameters

Parameter | Description
<Variable> | Specifies the environment variable to set or modify.
<String> | Specifies the string to associate with the specified environment variable.
/p | Sets the value of Variable to a line of input entered by the user.
<PromptString> | Optional. Specifies a message to prompt the user for input. This parameter is used with the /p command-line option.
/a | Sets String to a numerical expression that is evaluated.
<Expression> | Specifies a numerical expression. See Remarks for valid operators that can be used in Expression.
/? | Displays help at the command prompt.

Remarks

  • Using set with command extensions enabled

    When command extensions are enabled (the default) and you run set with a value, it displays all of the variables that begin with that value.

  • Using special characters

    The characters <, >, |, &, ^ are special command shell characters, and they must be preceded by the escape character (^) or enclosed in quotation marks when used in String (for example, "StringContaining&Symbol"). If you use quotation marks to enclose a string that contains one of the special characters, the quotation marks are set as part of the environment variable value.

  • Using environment variables

    Use environment variables to control the behavior of some batch files and programs and to control the way Windows and the MS-DOS subsystem appears and works. The set command is often used in the Autoexec.nt file to set environment variables.

  • Displaying the current environment settings

    When you type the set command alone, the current environment settings are displayed. These settings usually include the COMSPEC and PATH environment variables, which are used to help find programs on disk. Two other environment variables used by Windows are PROMPT and DIRCMD.

  • Using parameters

    When you specify values for Variable and String, the specified variable value is added to the environment and String is associated with that variable. If the variable already exists in the environment, the new string value replaces the old string value.

    If you specify only a variable and an equal sign (without String) for the set command, the String value associated with the variable is cleared (as if the variable is not there).

  • Using /a

    The following table lists the operators supported for /a in descending order of precedence.

    Operator Operation performed

    ( )

    Grouping

    ! ~ -

    Unary

    * / %

    Arithmetic

    + -

    Arithmetic

    << >>

    Logical shift

    &

    Bitwise AND

    ^

    Bitwise exclusive OR

    |

    Bitwise OR

    = *= /= %= += -= &= ^= |= <<= >>=

    Assignment

    ,

    Expression separator

    If you use logical (&& or ||) or modulus (%) operators, enclose the expression string in quotation marks. Any non-numeric strings in the expression are considered environment variable names, and their values are converted to numbers before they are processed. If you specify an environment variable name that is not defined in the current environment, a value of zero is allotted, which allows you to perform arithmetic with environment variable values without using the % to retrieve a value.

    If you run set /a from the command line outside of a command script, it displays the final value of the expression.

    Numeric values are decimal numbers unless prefixed by 0× for hexadecimal numbers or 0 for octal numbers. Therefore, 0×12 is the same as 18, which is the same as 022.

  • Supporting delayed environment variable expansion

    Delayed environment variable expansion support is disabled by default, but you can enable or disable it by using cmd /v.

  • Working with command extensions

    When command extensions are enabled (the default) and you run set alone, it displays all current environment variables. If you run set with a value, it displays the variables that match that value.

  • Using set in batch files

    When creating batch files, you can use set to create variables, and then use them in the same way that you would use the numbered variables %0 through %9. You can also use the variables %0 through %9 as input for set.

  • Calling a set variable from a batch file

    When you call a variable value from a batch file, enclose the value with percent signs (%). For example, if your batch program creates an environment variable named BAUD, you can use the string associated with BAUD as a replaceable parameter by typing %baud% at the command prompt.

  • Using set at the Recovery Console

    The set command, with different parameters, is available from the Recovery Console.

Examples

To set an environment variable named TEST^1, type:

Copy Code
set testVar=test^^1
Note
The set command assigns everything that follows the equal sign (=) to the value of the variable. If you type:

Copy Code
set testVar="test^1"

You get the following result:

Copy Code
testVar="test^1"

To set an environment variable named TEST&1, type:

Copy Code
set testVar=test^&1

To set an environment variable named INCLUDE so that the string C:\Inc (the \Inc directory on drive C) is associated with it, type:

Copy Code
set include=c:\inc

You can then use the string C:\Inc in batch files by enclosing the name INCLUDE with percent signs (%). For example, you might include the following command in a batch file so that you can display the contents of the directory that is associated with the INCLUDE environment variable:

Copy Code
dir %include%

When this command is processed, the string C:\Inc replaces %include%.

You can also use set in a batch program that adds a new directory to the PATH environment variable. For example:

Copy Code
@echo off
rem ADDPATH.BAT adds a new directory
rem to the path environment variable.
set path=%1;%path%
set

To display a list of all of the environment variables that begin with the letter P, type:

Copy Code
set p
Note
This command requires command extensions, which are enabled by default.

Additional references

Command-Line Syntax Key


Setspn

Applies To: Windows Server 2008 R2,Windows Server 2008

Reads, modifies, and deletes the Service Principal Names (SPN) directory property for an Active Directory service account. You use SPNs to locate a target principal name for running a service. You can use setspn to view the current SPNs, reset the account's default SPNs, and add or delete supplemental SPNs.

Setspn is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) server role installed. To use setspn, you must run the setspn command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

It is not usually necessary to modify SPNs. They are set up by a computer when it joins a domain and when services are installed on the computer. In some cases, however, this information can become stale. For instance, if the computer name is changed, the SPNs for installed services must be changed to match the new computer name. Also, some services and applications may require manual modification of a service account's SPN information to authenticate correctly.

For more information about checking SPN registrations and troubleshooting SPNs, see Service Principal Names (http://go.microsoft.com/fwlink/?LinkId=198395). For more information about how a service registers SPNs and how clients compose a service’s SPN, see Service Principal Names (http://go.microsoft.com/fwlink/?LinkId=102556).

In Active Directory, the servicePrincipalName attribute is a multivalued, nonlinked attribute that is built from the DNS host name. The SPN is used in the process of mutual authentication between the client and the server hosting a particular service. The client finds a computer account based on the SPN of the service to which it is trying to connect.

To perform the tasks that are described in the following sections, you must have membership in Domain Admins, Enterprise Admins, or you must have been delegated the appropriate authority. For information on delegating the permissions to modify SPNs, see Delegating Authority to Modify SPNs.

The following sections describe how to run basic Setspn.exe commands. For additional information about the options for Setspn.exe, see Setspn Syntax, Setspn Remarks, and Setspn Examples.

SPN format

When you manipulate SPNs with the setspn, the SPN must be entered in the correct format. The format of an SPN is serviceclass/host:port/servicename, in which each item represents a name or value. Unless the service name and port are not standard, you do not have to enter them when you use setspn. For example, the default SPNs for a server named WS2003A that is providing remote desktop (RDP) services over the default port (TCP 3389) register the following two SPNs in its own Active Directory computer object:

TERMSRV/WS2003A

TERMSRV/WS2003A.cpandl.com

The examples in the following sections assume that the default port and service name are used for SPNs, which is the typical situation. However, if you need to specify a nonstandard SPN configuration, see Name Formats for Unique SPNs

(http://go.microsoft.com/fwlink/?LinkId=102555).

Viewing SPNs

To view a list of the SPNs that a computer has registered with Active Directory from a command prompt, use the setspn –l hostname command, where hostname is the actual host name of the computer object that you want to query.

Note
To find the host name for a computer from a command prompt, type hostname, and then press ENTER.

For example, to list the SPNs of a computer named WS2003A, at the command prompt, type setspn -l S2003A, and then press ENTER. A domain controller named WS2003A in Cpandl.com, which is also functioning as a global catalog server and Domain Name System (DNS) server, registers the following SPNs:

Registered ServicePrincipalNames for CN=WS2003A,OU=Domain Controllers,DC=cpandl,DC=com:

ldap/WS2003A.cpandl.com/ForestDnsZones.cpandl.com

ldap/WS2003A.cpandl.com/DomainDnsZones.cpandl.com

NtFrs-88f5d2bd-b646-11d2-a6d3-00c04fc9b232/WS2008A.cpandl.com

DNS/WS2003A.cpandl.com

GC/WS2003A.cpandl.com/cpandl.com

HOST/WS2003A.cpandl.com/CPANDL

HOST/WS2003A

HOST/WS2003A.cpandl.com

HOST/WS2003A.cpandl.com/cpandl.com

E3514235-4B06-11D1-AB04-00C04FC2DCD2/70906edd-c8a5-4b7d-8198-4f970f7b9f52/cpandl.com

ldap/70906edd-c8a5-4b7d-8198-4f970f7b9f52._msdcs.cpandl.com

ldap/WS2003A.cpandl.com/CPANDL

ldap/WS2003A

ldap/WS2003A.cpandl.com

ldap/WS2003A.cpandl.com/cpandl.com

The globally unique identifier (GUID) 70906edd-c8a5-4b7d-8198-4f970f7b9f52 identifies the NTDS Settings object of the domain controller (NTDS-DSA), which is unique for each domain controller. The other two GUIDs, NtFrs-88f5d2bd-b646-11d2-a6d3-00c04fc9b232 and E3514235-4B06-11D1-AB04-00C04FC2DCD2, identify the File Replication Service (NTFRS) and the Directory Replication Service (DRS) remote procedure call (RPC), respectively, and they are standard SPNs for all domain controllers.

Note
If constrained delegation is in use on a Windows Server 2003 computer that requires an SPN modification, some SPNs may not appear. For more information, see article 936628 in the Microsoft Knowledge Base (http://go.microsoft.com/fwlink/?LinkID=102306).

Resetting SPNs

If the SPNs that you see for your server display what seems to be incorrect names; consider resetting the computer to use the default SPNs. To reset the default SPN values, use the setspn -r hostname command at a command prompt, where hostname is the actual host name of the computer object that you want to update.

For example, to reset the SPNs of a computer named server2, type setspn -r server2, and then press ENTER. You receive confirmation if the reset is successful. To verify that the SPNs are displayed correctly, type setspn -l server2, and then press ENTER.

Note
For information related to troubleshooting SPN issues, see Service Logons Fail Due to Incorrectly Set SPNs (http://go.microsoft.com/fwlink/?LinkId=102554).

Adding SPNs

To add an SPN, use the setspn -a service/name hostname command at a command prompt, where service/name is the SPN that you want to add and hostname is the actual host name of the computer object that you want to update. For example, if there is an Active Directory domain controller with the host name server1.contoso.com that requires an SPN for the Lightweight Directory Access Protocol (LDAP), type setspn -a ldap/server1.contoso.com server1, and then press ENTER to add the SPN.

Removing SPNs

To remove an SPN, use the setspn -d service/name hostname command at a command prompt, where service/name is the SPN that is to be removed and hostname is the actual host name of the computer object that you want to update. For example, if the SPN for the Web service on a computer named Server3.contoso.com is incorrect, you can remove it by typing setspn -d http/server3.contoso.com server3, and then pressing ENTER.

Delegating Authority to Modify SPNs

If you need to allow delegated administrators to configure service principal names (SPNs), you must ensure that their user accounts have the Validated write to service principle name permission.

Membership in Domain Admins, or equivalent, is the minimum required to complete this procedure. Review details about using the appropriate accounts and group memberships at Local and Domain Default Groups (http://go.microsoft.com/fwlink/?LinkId=83477).

To grant permission to modify SPNs

  1. Open Active Directory Users and Computers.

    To open Active Directory Users and Computers, click Start, click Run, type dsa.msc, and then press ENTER.

  2. Click View, and verify that the Advanced Features check box is selected.

  3. Click Advanced Features, if it is not selected.

    If the domain to which you want to allow a disjoint namespace does not appear in the console, take the following steps:

    1. In the console tree, right-click Active Directory Users and Computers, and then click Connect to Domain.

    2. In the Domain box, type the name of the Active Directory domain to which you want to allow the disjoint namespace, and then click OK.

      As an alternative, you can use the Browse button to locate the Active Directory domain.

  4. In the console tree, right-click the node that represents the domain to which you want to allow a disjoint namespace, and then click Properties.

  5. On Security tab, click Advanced.

  6. On the Permissions tab, click Add.

  7. In Enter the object name to select, type the group or user account name to which you want to delegate permission, and then click OK.

  8. Configure the Apply onto box for Computer objects.

  9. At the bottom of the Permissions box, select the Allow check box that corresponds to the Validated write to service principal name permissions, and then click OK on the three open dialog boxes to confirm your changes.

  10. Close Active Directory Users and Computers.

Syntax

Copy Code
setspn <Computer> [-l] [-r] [-a <SPN>] [-d <SPN>] [-s <SPN>] [-?]

In Windows Server 2008 R2 and Windows Server 2008, Setspn.exe has Edit Mode switches and modifiers and Query Mode switches and modifiers. The syntax is:

Copy Code
setspn [modifiers switch] [accountname]

Where [accountname] can be the name or domain\name of the target computer or user account.

Parameters

Edit Mode Parameters Description

<Computer>

Specifies the desired Active Directory account object for which to configure the Service Principal Names (SPN). Normally, this is the NetBIOS name of the computer and optionally the domain that contains the computer account. However, any desired Active Directory object name can be used.

-l

Lists the currently registered SPN for computer.

Usage: setspn –l accountname

-r

Resets the default SPN registrations for the host names for Computer.

Usage: setspn –r accountname

For example, to register SPN "HOST/daserver1" and "HOST/{DNS of daserver1}":

Copy Code
setspn -R daserver1

-a <SPN>

Adds the specified SPN for the Computer.

Usage: setspn – a SPN accountname

For example, to register SPN "http/daserver" for computer "daserver1":

Copy Code
setspn -A http/daserver daserver1

-d <SPN>

Deletes the specified SPN for the Computer.

Usage: setspn –d SPN accountname

For example, to delete SPN "http/daserver" for computer "daserver1":

Copy Code
setspn -D http/daserver daserver1

-s <SPN>

Adds the specified SPN after verifying that no duplicates exist.

Usage: setspn –s SPN accountname

-?

Displays help at the command prompt. This parameter is the default: if you run setspn run without this parameter displays the SPN command-line usage.

Edit Mode modifiers

Description

-C

Specify that accountname is a computer account.

-U

Specify that accountname is a user account.

For example, to register SPN "http/daserver" for user account "dauser":

Copy Code
setspn -U -A http/daserver dauser
Note
-C and -U are exclusive. If neither is specified, the tool will interpret accountname as a computer name if such a computer exists, and a user name if it does not.

Query Mode Parameters

Description

-Q <SPN>

Query for existence of SPN.

Usage: setspn -Q SPN

-X

Note
Searching for duplicates, especially forest-wide, can take a long period of time and a large amount of memory.

Search for duplicate SPNs.

Usage: setspn -X

Query Mode modifiers

Description

-F

Perform queries at the forest, rather than domain level.

For example, to register SPN "http/daserver" for computer "daserver1" if no such SPN exists in the forest:

Copy Code
setspn -F -S http/daserver daserver1

-T

Perform query on the specified domain or forest (when -F is also used).

Usage: setspn -T domain (switches and other parameters). Use "" or * to indicate the current domain or forest.

For example, to report all duplicate registration of SPNs in this domain and contoso domain:

Copy Code
setspn -T * -T contoso -X

To find all SPNs of the form */daserver registered in the forest to which contoso domain belongs:

Copy Code
setspn -T contoso -F -Q */daserver

Remarks

  • Query Mode modifiers can be used with the -S switch in order to specify where the check for duplicates should be performed before adding the SPN.

  • -T can be specified multiple times. -Q will execute on each target domain or forest. -X will return duplicates that exist across all targets. Service Principal Names (SPNs) are not required to be unique across forests, but duplicate SPNs can cause authentication issues during cross-forest authentication.

  • SPNs can only be constructed by using the account base name as the Computer parameter. The directory service enforces this by generating a constraint violation error.

    You may not have the rights to access or modify this property on some account objects. You can determine what your access rights are by viewing the security attributes of the account object using the Microsoft Management Console (MMC) in Active Directory Users and Computers. You can also delegate the permission by assigning the Validated write to service principal name permission to the desired user or group.

  • The built-in SPNs that are recognized for computer accounts are:

    alerter

    appmgmt

    browser

    cifs

    cisvc

    clipsrv

    dcom

    dhcp

    dmserver

    dns

    dnscache

    eventlog

    eventsystem

    fax

    http

    ias

    iisadmin

    messenger

    msiserver

    mcsvc

    netdde

    netddedsm

    netlogon

    netman

    nmagent

    oakley

    plugplay

    policyagent

    protectedstorage

    rasman

    remoteaccess

    replicator

    rpc

    rpclocator

    rpcss

    rsvp

    samss

    scardsvr

    scesrv

    schedule

    scm

    seclogon

    snmp

    spooler

    tapisrv

    time

    trksvr

    trkwks

    ups

    w3svc

    wins

    www
    These SPNs are recognized for computer accounts if the computer has a host SPN. Unless they are explicitly placed on objects, a host SPN can substitute for any of the above SPNs.

  • Service Principal Names (SPNs) are not case sensitive when used by Microsoft Windows-based computers. However, an SPN can be used by any type of computer system. Many of these computer systems, especially UNIX-based systems, are case-sensitive and require the proper case to function properly. Care should be taken to use the proper case particularly when an SPN can be used by a non-Windows-based computer.

Examples

Example 1: List currently registered SPNs

Copy Code
                        setspn -l daserver1
Registered ServicePrincipalNames for CN=DASERVER1,CN=Computers,DC=reskit,DC=contoso,DC=com:
HOST/daserver1
HOST/daserver1.reskit.contoso.com

Example 2: Reset default registered SPNs

Copy Code
                        setspn -r daserver1
Registering ServicePrincipalNames for CN=DASERVER1,CN=Computers,DC=reskit,DC=contoso,DC=com
HOST/daserver1.reskit.contoso.com
HOST/daserver1
Updated object

Example 3: Add a new SPN

Copy Code
                        setspn -a http/daserver1.reskit.contoso.com daserver1
Registering ServicePrincipalNames for CN=DASERVER1,CN=Computers,DC=reskit,DC=contoso,DC=com
http/daserver1.reskit.contoso.com
Updated object

Example 4: Remove an SPN

Copy Code
                        setspn -d http/daserver1.reskit.contoso.com daserver1
Unregistering ServicePrincipalNames for CN=DASERVER1,CN=Computers,DC=reskit,DC=contoso,DC=com
http/daserver1.reskit.contoso.com
Updated object

Additional references

Command-Line Syntax Key


Setlocal

Applies To: Windows Server 2008,Windows Vista

Starts localization of environment variables in a batch file. Localization continues until a matching endlocal command is encountered or the end of the batch file is reached.

For examples of how to use this command, see Examples.

Syntax

Copy Code
setlocal [enableextensions | disableextensions] [enabledelayedexpansion | disabledelayedexpansion]

Arguments

Argument | Description
enableextensions | Enables the command extensions until the matching endlocal command is encountered, regardless of the setting before the setlocal command was run.
disableextensions | Disables the command extensions until the matching endlocal command is encountered, regardless of the setting before the setlocal command was run.
enabledelayedexpansion | Enables the delayed environment variable expansion until the matching endlocal command is encountered, regardless of the setting before the setlocal command was run.
disabledelayedexpansion | Disables the delayed environment variable expansion until the matching endlocal command is encountered, regardless of the setting before the setlocal command was run.
/? | Displays help at the command prompt.

Remarks

  • Using setlocal

    When you use setlocal outside of a script or batch file, it has no effect.

  • Changing environmental variables

    Use setlocal to change environment variables when you run a batch file. Environment changes made after you run setlocal are local to the batch file. The Cmd.exe program restores previous settings when it encounters an endlocal command or reaches the end of the batch file.

  • Nesting commands

    You can have more than one setlocal or endlocal command in a batch program (that is, nested commands).

  • Testing for command extensions in batch files

    The setlocal command sets the ERRORLEVEL variable. If you pass {enableextensions | disableextensions} or {enabledelayedexpansion | disabledelayedexpansion}, the ERRORLEVEL variable is set to 0 (zero). Otherwise, it is set to 1. You can use this information in batch scripts to determine whether the extensions are available, as shown in the following example:

    Copy Code
    setlocal enableextensions
verify other 2>nul
if errorlevel 1 echo Unable to enable extensions
    Because cmd does not set the ERRORLEVEL variable when command extensions are disabled, the verify command initializes the ERRORLEVEL variable to a nonzero value when you use it with an invalid argument. Also, if you use the setlocal command with arguments {enableextensions | disableextensions} or {enabledelayedexpansion | disabledelayedexpansion} and it does not set the ERRORLEVEL variable to 1, command extensions are not available.

Examples

You can localize environment variables in a batch file, as shown in the following sample script:

Copy Code
rem *******Begin Comment**************
rem This program starts the superapp batch program on the network,
rem directs the output to a file, and displays the file
rem in Notepad.
rem *******End Comment**************
@echo off
setlocal
path=g:\programs\superapp;%path%
call superapp>c:\superapp.out
endlocal
start notepad c:\superapp.out

Additional references

Command-Line Syntax Key


Setx

Applies To: Windows Server 2008,Windows Vista

Creates or modifies environment variables in the user or system environment, without requiring programming or scripting. The Setx command also retrieves the values of registry keys and writes them to text files.

For examples of how to use this command, see Examples.

Syntax

Copy Code
setx [/s <Computer> [/u [<Domain>\]<User name> [/p [<Password>]]]] <Variable> <Value> [/m]
setx [/s <Computer> [/u [<Domain>\]<User name> [/p [<Password>]]]] [<Variable>] /k <Path> [/m]
setx [/s <Computer> [/u [<Domain>\]<User name> [/p [<Password>]]]] /f <FileName> {[<Variable>] {/a <X>,<Y> | /r <X>,<Y> "<String>"} [/m] | /x} [/d <Delimiters>]

Parameters

Parameter | Description
/s <Computer> | Specifies the name or IP address of a remote computer. Do not use backslashes. The default value is the name of the local computer.
/u [<Domain>\]<User name> | Runs the script with the credentials of the specified user account. The default value is the system permissions.
/p [<Password>] | Specifies the password of the user account that is specified in the /u parameter.
<Variable> | Specifies the name of the environment variable that you want to set.
<Value> | Specifies the value to which you want to set the environment variable.
/k <Path> | Specifies that the variable is set based on information from a registry key. The path uses the following syntax: \<HIVE>\<KEY>\...\<Value> For example, you might specify the following path: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation\StandardName
/f <File name> | Specifies the file that you want to use.
/a <X>,<Y> | Specifies absolute coordinates and offset as search parameters.
/r <X>,<Y> "<String>" | Specifies relative coordinates and offset from String as search parameters.
/m | Specifies to set the variable in the system environment. The default setting is the local environment.
/x | Displays file coordinates, ignoring the /a, /r, and /d command-line options.
/d <Delimiters> | Specifies delimiters such as "," or "\" to be used in addition to the four built-in delimiters — SPACE, TAB, ENTER, and LINEFEED. Valid delimiters include any ASCII character. The maximum number of delimiters is 15, including built-in delimiters.
/? | Displays help at the command prompt.

Remarks

  • The Setx command is similar to the UNIX utility SETENV.

  • Setx provides the only command-line or programmatic way to directly and permanently set system environment values. System environment variables are manually configurable through Control Panel or through a registry editor. The set command, which is internal to the command interpreter (Cmd.exe), sets user environment variables for the current console window only.

  • You can use the setx command to set values for user and system environment variables from one of three sources (modes): Command Line Mode, Registry Mode, or File Mode.

  • Setx writes variables to the master environment in the registry. Variables set with setx variables are available in future command windows only, not in the current command window.

  • HKEY_CURRENT_USER and HKEY_LOCAL_MACHINE are the only supported hives. REG_DWORD, REG_EXPAND_SZ, REG_SZ, and REG_MULTI_SZ are the valid RegKey data types.

  • When you gain access to REG_MULTI_SZ values in the registry, only the first item is extracted and used.

  • You cannot use the setx command to remove values that have been added to the local or system environments. You can use set with a variable name and no value to remove a corresponding value from the local environment.

  • REG_DWORD registry values are extracted and used in hexadecimal mode.

  • File mode supports the parsing of carriage return and line feed (CRLF) text files only.

Examples

To set the MACHINE environment variable in the local environment to the value Brand1, type:

Copy Code
setx MACHINE Brand1

To set the MACHINE environment variable in the system environment to the value Brand1 Computer, type:

Copy Code
setx MACHINE "Brand1 Computer" /m

To set the MYPATH environment variable in the local environment to use the search path defined in the PATH environment variable, type:

Copy Code
setx MYPATH %PATH%

To set the MYPATH environment variable in the local environment to use the search path defined in the PATH environment variable after replacing ~ with %, type:

Copy Code
setx MYPATH ~PATH~

To set the MACHINE environment variable in the local environment to Brand1 on a remote computer named Computer1, type:

Copy Code
setx /s computer1 /u maindom\hiropln /p p@ssW23 MACHINE Brand1

To set the MYPATH environment variable in the local environment to use the search path defined in the PATH environment variable on a remote computer named Computer1, type:

Copy Code
setx /s computer1 /u maindom\hiropln /p p@ssW23 MYPATH %PATH%

To set the TZONE environment variable in the local environment to the value found in the HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation\StandardName registry key, type:

Copy Code
setx TZONE /k HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation\StandardName

To set the TZONE environment variable in the local environment of a remote computer named Computer1 to the value found in the HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation\StandardName registry key, type:

Copy Code
setx /s computer1 /u maindom\hiropln /p p@ssW23 TZONE /k HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation\StandardName

To set the BUILD environment variable in the system environment to the value found in the HKEY_LOCAL_MACHINE\Software\Microsoft\WindowsNT\CurrentVersion\CurrentBuildNumber registry key, type:

Copy Code
setx BUILD /k "HKEY_LOCAL_MACHINE\Software\Microsoft\WindowsNT\CurrentVersion\CurrentBuildNumber" /m

To set the BUILD environment variable in the system environment of a remote computer named Computer1 to the value found in the HKEY_LOCAL_MACHINE\Software\Microsoft\WindowsNT\CurrentVersion\CurrentBuildNumber registry key, type:

Copy Code
setx /s computer1 /u maindom\hiropln /p p@ssW23  BUILD /k "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\CurrentBuildNumber" /m

To display the contents of a file named Ipconfig.out, along with the contents' corresponding coordinates, type:

Copy Code
setx /f ipconfig.out /x

To set the IPADDR environment variable in the local environment to the value found at the coordinate 5,11 in the file Ipconfig.out, type:

Copy Code
setx IPADDR /f ipconfig.out /a 5,11

To set the OCTET1 environment variable in the local environment to the value found at the coordinate 5,3 in the file Ipconfig.out with delimiters "#$*.", type:

Copy Code
setx OCTET1 /f ipconfig.out /a 5,3 /d "#$*."

To set the IPGATEWAY environment variable in the local environment to the value found at the coordinate 0,7 with respect to the coordinate of "Gateway" in the file Ipconfig.out, type:

Copy Code
setx IPGATEWAY /f ipconfig.out /r 0,7 Gateway

To display the contents of a file named Ipconfig.out — along with the contents' corresponding coordinates — on a computer named Computer1, type:

Copy Code
setx /s computer1 /u maindom\hiropln /p p@ssW23 /f ipconfig.out /x

Additional references

Command-Line Syntax Key


Sfc

Applies To: Windows Vista,Windows Server 2008 R2 with SP1,Windows Server 2008 R2,Windows Server 2008

Scans and verifies the integrity of all protected system files and replaces incorrect versions with correct versions.

For examples of how to use this command, see Examples.

Syntax

Copy Code
Sfc [/SCANNOW] [/VERIFYONLY] [/SCANFILE=<file>] [/VERIFYFILE=<file>] [/OFFWINDIR=<offline windows directory> /OFFBOOTDIR=<offline boot directory>]

Parameters

Parameter | Description
/SCANNOW | Scans the integrity of all protected system files and repairs files with problems when possible.
/VERIFYONLY | Scans integrity of all protected system files. No repair operation is performed.
/SCANFILE | Scans integrity of the specified file and repairs the file if problems are detected, when possible.
<file> | Specified full path and filename
/VERIFYFILE | Verifies the integrity of the specified file. No repair operation is performed.
/OFFWINDIR | Specifies the location of the offline windows directory, for offline repair.
/OFFBOOTDIR | Specifies the location of the offline boot directory for offline

Remarks

  • You must be logged on as a member of the Administrators group to run sfc.exe.

  • If sfc discovers that a protected file has been overwritten, it retrieves the correct version of the file from the systemroot\system32\dllcache folder, and then replaces the incorrect file.

  • There are functional differences between sfc on Windows Server® 2003, Windows Server® 2008, and Windows Server® 2008 R2:

    • For more information about sfc on Windows Server 2003, see System File Checker (sfc).

Examples

To verify the kernel32.dll file, type:

Copy Code
sfc /VERIFYFILE=c:\windows\system32\kernel32.dll

To setup offline repair of the kernel32.dll file with an offline boot directory set to d: and offline windows directory set to d:\windows, type:

Copy Code
sfc /SCANFILE=d:\windows\system32\kernel32.dll /OFFBOOTDIR=d:\ /OFFWINDI R=d:\windows

Additional references

Command-Line Syntax Key


Shadow

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Vista

Enables you to remotely control an active session of another user on a terminal server.

For examples of how to use this command, see Examples.

Syntax

Copy Code
shadow {<SessionName> | <SessionID>} [/server:<ServerName>] [/v]

Parameters

Parameter | Description
<SessionName> | Specifies the name of the session that you want to remotely control.
<SessionID> | Specifies the ID of the session that you want to remotely control. Use query user to display the list of sessions and their session IDs.
/server:<ServerName> | Specifies the terminal server containing the session that you want to remotely control. By default, the current terminal server is used.
/v | Displays information about the actions being performed.
/? | Displays help at the command prompt.

Remarks

  • You can either view or actively control the session. If you choose to actively control a user's session, you will be able to input keyboard and mouse actions to the session.

  • You can always remotely control your own sessions (except the current session), but you must have Full Control permission or Remote Control special access permission to remotely control another session.

  • You can also initiate remote control by using Terminal Services Manager.

  • Before monitoring begins, the server warns the user that the session is about to be remotely controlled, unless this warning is disabled. Your session might appear to be frozen for a few seconds while it waits for a response from the user. To configure remote control for users and sessions, use the Terminal Services Configuration tool or the Terminal Services extensions to Local Users and Groups and Active Directory Users and Computers.

  • Your session must be capable of supporting the video resolution used at the session that you are remotely controlling or the operation fails.

  • The console session can neither remotely control another session nor can it be remotely controlled by another session.

  • When you want to end remote control (shadowing), press CTRL+* (by using * from the numeric keypad only).

Examples

  • To shadow session 93, type:

    Copy Code
    shadow 93
  • To shadow the session ACCTG01, type:

    Copy Code
    shadow ACCTG01

Additional references

Command-Line Syntax Key

Terminal Services Command Reference


Shift

Applies To: Windows Server 2003,Windows Vista,Windows Server 2000,Windows Server 2003 with SP2,Windows Server 2003 R2,Windows 7,Windows Server 2008 R2,Windows Server 2008,Windows Server 2003 with SP1,Windows XP

Changes the position of batch parameters in a batch file.

For examples of how to use this command, see Examples.

Syntax

Copy Code
shift [/n <N>]

Parameters

Parameter | Description
/n <N> | Specifies to start shifting at the Nth argument, where N is any value from 0 to 8. Requires command extensions, which are enabled by default.
/? | Displays help at the command prompt.

Remarks

  • The shift command changes the values of the batch parameters %0 through %9 by copying each parameter into the previous one—the value of %1 is copied to %0, the value of %2 is copied to %1, and so on. This is useful for writing a batch file that performs the same operation on any number of parameters.

  • If command extensions are enabled, the shift command supports the /n command-line option. The /n option specifies to start shifting at the Nth argument, where N is any value from 0 to 8. For example, SHIFT /2 would shift %3 to %2, %4 to %3, and so on, and leave %0 and %1 unaffected. Command extensions are enabled by default.

  • You can use the shift command to create a batch file that can accept more than 10 batch parameters. If you specify more than 10 parameters on the command line, those that appear after the tenth (%9) will be shifted one at a time into %9.

  • The shift command has no effect on the %* batch parameter.

  • There is no backward shift command. After you implement the shift command, you cannot recover the batch parameter (%0) that existed before the shift.

Examples

The following lines from a sample batch file called Mycopy.bat demonstrate how to use shift with any number of batch parameters. In this example, Mycopy.bat copies a list of files to a specific directory. The batch parameters are represented by the directory and file name arguments.

Copy Code
@echo off
rem MYCOPY.BAT copies any number of files
rem to a directory.
rem The command uses the following syntax:
rem mycopy dir file1 file2 ...
set todir=%1
:getfile
shift
if "%1"=="" goto end
copy %1 %todir%
goto getfile
:end
set todir=
echo All done

Additional references

Command-Line Syntax Key


Showmount
See Also

Applies To: Windows Server 2003 with SP1,Windows Server 2008,Windows Server 2008 R2,Windows Server 2003 R2,Windows Server 2003 with SP2,Windows Server 2000,Windows Vista,Windows Server 2003

You can use showmount to display mounted directories.

Syntax

showmount {-e | -a | -d} [Server]

Description

The showmount command-line utility displays information about mounted file systems exported by Server for NFS on the computer specified by Server. If Server is not provided, showmount displays information about the computer on which the showmount command is run.

You must provide one of the following options:

-e

Displays all file systems exported on the server.

-a

Displays all Network File System (NFS) clients and the directories on the server each has mounted.

-d

Displays all directories on the server that are currently mounted by NFS clients.

See Also

Concepts

Services for Network File System Command Reference


Shutdown

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Server 2003 with SP1,Windows Server 2003 R2,Windows Vista,Windows Server 2003,Windows Server 2000,Windows Server 2003 with SP2

Enables you to shut down or restart local or remote computers one at a time.

For examples of how to use this command, see Examples.

Syntax

Copy Code
shutdown [/i | /l | /s | /r | /a | /p | /h | /e] [/f] [/m \\<ComputerName>] [/t <XXX>] [/d [p|u:]<XX>:<YY> [/c "comment"]]

Parameters

Parameter Description

/i

Displays the Remote Shutdown Dialog box. The /i option must be the first parameter following the command. If /i is specified, all other options are ignored.

/l

Logs off the current user immediately, with no time-out period. You cannot use /l with /m or /t.

/s

Shuts down the computer.

/r

Restarts the computer after shutdown.

/a

Aborts a system shutdown. Effective only during the timeout period. To use /a, you must also use the /m option.

/p

Turns off the local computer only (not a remote computer)—with no time-out period or warning. You can use /p only with /d or /f. If your computer does not support power-off functionality, it will shut down when you use /p, but the power to the computer will remain on.

/h

Puts the local computer into hibernation, if hibernation is enabled. You can use /h only with /f.

/e

Enables you to document the reason for the unexpected shutdown on the target computer.

/f

Forces running applications to close without warning users.

Caution
Using the /f option might result in loss of unsaved data.

/m \\<ComputerName>

Specifies the target computer. Cannot be used with the /l option.

/t <XXX>

Sets the time-out period or delay to XXX seconds before a restart or shutdown. This causes a warning to display on the local console. You can specify 0-600 seconds. If you do not use /t, the time-out period is 30 seconds by default.

/d [p|u:]<XX>:<YY>

Lists the reason for the system restart or shutdown. The following are the parameter values:

p Indicates that the restart or shutdown is planned.

u Indicates that the reason is user defined.

Note
If p or u are not specified, the restart or shutdown is unplanned.

XX Specifies the major reason number (positive integer less than 256).

YY Specifies the minor reason number (positive integer less than 65536).

/c "<Comment>"

Enables you to comment in detail about the reason for the shutdown. You must first provide a reason by using the /d option. You must enclose comments in quotation marks. You can use a maximum of 511 characters.

/?

Displays help at the command prompt, including a list of the major and minor reasons that are defined on your local computer.

Remarks

  • Users must be assigned the Shut down the system user right to shut down a local or remotely administered computer that is using the shutdown command.

  • Users must be members of the Administrators group to annotate an unexpected shutdown of a local or remotely administered computer. If the target computer is joined to a domain, members of the Domain Admins group might be able to perform this procedure. For more information, see:

    • Default local groups

    • Default groups.

  • If you want to shut down more than one computer at a time, you can call shutdown for each computer by using a script, or you can use shutdown /i to display the Remote Shutdown Dialog box.

  • If you specify major and minor reason codes, you must first define these reason codes on each computer where you plan to use the reasons. If the reason codes are not defined on the target computer, Shutdown Event Tracker cannot log the correct reason text.

  • Remember to indicate that a shutdown is planned by using the p: parameter. Omitting p: indicates that a shutdown is unplanned. If you type p: followed by the reason code for an unplanned shutdown, the command will not carry out the shutdown. Conversely, if you omit p: and type in the reason code for a planned shutdown, the command will not carry out the shutdown.

Examples

To force applications to close and restart the local computer after a one-minute delay with the reason "Application: Maintenance (Planned)" and the comment "Reconfiguring myapp.exe" type:

Copy Code
shutdown /r /t 60 /c "Reconfiguring myapp.exe" /f /d p:4:1

To restart the remote computer \\ServerName with the same parameters, type:

Copy Code
shutdown /r /m \\servername /t 60 /c "Reconfiguring myapp.exe" /f /d p:4:1

Additional references

Command-Line Syntax Key


Sort

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Server 2003 with SP1,Windows Server 2000,Windows Server 2003 with SP2,Windows Server 2003,Windows Vista,Windows Server 2003 R2

Reads input, sorts data, and writes the results to the screen, to a file, or to another device.

For examples of how to use this command, see Examples.

Syntax

Copy Code
sort [/r] [/+<N>] [/m <Kilobytes>] [/l <Locale>] [/rec <Characters>] [[<Drive1>:][<Path1>]<FileName1>] [/t [<Drive2>:][<Path2>]] [/o [<Drive3>:][<Path3>]<FileName3>]

Parameters

Parameter | Description
/r | Reverses the sort order (that is, sorts from Z to A and from 9 to 0).
/+<N> | Specifies the character position number where sort will begin each comparison. N can be any valid integer.
/m <Kilobytes> | Specifies the amount of main memory to use for the sort in kilobytes (KB).
/l <Locale> | Overrides the sort order of characters that are defined by the system default locale (that is, the language and Country/Region selected during installation).
/rec <Characters> | Specifies the maximum number of characters in a record or a line of the input file (the default value is 4,096 and the maximum is 65,535).
[<Drive1>:][<Path1>]<FileName1> | Specifies the file to be sorted. If no file name is specified, the standard input is sorted. Specifying the input file is faster than redirecting the same file as standard input.
/t [<Drive2>:][<Path2>] | Specifies the path of the directory to hold the sort command's working storage if the data does not fit in the main memory. By default, the system temporary directory is used.
/o [<Drive3>:][<Path3>]<FileName3> | Specifies the file where the sorted input is to be stored. If not specified, the data is written to the standard output. Specifying the output file is faster than redirecting standard output to the same file.
/? | Displays help at the command prompt.

Remarks

  • Using the /+ command-line option

    By default, comparisons start at the first character of each line. The /+ command-line option starts comparisons at the character that is specified by N. For example, /+3 indicates that each comparison should begin at the third character of each line. Lines with fewer than N characters collate before other lines.

  • Using the /m command-line option

    The memory used is always a minimum of 160 KB. If the memory size is specified, the exact specified amount is used for the sort (must be at least 160 KB), regardless of how much main memory is available.

    The default maximum memory size when no size is specified is 90 percent of the available main memory if both the input and output are files, or 45 percent of main memory otherwise. The default setting usually gives the best performance.

  • Using the /l command-line option

    Currently, the only alternative to the default locale is the "C" locale, which is faster than natural language sorting (it sorts characters according to their binary encodings).

  • Using redirection symbols with the sort command

    You can use the pipe symbol (|) to direct input data to the sort command from another command or to direct sorted output to another command. You can specify input and output files by using redirection symbols (< or >). It can be faster and more efficient (especially with large files) to specify the input file directly (as defined by FileName1 in the command syntax), and then specify the output file using the /o parameter.

  • Case sensitivity

    The sort command does not distinguish between uppercase and lowercase letters.

  • Limits on file size

    The sort command has no limit on file size.

  • Collating sequence

    The sort program uses the collating-sequence table that corresponds to the Country/Region code and code-page settings. Characters greater than ASCII code 127 are sorted based on information in the Country.sys file or in an alternate file specified by the country command in your Config.nt file.

  • Memory usage

    If the sort fits within the maximum memory size (as set by default or as specified by the /m parameter), the sort is performed in a single pass. Otherwise, the sort is performed in two separate sort and merge passes, and the amounts of memory used for both passes are equal. When two passes are performed, the partially sorted data is stored in a temporary file on disk. If there is not enough memory to perform the sort in two passes, a run-time error is issued. If the /m command-line option is used to specify more memory than is truly available, performance degradation or a run-time error can occur.

Examples

Sorting a file

To sort and display in reverse order the lines in a file named Expenses.txt, type:

sort /r expenses.txt

Sorting the output from a command

To search a large file named Maillist.txt for the text "Jones," and to sort the results of the search, use the pipe (|) to direct the output of a find command to the sort command, as follows:

find "Jones" maillist.txt | sort

The command produces a sorted list of lines that contain the specified text.

Sorting keyboard input

To sort keyboard input and display the results alphabetically on the screen, you can first use the sort command with no parameters, as follows:

sort

Then type the text that you want sorted, and press ENTER at the end of each line. When you have finished typing text, press CTRL+Z, and then press ENTER. The sort command displays the text you typed, sorted alphabetically.

Additional references

Command-Line Syntax Key


Start

Applies To: Windows Server 2003 R2,Windows Vista,Windows Server 2003,Windows Server 2003 with SP2,Windows Server 2000,Windows Server 2003 with SP1,Windows Server 2008,Windows Server 2008 R2

Starts a separate Command Prompt window to run a specified program or command.

For examples of how to use this command, see Examples.

Syntax

Copy Code
start ["<Title>"] [/d <Path>] [/i] [{/min | /max}] [{/separate | /shared}] [{/low | /normal | /high | /realtime | /abovenormal | belownormal}] [/affinity <HexAffinity>] [/wait] [/b {<Command> | <Program>} [<Parameters>]]

Parameters

Parameter | Description
"<Title>" | Specifies the title to display in the Command Prompt window title bar.
/d <Path> | Specifies the startup directory.
/i | Passes the Cmd.exe startup environment to the new Command Prompt window. If /i is not specified, the current environment is used.
{/min | /max} | Specifies to minimize (/min) or maximize (/max) the new Command Prompt window.
{/separate | /shared} | Starts 16-bit programs in a separate memory space (/separate) or shared memory space (/shared). These options are not supported on 64-bit platforms.
{/low | /normal | /high | /realtime | /abovenormal | /belownormal} | Starts an application in the specified priority class. Valid priority class values are /low, /normal, /high, /realtime, /abovenormal, and /belownormal.
/affinity <HexAffinity> | Applies the specified processor affinity mask (expressed as a hexadecimal number) to the new application.
/wait | Starts an application and waits for it to end.
/b | Starts an application without opening a new Command Prompt window. CTRL+C handling is ignored unless the application enables CTRL+C processing. Use CTRL+BREAK to interrupt the application.
/b {<Command> | <Program>} | Specifies the command or program to start.
<Parameters> | Specifies parameters to pass to the command or program.
/? | Displays help at the command prompt.

Remarks

  • You can run nonexecutable files through their file association by typing the name of the file as a command.

  • When you run a command that contains the string "CMD" as the first token without an extension or path qualifier, "CMD" is replaced with the value of the COMSPEC variable. This prevents users from picking up cmd from the current directory.

  • When you run a 32-bit graphical user interface (GUI) application, cmd does not wait for the application to quit before returning to the command prompt. This behavior does not occur if you run the application from a command script.

  • When you run a command that uses a first token that does not contain an extension, Cmd.exe uses the value of the PATHEXT environment variable to determine which extensions to look for and in what order. The default value for the PATHEXT variable is:

    Copy Code
    .COM;.EXE;.BAT;.CMD
    Note that the syntax is the same as the PATH variable, with semicolons separating each extension.

  • When it searches for an executable file, if there is no match on any extension, start checks to see if the name matches a directory name. If it does, start opens Explorer.exe on that path.

Examples

To start the Myapp program at the command prompt and retain use of the current Command Prompt window, type:

Copy Code
start myapp

To view the start command-line help topic in a separate maximized Command Prompt window, type:

Copy Code
start /max start /?

Additional references

Command-Line Syntax Key


Storrept

Applies To: Windows Server 2008 R2,Windows Server 2008

The storrept command is installed with File Server Resource Manager and includes subcommands for creating and managing storage reports and storage report tasks, as well as for configuring general administrative options for File Server Resource Manager.

Note
To use this command, you must be logged on as an administrator or a member of the Administrators group.

Syntax

Copy Code
storrept reports
storrept admin

Subcommands

Subcommand | Description
Storrept reports | Lists, schedules, modifies, and cancels storage reports tasks. This parameter also generates storage reports on demand.
Storrept admin | Configures default administrative options and storage report parameters.

Additional references

Command-Line Syntax Key

Dirquota [LH]

Filescrn [LH]


Storrept reports

Applies To: Windows Server 2008 R2,Windows Server 2008

Lists, schedules, modifies, deletes, and cancels storage reports tasks. This command also generates storage reports on demand.

Note
To use this command, you must be logged on as an administrator or a member of the Administrators group.

Syntax

Copy Code
storrept reports list
storrept reports add
storrept reports modify
storrept reports delete
storrept reports generate
storrept reports cancel

Parameters

Parameter | Description
Storrept reports list | Lists currently configured storage report tasks.
Storrept reports add | Schedules a new storage report task.
Storrept reports modify | Modifies an existing storage report task.
Storrept reports delete | Deletes a storage report task.
Storrept reports generate | Generates a storage report on demand.
Storrept reports cancel | Cancels currently running or queued storage report tasks.

Additional references

Command-Line Syntax Key

Storrept reports


Storrept reports list

Applies To: Windows Server 2008,Windows Server 2008 R2

Lists currently scheduled storage report tasks. If used without parameters, the storrept reports list command displays all report tasks that are scheduled on the computer.

Note
You must be logged on as an administrator or a member of the Administrators group to use this command.

For examples of how to use this command, see Examples.

Syntax

Copy Code
storrept reports list [/task:<TaskName> | /running] [/remote:<ComputerName>]

Parameters

Parameter | Description
/task:<TaskName> | Lists only those reports that are associated with the scheduled task TaskName.
/running | Lists only those reports that are currently being generated or are queued to be generated.
/remote:<ComputerName> | Performs the operation on the remote computer ComputerName.

Remarks

  • The shortest sequence of characters that uniquely identifies a parameter can be used as an abbreviation. For example, the following two commands are equivalent:

    Copy Code
    storrept r l /r
storrept reports list /running
  • To perform operations on a remote computer by using the /remote:ComputerName parameter:

    • You must be logged on with a domain account that is a member of the Administrators group on both the local computer and the remote computer.

    • The remote computer must be running Windows Server 2008, and File Server Resource Manager must be installed.

    • The Remote File Server Resource Manager Management exception on the remote computer must be enabled. You enable this exception by using Windows Firewall in Control Panel.

Examples

  • To list all storage reports configured on the local computer, type:

    Copy Code
    storrept reports list
  • To list storage reports that are currently running on the remote computer FILESERVER1, type:

    Copy Code
    storrept reports list /running /remote:fileserver1

Additional references

Command-Line Syntax Key

Storrept reports


Storrept reports add

Applies To: Windows Server 2008,Windows Server 2008 R2

Adds a report to a scheduled task.

Note
To use this command, you must be logged on as an administrator or a member of the Administrators group.

Important
Before you can add a storage report to a task, you must create the task. To create tasks, you use the schtasks command. For more information, see Creating a task for File Server Resource Manager reports by using the schtasks command.

For examples of how to use this command, see Examples.

Syntax

Copy Code
storrept reports add /task:<TaskName> /scope:"<Scope>" /add-report:<Type>
   [/format:"<FormatList>"] [/mailto=<EmailList>] [/name:"<Name>"]
   [/filename:<Pattern>] [/minsize:<Size>[kb|mb|gb]] [/maxage:<Age>]
   [/minage:<Age>] [/minuse:<Usage>] [/owner:"<OwnerList>"]
   [/filegroup:"<FgList>"] [/quiet] [/remote:<ComputerName>]

Parameters

Parameter Description

/task:<TaskName>

Specifies the name of the scheduled task with which the report will be associated.

/scope:"<Scope>"

Gathers data for the report from Scope, which is a list of volume and folder paths. Use a pipe character (|) to separate multiple paths, without leaving blank spaces.

/add-report:<Type>

Specifies the report to be scheduled. Type must be one of the following:

  • DuplicateFiles — Lists files that appear to be duplicates (files with the same size and last-modified time).

  • Export — Includes all the unfiltered data gathered during a file system scan. You can use this data to perform customized storage analysis.

  • FileScreenAudit —- Lists file screening events that have occurred on the server for a specified number of days. Use this report to identify users or applications that violate screening policies.

    Important
    Before you schedule a File Screening Audit report, you must enable the recording of file screening activity in the auditing database by using the Dirquota admin options [LH] command with the /screenaudit:enabled parameter. You can also enable file screening auditing by using the File Server Resource Manager snap-in (in the main node, click Configure Options).

  • FilesByFileGroup — Lists files that belong to specified file groups.

  • FilesByOwner — Lists files, grouped by the users who own them.

  • LargeFiles — Lists files that are of a specified size or larger.

  • LeastRecentlyAccessed — Lists files that have not been accessed for a specified number of days.

  • MostRecentlyAccessed — Lists files that have been accessed within a specified number of days.

  • QuotaUsage — Lists quotas for which the quota usage is higher than a specified percentage. Use this report to identify quotas with high usage levels so that appropriate action can be taken.

    Note
    The Quota Usage report includes quotas that were created for volumes and folders in File Server Resource Manager only.

/format:"<FormatList>"

Specifies the format or formats in which the reports will be generated. Use a pipe character (|) to separate multiple report formats, without leaving blank spaces. FormatList must be one or more of the following values:

  • html — Generates the report in HyperText Markup Language (HTML) format.

  • dhtml — Generates the report in Dynamic HTML (DHTML) format.

  • xml — Generates the report in Extensible Markup Language (XML) format.

  • csv — Generates the report in comma-separated values (CSV) format.

  • txt — Generates the report in text format.

If you do not specify a report format, reports are generated in DHTML and XML formats by default, except for the Export report, whose default format is XML. Also note that you can generate the Export report only in CSV or XML format.

/mailto=<EmailList>

Specifies the list of e-mail addresses for the recipients of the reports. Use a semicolon to separate multiple e-mail addresses, without leaving blank spaces. All e-mail addresses must be in the format account@domain.

Note
You can use the [Admin Email] variable instead of an e-mail address to send the reports to the default e-mail addresses for the administrators. To display and configure the default e-mail addresses, use the Dirquota admin options [LH] command.

/name:"<Name>"

Specifies a new name for the report. This name will be used for the files and folders that will be created when the report is generated. If you do not specify a report name, the default report name will be used. To see the default name for a scheduled report, use the Storrept reports list command.

/filename:<Pattern>

Specifies the file name pattern for the report type specified in the /add-report parameter. Only those files that have a file name that matches Pattern will be included in the report. You can include wildcard characters in the Pattern value (for example, *.exe).

If you do not specify Pattern, the default pattern will be used. To display the default pattern, use the Storrept admin defaults command. The default pattern for each report type will be listed under Filter. If Filter is not listed for a report type, files with any file name pattern are included in that report.

Note that this parameter is valid only when the Type value for the /add-report parameter is FilesByOwner, LargeFiles, LeastRecentlyAccessed, or MostRecentlyAccessed.

/minsize:<Size>[kb|mb|gb]

Specifies the minimum size of the files that will be listed in the Large Files report. All files of size Size or larger will be listed. By default, Size is denoted in kilobytes (KB), but you can append kb, mb, or gb to specify the unit.

If you do not specify Size, the default minimum file size will be used. To display the default minimum file size, use the Storrept admin defaults command.

Note that this parameter is valid only when the Type value for the /add-report parameter is LargeFiles.

/maxage:<Age>

Specifies the maximum number of days since a file was last accessed. All files that were accessed Age days ago or more recently will be included in the Most Recently Accessed Files report.

If you do not specify Age, the default maximum number of days will be used. To display the default maximum number of days, use the Storrept admin defaults command.

Note that this parameter is valid only when the Type value for the /add-report parameter is MostRecentlyAccessed.

/minage:<Age>

Specifies the minimum number of days since a file was last accessed or since a file screening event occurred. All files that were accessed Age days ago and before will be included in the Least Recently Accessed Files report. All file screening audit events that happened Age days ago and before will be included in the File Screening Audit report. To specify all file screening events, set Age to 0 (zero).

If you do not specify Age, the default minimum number of days will be used. To display the default minimum number of days, use the Storrept admin defaults command.

Note that this parameter is valid only when the Type value for the /add-report parameter is either LeastRecentlyAccessed or FileScreenAudit.

/minuse:<Usage>

Specifies the minimum percentage of quota usage of the quotas that will be listed in the Quota Usage report. To specify all quotas, set Usage to 0 (zero).

If you do not specify Usage, the default minimum percentage of quota usage will be used. To display the default minimum percentage of quota usage, use the Storrept admin defaults command.

Note that this parameter is valid only when the Type value for the /add-report parameter is QuotaUsage.

/owner:"<OwnerList>"

Specifies the list of file owners for the File Screen Audit report or the Files by Owner report. OwnerList can be a list of one or more user names separated by a pipe character (|), enclosed in quotation marks. To specify all owners, set FgList to "".

If you do not specify OwnerList, the default list of owners will be included in the report. To display the default list of owners, use the Storrept admin defaults command.

Note that this parameter is valid only when the Type value for the /add-report parameter is either FileScreenAudit or FilesByOwner.

/filegroup:"<FgList>"]

Specifies a list of file groups for the Files by File Group report. FgList is a list of one or more file group names separated by a pipe character (|), enclosed in quotation marks. To display a list of file groups, use the Filescrn filegroup list [LH] command. To specify all file groups, set FgList to "".

If you do not specify a list of file groups, the default file groups for the Files by File Group report will be included. To display the list of default file groups, use the Storrept admin defaults command.

Note that this parameter is valid only when the Type value for the /add-report parameter is FilesByFileGroup.

/quiet

Schedules the storage report task without warning. By default, you are prompted to confirm that you want to schedule the storage report task.

/remote:<ComputerName>

Performs the operation on the remote computer ComputerName.

Remarks

  • The shortest sequence of characters that uniquely identifies a parameter can be used as an abbreviation. For example, the following two commands are equivalent:

    Copy Code
    storrept r a /t:largefilestask /s:"d:\|e:\" /a:"LargeFiles"
storrept reports add /task:largefilestask /scope:"d:\|e:\" /add-report:"LargeFiles"
  • To perform operations on a remote computer by using the /remote:ComputerName parameter:

    • You must be logged on with a domain account that is a member of the Administrators group on both the local computer and the remote computer.

    • The remote computer must be running Windows Server 2008, and File Server Resource Manager must be installed.

    • The Remote File Server Resource Manager Management exception on the remote computer must be enabled. You enable this exception by using Windows Firewall in Control Panel.

Examples

  • To add to the scheduled LargeFilesTask task a Large Files report for drives D: and E:, and have that reports list only files the have the .zip file name extension and that are 50 MB or larger, type:

    Copy Code
    storrept reports add /task:largefilestask /scope:"d:\|e:\" /add-report:largefiles /filename:"*.zip" /minsize:50mb
  • To add to the scheduled FSRMReport task a Quota Usage report for volumes C: and D: in HTML format, and have that report sent to the admin@contoso.com and storage.quota@contoso.com e-mail addresses, type:

    Copy Code
    storrept reports add /task:fsrmreport /scope:"c:\|d:\" /add-report:quotausage /format:"html" /mailto:admin@contoso.com;storage.quota@contoso.com

Additional references

Command-Line Syntax Key

Storrept reports


Storrept reports modify

Applies To: Windows Server 2008 R2,Windows Server 2008

Adds a storage report to a task, changes the storage report associated with a task, associates a storage report with a different task, or deletes a storage report associated with a task.

Note
To use this command, you must be logged on as an administrator or a member of the Administrators group.

For examples of how to use this command, see Examples.

Syntax

Copy Code
storrept reports modify /task:<TaskName> [/new-task:<NewTask>]
   [/scope:"<Scope>"] [/quiet] [/remote:<ComputerName>]

Copy Code
storrept reports modify /task:<TaskName> {/add-report:<Type> | /modify-report:<Type>} [/new-task:<NewTask>]
   [/scope:"<Scope>"] [/format:"<FormatList>"]
   [/mailto=<EmailList>] [/name:"<Name>"]
   [/filename:<Pattern>] [/minsize:<Size>[kb|mb|gb]] [/maxage:<Age>]
   [/minage:<Age>] [/minuse:<Usage>] [/owner:"<OwnerList>"]
   [/filegroup:"<FgList>"] [/quiet] [/remote:<ComputerName>]

Copy Code
storrept reports modify /task:<TaskName> /delete-report:<Type> [/new-task:<NewTask>]
   [/scope:"<Scope>"] [/format:"<FormatList>"]
   [/mailto=<EmailList>] [/quiet] [/remote:<ComputerName>]

Parameters

Parameter Description

/task:<TaskName>

Specifies the name of the scheduled task that will be modified.

Note
For more information about scheduling storage reports tasks, see Storrept reports add.

/add-report:<Type>

/modify-report:<Type>

/delete-report:<Type>

Adds, modifies, or deletes the report of type Type that is associated with the specified task. Type must be one of the following:

  • DuplicateFiles — Lists files that appear to be duplicates (files with the same size and last-modified time).

  • Export — Includes all the unfiltered data gathered during a file system scan. You can use this data to perform customized storage analysis.

  • FileScreenAudit — Lists file screening events that have occurred on the server for a specified number of days. Use this report to identify users or applications that violate screening policies.

    Important
    Before you schedule a File Screening Audit report, you must enable the recording of file screening activity in the auditing database by using the Dirquota admin options [LH] command with the /screenaudit:enabled parameter. You can also enable file screening auditing by using the File Server Resource Manager snap-in (in the main node, click Configure Options).

  • FilesByFileGroup — Lists files that belong to specified file groups.

  • FilesByOwner — Lists files, grouped by the users who own them.

  • LargeFiles — Lists files that are of a specified size or larger.

  • LeastRecentlyAccessed — Lists files that have not been accessed for a specified number of days.

  • MostRecentlyAccessed — Lists files that have been accessed within a specified number of days.

  • QuotaUsage — Lists quotas for which the quota usage is higher than a specified percentage. Use this report to identify quotas with high usage levels so that appropriate action can be taken.

    Note
    The Quota Usage report includes quotas that were created for volumes and folders in File Server Resource Manager only.

/new-task:<NewTask>

Associates all reports with a different NewTask task. The original task will no longer have storage reports associated with it.

Note
To create tasks for storage reports, use the schtasks command. For more information, see Creating a task for File Server Resource Manager reports by using the schtasks command.

/scope:"<Scope>"

Gathers data for the report from Scope,. which is a list of volume and folder paths. Use a pipe character (|) to separate multiple paths, without leaving blank spaces.

/format:"<FormatList>"

Specifies the format or formats in which the reports will be generated. Use a pipe character (|) to separate multiple report formats, without leaving blank spaces. FormatList must be one or more of the following values:

  • html — Generates the report in HyperText Markup Language (HTML) format.

  • dhtml — Generates the report in Dynamic HTML (DHTML) format.

  • xml — Generates the report in Extensible Markup Language (XML) format.

  • csv — Generates the report in comma-separated values (CSV) format.

  • txt — Generates the report in text format.

If you do not specify a report format, reports are generated in DHTML and XML formats by default, except for the Export report, whose default format is XML. Also note that you can generate the Export report only in CSV or XML format.

Important
This parameter will not have any effect unless the /modify-report, /add-report, /delete-report, or /new-task parameter is also included.

/mailto=<EmailList>

Specifies the list of e-mail addresses for the recipients of the reports. Use a semicolon to separate multiple e-mail addresses, without leaving blank spaces. All e-mail addresses must be in the format account@domain.

Note
You can use the [Admin Email] variable instead of an e-mail address to send the reports to the default e-mail addresses for the administrators. To display and configure the default e-mail addresses, see the Dirquota admin options [LH] command.

Important
This parameter will not have any effect unless the /modify-report, /add-report, /delete-report, or /new-task parameter is also included.

/name:"<Name>"

Specifies a new name for the report. This name will be used for the files and folders that will be created when the report is generated. If you do not specify a report name, the default report name will be used. To see the default name for a scheduled report, use the Storrept reports list command.

/filename:<Pattern>

Specifies the file name pattern for the report type specified in the /add-report, /modify-report, or /delete-report parameter. Only those files that have a file name that matches Pattern will be included in the report. You can use wildcard characters in Pattern (for example, *.exe).

If you do not specify a file name pattern, the default pattern will be used. To display the default pattern, use the Storrept admin defaults command. The default pattern for each report type will be listed under Filter. If Filter is not listed for a report type, files with any file name pattern are included in that report.

This parameter is valid only when the Type value for the /add-reports parameter is FilesByOwner, LargeFiles, LeastRecentlyAccessed, or MostRecentlyAccessed.

/minsize:<Size>[kb|mb|gb]

Specifies the minimum size of the files that will be listed in the Large Files report. All files of size Size or larger will be listed. By default Size is denoted in kilobytes (KB), but you can append kb, mb, or gb to specify the unit.

If you do not specify a minimum size, the default minimum file size will be used. To display the default minimum file size, use the Storrept admin defaults command.

This parameter is valid only when the Type value for the /add-report, /modify-report, or /delete-report parameter is LargeFiles.

/maxage:<Age>

Specifies the maximum number of days since a file was last accessed. All files that were accessed Age days ago or more recently will be included in the Most Recently Accessed Files report.

If you do not use this parameter, the default maximum number of days will be used. To display the default maximum number of days, use the Storrept admin defaults command.

This parameter is valid only when the Type value for the /add-report, /modify-report, or /delete-report parameter is MostRecentlyAccessed.

/minage:<Age>

Specifies the minimum number of days since a file was last accessed or since a file screening event occurred. All files that were accessed Age days ago and before will be included in the Least Recently Accessed Files report. All file screening audit events that happened Age days ago and before will be included in the File Screening Audit report. To specify all file screening events, set Age to 0 (zero).

If you do not specify Age, the default minimum number of days will be used. To display the default minimum number of days, use the Storrept admin defaults command.

This parameter is valid only when the Type value for the /add-report, /modify-report, or /delete-report parameter is either LeastRecentlyAccessed or FileScreenAudit.

/minuse:<Usage>

Specifies the minimum percentage of quota usage of the quotas that will be listed in the Quota Usage report. To specify all quotas, set Usage to 0 (zero).

If you do not use this parameter, the default minimum percentage of quota usage will be used. To display the default minimum percentage of quota usage, use the Storrept admin defaults command.

This parameter is valid only when the Type value for the /add-report, /modify-report, or /delete-report parameter is QuotaUsage.

/owner:"<OwnerList>"

Specifies the list of file owners for the File Screen Audit report or the Files by Owner report. OwnerList can be a list of one or more user names separated by a pipe character (|), enclosed in quotation marks. To specify all owners, set FgList to "".

If you do not specify a list of owners, the default list of owners will be included in the report. To display the default list of owners, use the Storrept admin defaults command.

This parameter is valid only when the Type value for the /add-report, /modify-report, or /delete-report parameter is either FileScreenAudit or FilesByOwner.

/filegroup:"<FgList>"]

Specifies a list of file groups for the Files by File Group report. FgList is a list of one or more file group names separated by a pipe character (|), enclosed in quotation marks. To display a list of file groups, use the Filescrn filegroup list [LH] command. To specify all file groups, set FgList to "".

If you do not specify a list of file groups, the default file groups for the Files by File Group report will be included. To display the list of default file groups, use the Storrept admin defaults command.

This parameter is valid only when the Type value for the /add-report, /modify-report, or /delete-report parameter is FilesByFileGroup

/quiet

Modifies the storage report task without prompting.

/remote:<ComputerName>

Performs the operation on the remote computer ComputerName.

Remarks

  • The shortest sequence of characters that uniquely identifies a parameter can be used as an abbreviation. For example, the following two commands are equivalent:

    Copy Code
    storrept r m /t:largefilestask /d:"LargeFiles" /s:"d:\|e:\"
storrept reports modify /task:largefilestask /delete-report:"LargeFiles" /scope:"d:\|e:\"
  • To perform operations on a remote computer by using the /remote:ComputerName parameter:

    • You must be logged on with a domain account that is a member of the Administrators group on both the local computer and the remote computer.

    • The remote computer must be running Windows Server 2008, and File Server Resource Manager must be installed.

    • The Remote File Server Resource Manager Management exception on the remote computer must be enabled. You enable this exception by using Windows Firewall in Control Panel.

Examples.

  • To add the File Screen Auditing report to the FSRMReport task, type:

    Copy Code
    storrept reports modify /task:fsrmreport /add-report:filescreenaudit
  • To change the scope of all reports associated with the FSRMReport task so that they include only information for volume E:, type:

    Copy Code
    storrept reports modify /task:fsrmreport /scope:e:\
  • To modify the Files by Owner report associated with the FSRMReport task so that it includes only files that have the .avi file name extension, type:

    Copy Code
    storrept reports modify /task:fsrmreport /modify-report:filesbyowner /filename:*.avi
  • To associate with the FSRMReportNew task all reports that are currently associated with the FSRMReport task, and at the same time modify the Quota Usage report so that it lists only those quotas that exceed or match 75 percent of the quota limit, type:

    Copy Code
    storrept reports modify /task:fsrmreport /new-task:fsrmreportnew /modify-report:quotausage /minuse:75

Additional references

Command-Line Syntax Key

Storrept reports


Storrept reports delete

Applies To: Windows Server 2008,Windows Server 2008 R2

Deletes currently scheduled storage reports.

Note
To use this command, you must be logged on as an administrator or a member of the Administrators group.

Important
This command does not delete a task from the system; it only deletes the storage reports associated with the task. If you want to delete the task also, use the schtasks /delete command. For more information, see Schtasks, and the examples in this topic.

For examples of how to use this command, see Examples.

Syntax

Copy Code
storrept reports delete /task:<TaskName> [/quiet] [/remote:<ComputerName>]

Parameters

Parameter | Description
/task:<TaskName> | Specifies the name of the task with which the reports that will be deleted are associated.
/quiet | Deletes the storage reports without warning. By default, you are prompted to confirm deletion.
/remote:<ComputerName> | Performs the operation on the remote computer ComputerName.

Remarks

  • The shortest sequence of characters that uniquely identifies a parameter can be used as an abbreviation. For example, the following two commands are equivalent:

    Copy Code
    storrept r d /q
storrept reports delete /quiet
  • To perform operations on a remote computer by using the /remote:ComputerName parameter:

    • You must be logged on with a domain account that is a member of the Administrators group on both the local computer and the remote computer.

    • The remote computer must be running Windows Server 2008, and File Server Resource Manager must be installed.

    • The Remote File Server Resource Manager Management exception on the remote computer must be enabled. You enable this exception by using Windows Firewall in Control Panel.

Examples

  • To delete all reports that are associated with the FSRMReport task that is scheduled on the local computer, type:

    Copy Code
    storrept reports delete /task:fsrmreport
    If you also want to delete the FSRMReport task from the system, type:

    Copy Code
    schtasks /delete /tn fsrmreport
  • To delete all reports that are associated with the FSRMReport task that is scheduled on the remote computer FILESERVER1, type:

    Copy Code
    storrept reports delete /task:fsrmreport /remote:fileserver1
    If you also want to delete the FSRMReport task from the remote system, type:

    Copy Code
    schtasks /delete /tn fsrmreport /s fileserver1

Additional references

Command-Line Syntax Key

Storrept reports


Storrept reports generate

Applies To: Windows Server 2008 R2,Windows Server 2008

Generates a storage report on demand by generating a new report or by starting a currently scheduled storage report task.

Note
To use this command, you must be logged on as an administrator or a member of the Administrators group.

For examples of how to use this command, see Examples.

Syntax

Copy Code
storrept reports generate /task:<TaskName> [/nowait]

Copy Code
storrept reports generate /report:<Type> /scope:"<Scope>" [nowait]
   [/format:"<FormatList>"] [/mailto=<EmailList>] [/name:"<Name>"]
   [/filename:<Pattern>] [/minsize:<Size>[kb|mb|gb]] [/maxage:<Age>]
   [/minage:<Age>] [/minuse:<Usage>] [/owner:"<OwnerList>"]
   [/filegroup:"<FgList>"] [/remote:<ComputerName>]

Parameters

Parameter Description

/task:<TaskName>

Generates the storage report associated with the scheduled task TaskName.

Note
For more information about scheduling storage reports tasks, see Storrept reports add.

/nowait

Forces the command to return immediately while the report generation is still in progress.

/report:<Type>

Specifies the report to be generated. Type must be one of the following:

  • DuplicateFiles — Lists files that appear to be duplicates (files with the same size and last-modified time).

  • Export — Includes all the unfiltered data gathered during a file system scan. You can use this data to perform customized storage analysis.

  • FileScreenAudit — Lists file screening events that have occurred on the server for a specified number of days. Use this report to identify users or applications that violate screening policies.

    Important
    Before you schedule a File Screening Audit report, you must enable the recording of file screening activity in the auditing database by using the Dirquota admin options [LH] command with the /screenaudit:enabled parameter. You can also enable file screening auditing by using the File Server Resource Manager snap-in (in the main node, click Configure Options ).

  • FilesByFileGroup — Lists files that belong to specified file groups.

  • FilesByOwner — Lists files, grouped by the users who own them.

  • LargeFiles — Lists files that are of a specified size or larger.

  • LeastRecentlyAccessed — Lists files that have not been accessed for a specified number of days.

  • MostRecentlyAccessed — Lists files that have been accessed within a specified number of days.

  • QuotaUsage — Lists quotas for which the quota usage is higher than a specified percentage. Use this report to identify quotas with high usage levels so that appropriate action can be taken.

    Note
    The Quota Usage report includes quotas that were created for volumes and folders in File Server Resource Manager only.

/scope:"<Scope>"

Gathers data for the report from Scope, which is a list of volume and folder paths. Use a pipe character (|) to separate multiple paths, without leaving blank spaces.

/format:"<FormatList>"

Specifies the format or formats in which the reports will be generated. Use a pipe character (|) to separate multiple report formats, without leaving blank spaces. FormatList must be one or more of the values:

  • html — Generates the report in HyperText Markup Language (HTML) format.

  • dhtml — Generates the report in Dynamic HTML (DHTML) format.

  • xml — Generates the report in Extensible Markup Language (XML) format.

  • csv — Generates the report in comma-separated values (CSV) format.

  • txt — Generates the report in text format.

If you do not specify a report format, reports are generated in DHTML and XML formats by default, except for the Export report, whose default format is XML. Also, the Export report can only be generated in CSV or XML format.

/mailto=<EmailList>

Specifies the list of e-mail addresses for the recipients of the reports. Use a semicolon to separate multiple e-mail addresses, without leaving blank spaces. All e-mail addresses must be in the format account@domain.

Note
You can use the [Admin Email] variable instead of an e-mail address to send the reports to the default e-mail addresses for the administrators. To display and configure the default e-mail addresses, use the Dirquota admin options [LH] command.

/name:"<Name>"

Specifies a new name for the report. This name will be used for the files and folders that will be created when the report is generated. If you do not specify a report name, the default report name will be used. To see the default name for a scheduled report, use the Storrept reports list command.

/filename:<Pattern>

Specifies the file name pattern for the report type specified in the /report parameter. Only those files that have a file name that matches Pattern will be included in the report. You can use wildcard characters in Pattern (for example, *.exe).

If you do not specify Pattern, the default pattern will be used. To display the default pattern, use the Storrept admin defaults command. The default pattern for each report type will be listed under Filter. If Filter is not listed for a report type, files with any file name pattern are included in that report.

This parameter is valid only when the Type value for the /report parameter is FilesByOwner, LargeFiles, LeastRecentlyAccessed, or MostRecentlyAccessed.

/minsize:<Size>[kb|mb|gb]

Specifies the minimum size of the files that will be listed in the Large Files report. All files of size Size or larger will be listed. By default, Size is denoted in kilobytes (KB), but you can append kb, mb, or gb to specify the unit.

If you do not specify Size, the default minimum file size will be used. To display the default minimum file size, use the Storrept admin defaults command.

This parameter is valid only when the Type value for the /add-report parameter is LargeFiles.

/maxage:<Age>

Specifies the maximum number of days since a file was last accessed. All files that were accessed Age days ago or more recently will be included in the Most Recently Accessed Files report.

If you do not specify Age, the default maximum number of days will be used. To display the default maximum number of days, use the Storrept admin defaults command.

This parameter is valid only when the Type value for the /report parameter is MostRecentlyAccessed.

/minage:<Age>

Specifies the minimum number of days since a file was last accessed or since a file screening event occurred. All files that were accessed Age days ago or before will be included in the Least Recently Accessed Files report. All file screening audit events that happened Age days ago or before will be included in the File Screening Audit report. To specify all file screening events, set Age to 0 (zero).

If you do not specify Age, the default minimum number of days will be used. To display the default minimum number of days, use the Storrept admin defaults command.

This parameter is valid only when the Type value for the /report parameter is either LeastRecentlyAccessed or FileScreenAudit.

/minuse:<Usage>

Specifies the minimum percentage of quota usage of the quotas that will be listed in the Quota Usage report. To specify all quotas, set Usage to 0 (zero).

If you do not specify Usage, the default minimum percentage of quota usage will be used. To display the default minimum percentage of quota usage, use the Storrept admin defaults command.

This parameter is valid only when the Type value for the /report parameter is QuotaUsage.

/owner:"<OwnerList>"

Specifies the list of file owners for the File Screen Audit report or the Files by Owner report. OwnerList can be a list of one or more user names separated by a pipe character (|), enclosed in quotation marks. To specify all owners, set FgList to "".

If you do not specify OwnerList, the default list of owners will be included in the report. To display the default list of owners, use the Storrept admin defaults command.

This parameter is valid only when the Type value for the /report parameter is either FileScreenAudit or FilesByOwner.

/filegroup:"<FgList>"]

Specifies a list of file groups for the Files by File Group report. FgList is a list of one or more file group names separated by a pipe character (|), enclosed in quotation marks. To display a list of file groups, use the Filescrn filegroup list [LH] command. To specify all file groups, set FgList to "".

If you do not specify a list of file groups, the default file groups for the Files by File Group report will be included. To display the list of default file groups, use the Storrept admin defaults command.

This parameter is valid only when the Type value for the /report parameter is FilesByFileGroup

/remote:<ComputerName>

Performs the operation on the remote computer ComputerName.

Remarks

  • The shortest sequence of characters that uniquely identifies a parameter can be used as an abbreviation. For example, the following two commands are equivalent:

    Copy Code
    storrept r g /t:reporttask /n
storrept reports generate /task:reporttask /nowait
  • To perform operations on a remote computer by using the /remote:ComputerName parameter:

    • You must be logged on with a domain account that is a member of the Administrators group on both the local computer and the remote computer.

    • The remote computer must be running Windows Server 2008, and File Server Resource Manager must be installed.

    • The Remote File Server Resource Manager Management exception on the remote computer must be enabled. You enable this exception by using Windows Firewall in Control Panel.

Examples.

  • To generate the storage report associated with the FSRMReport task configured on the local computer, type:

    Copy Code
    storrept reports generate /task:FSRMreport
  • To generate a Quota Usage report that lists only those quotas that exceed or match 75 percent of the quota limit on drives C: and E:, and have that report saved both in HTML and text format, type:

    Copy Code
    storrept reports generate /report:quotausage /scope:"c:\|e:\" /minuse:75 /format:"html|txt"

Additional references

Command-Line Syntax Key

Storrept reports


Storrept reports cancel

Applies To: Windows Server 2008 R2,Windows Server 2008

Cancels one or all storage report tasks that are currently running or that are queued to run.

Note
To use this command, you must be logged on as an administrator or a member of the Administrators group.

For examples of how to use this command, see Examples.

Syntax

Copy Code
storrept reports cancel {/running | /queued | /task:<TaskName>} [/remote:<ComputerName>]

Parameters

Parameter | Description
/running | Cancels all report tasks that are currently running.
/queued | Cancels all report tasks that are queued to run.
/task:<TaskName> | Cancels only the storage report task TaskName.
/remote:<ComputerName> | Performs the operation on the remote computer ComputerName.

Remarks

  • The shortest sequence of characters that uniquely identifies a parameter can be used as an abbreviation. For example, the following two commands are equivalent:

    Copy Code
    storrept r c /r
storrept reports cancel /running
  • To perform operations on a remote computer by using the /remote:ComputerName parameter:

    • You must be logged on with a domain account that is a member of the Administrators group on both the local computer and the remote computer.

    • The remote computer must be running Windows Server 2008, and File Server Resource Manager must be installed.

    • The Remote File Server Resource Manager Management exception on the remote computer must be enabled. You enable this exception by using Windows Firewall in Control Panel.

Examples

  • To cancel the FSRMReport task configured on the local computer, type:

    Copy Code
    storrept reports cancel /task:fsrmreport
  • To cancel all storage report task that are running on the remote computer FILESERVER1, type:

    Copy Code
    storrept reports cancel /running /remote:fileserver1

Additional references

Command-Line Syntax Key

Storrept reports


Creating a task for File Server Resource Manager reports by using the schtasks command

Applies To: Windows Server 2008,Windows Server 2008 R2

Before you can schedule a storage report by using the Storrept command-line tool for File Server Resource Manager, you must first create a task on the computer that will be generating the report. You can create this task by using the schtasks command, which is available by default in Windows Server 2008.

This topic explains how to create a task that can be used to schedule a File Server Resource Manager storage report. For an example of how to use the schtasks and storrept commands to schedule a storage report task, see Example.

About the schtasks command

The schtasks command helps you create and manage common tasks that your computer will carry out automatically at the times that you specify. Using schtasks, you can schedule programs and other commands to run periodically or at a specific time. Note that this command-line tool performs the same operations as Task Scheduler in Administrative Tools.

For more information about the schtasks command, see Schtasks.

Creating a task to generate a storage report

You can create new tasks by using the /create parameter with the schtasks command.

To perform this procedure, you must have membership in Administrators, or you must have been delegated the appropriate authority.

To create a task that generates a storage report

  1. Open an elevated Command Prompt window. (Click Start, point to All Programs, click Accessories, right-click Command Prompt, and then click Run as administrator.)

  2. To create the new task, type:

    schtasks /create /sc <Schedule> /tn <TaskName> /tr "storrept reports generate /scheduled /task:<TaskName>" /v1 /st <Time> /ru system

    where:

    • Schedule specifies the schedule type. Valid values are minute, hourly, daily, weekly, monthly, once, onstart, onlogon, and onidle. For more information about these values, see Schtasks.

    • TaskName is the name that you want to give the task. Each task on the system must have a unique name. Use quotation marks to enclose names that include spaces.

    • Time specifies the time of day at which you want the report to be generated. The time format is based on 24-hour time (hh:mm). For example, type 14:30 if you want the report to be generated at 2:30 p.m.. If you do not use the /st parameter, the current time will be used for the scheduling of the task.
Important
You must include both the /scheduled parameter for the storrept command and the /v1 parameter for the schtasks command. Without these parameters, the storage report task will not run successfully.

Note
When specifying a time for the task to run, consider choosing a time of day when your server is less busy. This will ensure minimal impact on system performance.

Note
There are other optional parameters that you can use with the /create parameter of the schtasks command. Those parameters enable you to create more complex schedules and manage how the storage report task will run. For more information, see Schtasks.

Adding a storage report to a scheduled task

After the task has been successfully created, you can use the Storrept reports add command to specify the report that will be generated when the scheduled task runs. You can also use the Storrept reports modify command to add more than one report to the same task.

Example

To create a new task named FSRMReport that will run daily at 1:00 a.m., type:

Copy Code
schtasks /create /sc daily /tn fsrmreport /tr "storrept reports generate /scheduled /task:fsrmreport" /v1 /st 01:00 /ru system

After the FSRMReport task has been successfully created, to add to the task a Quota Usage report for volumes C: and D: in HTML format, and have the report sent to the admin@contoso.com and storage.quota@contoso.com e-mail addresses, type:

Copy Code
storrept reports add /task:fsrmreport /scope:"c:\|d:\" /add-report:quotausage /format:"html" /mailto:admin@contoso.com;storage.quota@contoso.com

To add the File Screen Auditing report to the same FSRMReport task so that both this report and the Quota Usage report are generated when the task runs, type:

Copy Code
storrept reports modify /task:fsrmreport /add-report:filescreenaudit


Storrept admin

Applies To: Windows Server 2008,Windows Server 2008 R2

Configures default administrative options and storage report parameters used by the Dirquota [LH], Filescrn [LH], and Storrept commands, as well as the default parameters for storage reports.

Note
To use this command, you must be logged on as an administrator or a member of the Administrators group.

Syntax

Copy Code
storrept admin options
storrept admin defaults

Parameters

Parameter | Description
Storrept admin options | Configures default administrative options.
Storrept admin defaults | Configures default storage report parameters.

Additional references

Command-Line Syntax Key

Storrept


Storrept admin options

Applies To: Windows Server 2008,Windows Server 2008 R2

Configures e-mail notification options used by File Server Resource Manager and the Dirquota [LH], Filescrn [LH], and Storrept commands. If used without parameters, the storrept admin options command displays the values of the options that are currently configured.

Note
To use this command, you must be logged on as an administrator or a member of the Administrators group.

For examples of how to use this command, see Examples.

Syntax

Copy Code
storrept admin options [/smtp:<ServerName>] [/from:<FromEmail>]
   [/adminemails:<AdminEmails>] [/screenaudit:{enabled | disabled}]
   [/command:{enabled | disabled}] [/runlimitinterval:<NotifyType>,<Interval>]
   [/remote:<ComputerName>]

Parameters

Parameter Description

/smtp:<ServerName>

Specifies ServerName as the Simple Mail Transfer Protocol (SMTP) server to be used when sending e-mail notifications and storage reports.

/from:<FromEmail>

Specifies the default e-mail address to be used as the originating e-mail address for notifications and storage reports. This e-mail address will be used for notifications and storage reports for which a different From address is not explicitly specified.

/adminemails:<AdminEmails>

Specifies the default list of e-mail addresses for the recipients of notifications and storage reports. This parameter also specifies the value of the [Admin Email] variable used in some File Server Resource Manager notifications. Use a semicolon to separate multiple e-mail addresses, without leaving blank spaces between them.

/screenaudit:{enabled | disabled}

Enables or disables file screen auditing. When enabled, file screening activity is recorded in an auditing database. You can review information in this database by generating a File Screening Audit report, using either the File Server Resource Manager snap-in or the Storrept command.

/command:{enabled | disabled}

Enables or disables command-line notifications.

/runlimitinterval:<NotifyType>,<Interval>

Specifies that notifications of type NotifyType can be raised for the same issue only every Interval minutes. This reduces the number of notifications raised for repeatedly exceeding a quota or detecting an unauthorized file.

NotifyType must be one of the following:

  • m — an e-mail notification

  • e — an event log notification

  • c — a command or script execution

  • r — a report generation

/remote:<ComputerName>

Performs the operation on the remote computer ComputerName.

Remarks

  • E-mail addresses specified with the /from: and /adminemails: parameters must be in the format account@domain.

  • The shortest sequence of characters that uniquely identifies a parameter can be used as an abbreviation. For example, the following two commands are equivalent:

    Copy Code
    storrept ad o /f:admin@contoso.com
storrept admin options /from:admin@contoso.com
  • To perform operations on a remote computer by using the /remote:ComputerName parameter:

    • You must be logged on with a domain account that is a member of the Administrators group on both the local computer and the remote computer.

    • The remote computer must be running Windows Server 2008, and File Server Resource Manager must be installed.

    • The Remote File Server Resource Manager Management exception on the remote computer must be enabled. You enable this exception by using Windows Firewall in Control Panel.

Examples

  • To display currently configured administrative options, type:

    Copy Code
    storrept admin options
  • To configure the default From address and administrative recipients for e-mail notifications and storage reports, type:

    Copy Code
    storrept admin options /from:admin@contoso.com /adminemails:backup_operator@contoso.com
  • To specify that e-mail notifications that are raised for repeatedly exceeding a quota or detecting an unauthorized file be sent only once every two hours, type:

    Copy Code
    storrept admin options /runlimitinterval:m,120

Additional references

Command-Line Syntax Key

Storrept admin options


Storrept admin defaults

Applies To: Windows Server 2008 R2,Windows Server 2008

Configures default locations and parameter values for storage reports that are generated with File Server Resource Manager and the Dirquota [LH], Filescrn [LH], and Storrept commands. If used without parameters, the storrept admin defaults command displays the default locations and values that are currently configured.

Note
To use this command, you must be logged on as an administrator or a member of the Administrators group.

For examples of how to use this command, see Examples.

Syntax

Copy Code
storrept admin defaults [/scheduled:<ScheduledPath>]
   [/incident:<IncidentPath>] [/ondemand:<OnDemandPath>]
   [/filegroups-FilesByFileGroup:"<FgList>"]
   [/filename-FilesByOwner:<Pattern>] [/filename-LargeFiles:<Pattern>]
   [/filename-LeastRecentlyAccessed:<Pattern>]
   [/filename-MostRecentlyAccessed:<Pattern>] [/minage-FileScreenAudit:<MinAge>]
   [/minage-LeastRecentlyAccessed:<MinAge>] [/maxage-MostRecentlyAccessed:<MaxAge>]
   [/minsize-LargeFiles:<MinSize>[kb | mb | gb]]
   [/minuse-QuotaUsage:<MinUse>] [/owners-FilesByOwner:"<OwnerList>"]
   [/owners-FileScreenAudit:"<OwnerList>"] [/remote:<ComputerName>]

Parameters

Parameter | Description
/scheduled:<ScheduledPath> | Specifies that scheduled reports should be stored at path ScheduledPath.
/incident:<IncidentPath> | Specifies that incident (notification) reports should be stored at path IncidentPath.
/ondemand:<OnDemandPath> | Specifies that on-demand reports should be stored at path OnDemandPath.
/filegroups-FilesByFileGroup:"<FgList>" | Specifies a list of file groups for the Files by File Group report. The FgList value is a list of one or more file group names separated by a pipe character (|), enclosed in quotation marks. To specify all file groups, set FgList to "". To display a list of file groups, use the Filescrn filegroup list [LH] command.
/filename-FilesByOwner:<Pattern> /filename-LargeFiles:<Pattern> /filename-LeastRecentlyAccessed:<Pattern> /filename-MostRecentlyAccessed:<Pattern> | Specifies the file name pattern for the specified report type. Note that you can use wildcard characters for the value of Pattern (for example, *.exe).
/minage-FileScreenAudit:<MinAge> | Specifies the minimum number of days since a file screening violation occurred for the File Screening Audit report.
/minage-LeastRecentlyAccessed:<MinAge> | Specifies the minimum number of days since a file was last accessed for the Least Recently Accessed Files report.
/maxage-MostRecentlyAccessed:<MaxAge> | Specifies the maximum number of days since a file was last accessed for the Most Recently Accessed Files report.
/minsize-LargeFiles:<MinSize>[kb | mb | gb] | Specifies the minimum file size for the Large Files report. By default, the MinSize value is denoted in kiloybytes (KB), but you can append kb, mb, or gb to specify the unit.
/minUse-QuotaUsage:<MinUse> | Specifies the minimum quota usage percentage for the Quota Usage report.
/owners-FileScreenAudit:"<OwnerList>" /owners-FilesByOwner:"<OwnerList>" | Specifies the list of file owners for the File Screen Audit report or the Files by Owner report. The OwnerList value can be a list of one or more user names separated by a pipe character (|), enclosed in quotation marks. To specify all owners, set OwnerList to "".
/remote:<ComputerName> | Performs the operation on the remote computer ComputerName.

Remarks

  • The shortest sequence of characters that uniquely identifies a parameter can be used as an abbreviation. For example, the following two commands are equivalent:

    Copy Code
    storrept ad d
storrept admin defaults
  • To perform operations on a remote computer by using the /remote:ComputerName parameter:

    • You must be logged on with a domain account that is a member of the Administrators group on both the local computer and the remote computer.

    • The remote computer must be running Windows Server 2008, and File Server Resource Manager must be installed.

    • The Remote File Server Resource Manager Management exception on the remote computer must be enabled. You enable this exception by using Windows Firewall in Control Panel.

Examples

  • To display the current default storage report locations and parameter values, type:

    Copy Code
    storrept admin defaults
  • To store on-demand reports in the D:\reports folder and set the minimum file size parameter to 50 MB for the Large Files report, type:

    Copy Code
    storrept admin defaults /ondemand:d:\reports /minsize-LargeFiles:50mb

Additional references

Command-Line Syntax Key

Storrept admin options


Subst

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Server 2003 with SP1,Windows XP,Windows Server 2003 with SP2,Windows Server 2000,Windows Server 2003,Windows Vista,Windows Server 2003 R2,Windows 7

Associates a path with a drive letter. If used without parameters, subst displays the names of the virtual drives in effect.

For examples of how to use this command, see Examples.

Syntax

Copy Code
subst [<Drive1>: [<Drive2>:]<Path>]
subst <Drive1>: /d

Parameters

Parameter | Description
<Drive1>: | Specifies the virtual drive to which you want to assign a path.
[<Drive2>:]<Path> | Specifies the physical drive and path that you want to assign to a virtual drive.
/d | Deletes a substituted (virtual) drive.
/? | Displays help at the command prompt.

Remarks

  • The following commands do not work and should not be used on drives that are specified in the subst command:

    chkdsk

    diskcomp

    diskcopy

    format

    label

    recover

  • The Drive1 parameter must be within the range that is specified by the lastdrive command. If not, subst displays the following error message:

    Invalid parameter - drive1:

Examples

To create a virtual drive Z for the path B:\User\Betty\Forms, type:

Copy Code
subst z: b:\user\betty\forms

Instead of typing the full path, you can reach this directory by typing the letter of the virtual drive followed by a colon as follows:

Copy Code
z:

Additional references

Command-Line Syntax Key


Sysocmgr

Applies To: Windows Server 2003 R2,Windows Server 2003,Windows Server 2003 with SP2,Windows XP,Windows Server 2003 with SP1

Sysocmgr is deprecated, and is not guaranteed to be supported in future releases of Windows.

This tool is included in Windows Server 2003. For more information see Sysocmgr.


Systeminfo

Applies To: Windows XP,Windows Server 2008 R2,Windows Server 2008,Windows Server 2000,Windows Vista,Windows Server 2003,Windows Server 2003 R2,Windows 7

Displays detailed configuration information about a computer and its operating system, including operating system configuration, security information, product ID, and hardware properties (such as RAM, disk space, and network cards).

For examples of how to use this command, see Examples.

Syntax

Copy Code
Systeminfo [/s <Computer> [/u <Domain>\<UserName> [/p <Password>]]] [/fo {TABLE | LIST | CSV}] [/nh]

Parameters

Parameter | Description
/s <Computer> | Specifies the name or IP address of a remote computer (do not use backslashes). The default is the local computer.
/u <Domain>\<UserName> | Runs the command with the account permissions of the specified user account. If /u is not specified, this command uses the permissions of the user who is currently logged on to the computer that is issuing the command.
/p <Password> | Specifies the password of the user account that is specified in the /u parameter.
/fo <Format> | Specifies the output format with one of the following values: TABLE: Displays output in a table. LIST: Displays output in a list. CSV: Displays output in Comma Separated Values format.
/nh | Suppresses column headers in the output. Valid when the /fo parameter is set to TABLE or CSV.
/? | Displays help at the command prompt.

Examples

To view configuration information for a computer named Srvmain, type:

systeminfo /s srvmain

To remotely view configuration information for a computer named Srvmain2 that is located on the Maindom domain, type:

systeminfo /s srvmain2 /u maindom\hiropln

To remotely view configuration information (in list format) for a computer named Srvmain2 that is located on the Maindom domain, type:

systeminfo /s srvmain2 /u maindom\hiropln /p p@ssW23 /fo list

Additional references

Command-Line Syntax Key


Takeown

Applies To: Windows 7,Windows Server 2003 R2,Windows Server 2003,Windows Vista,Windows Server 2003 with SP2,Windows Server 2008,Windows Server 2008 R2,Windows Server 2003 with SP1

Enables an administrator to recover access to a file that previously was denied, by making the administrator the owner of the file.

For examples of how to use this command, see Examples.

Syntax

Copy Code
takeown [/s <Computer> [/u [<Domain>\]<User name> [/p [<Password>]]]] /f <File name> [/a] [/r [/d {Y|N}]]

Parameters

Parameter Description

/s <Computer>

Specifies the name or IP address of a remote computer (do not use backslashes). The default value is the local computer. This parameter applies to all of the files and folders specified in the command.

/u [<Domain>\]<User name>

Runs the script with the permissions of the specified user account. The default value is system permissions.

/p [<Password>]

Specifies the password of the user account that is specified in the /u parameter.

/f <File name>

Specifies the file name or directory name pattern. You can use the wildcard character * when specifying the pattern. You can also use the syntax ShareName\FileName.

/a

Gives ownership to the Administrators group instead of the current user.

/r

Performs a recursive operation on all files in the specified directory and subdirectories.

/d {Y | N}

Suppresses the confirmation prompt that is displayed when the current user does not have the "List Folder" permission on a specified directory, and instead uses the specified default value. Valid values for the /d option are as follows:

  • Y: Take ownership of the directory.

  • N: Skip the directory.

Note that you must use this option in conjunction with the /r option.

/?

Displays help at the command prompt.

Remarks

  • This command is typically used in batch files.

  • If the /a parameter is not specified, file ownership is given to the user who is currently logged on to the computer.

  • You cannot use wildcard characters (? and *) with the takeown command.

  • After deleting the lock with takeown, you might have to use Windows Explorer or the cacls command to give yourself full permissions to the files and directories before you can delete them. For more information about cacls, see "Additional references" at the end of this topic.

Examples

To take ownership of a file named Lostfile, type:

Copy Code
takeown /f lostfile

Additional references

Command-Line Syntax Key


Tapicfg
See Also

Applies To: Windows Server 2008 R2,Windows Server 2008

Tapicfg

Creates, removes, or displays a TAPI application directory partition, or sets a default TAPI application directory partition. TAPI 3.1 clients can use the information in this application directory partition with the directory service locator service to find and communicate with TAPI directories.

You can also use Tapicfg to create or remove service connection points, which enable TAPI clients to efficiently locate TAPI application directory partitions in a domain. For more information, see Remarks.

To view the command syntax, click a command.

  • tapicfg install

  • tapicfg remove

  • tapicfg publishscp

  • tapicfg removescp

  • tapicfg show

  • tapicfg makedefault

tapicfg install

Creates a TAPI application directory partition.

Syntax

tapicfg install /directory: PartitionName [/server:DCName] [/forcedefault]

Parameters
install /directory: PartitionName

Required. Specifies the DNS name of the TAPI application directory partition to be created. This name must be a fully qualified domain name.

/server: DCName

Specifies the DNS name of the domain controller on which the TAPI application directory partition is created. If the domain controller name is not specified, the name of the local computer is used.

/forcedefault

Specifies that this directory is the default TAPI application directory partition for the domain. There can be multiple TAPI application directory partitions in a domain.

If this directory is the first TAPI application directory partition created on the domain, it is automatically set as the default, regardless of whether you use the /forcedefault option.

tapicfg remove

Removes a TAPI application directory partition.
Syntax

tapicfg remove /directory: PartitionName

Parameters
remove /directory: PartitionName

Required. Specifies the DNS name of the TAPI application directory partition to be removed. Note that this name must be a fully qualified domain name.

tapicfg publishscp

Creates a service connection point to publish a TAPI application directory partition.
Syntax

tapicfg publishscp /directory: PartitionName [/domain:DomainName] [/forcedefault]

Parameters
publishscp /directory: PartitionName

Required. Specifies the DNS name of the TAPI application directory partition that the service connection point will publish.

/domain: DomainName

Specifies the DNS name of the domain in which the service connection point is created. If the domain name is not specified, the name of the local domain is used.

/forcedefault

Specifies that this directory is the default TAPI application directory partition for the domain. There can be multiple TAPI application directory partitions in a domain.

tapicfg removescp

Removes a service connection point for a TAPI application directory partition.
Syntax

tapicfg removescp /directory: PartitionName [/domain:DomainName]

Parameters
removescp /directory: PartitionName

Required. Specifies the DNS name of the TAPI application directory partition for which a service connection point is removed.

/domain: DomainName

Specifies the DNS name of the domain from which the service connection point is removed. If the domain name is not specified, the name of the local domain is used.

tapicfg show

Displays the names and locations of the TAPI application directory partitions in the domain.
Syntax

tapicfg show [/defaultonly][/domain:DomainName]

Parameters
/defaultonly

Displays the names and locations of only the default TAPI application directory partition in the domain.

/domain: DomainName

Specifies the DNS name of the domain for which the TAPI application directory partitions are displayed. If the domain name is not specified, the name of the local domain is used.

tapicfg makedefault

Sets the default TAPI application directory partition for the domain.
Syntax

tapicfg makedefault /directory: PartitionName[/domain:DomainName]

Parameters
makedefault /directory: PartitionName

Required. Specifies the DNS name of the TAPI application directory partition set as the default partition for the domain. Note that this name must be a fully qualified domain name.

Specifies the DNS name of the domain for which the TAPI application directory partition is set as the default. If the domain name is not specified, the name of the local domain is used.

tapicfg /?

Displays Help at the command prompt.

Remarks

You must be a member of the Enterprise Admins group in Active Directory to run either tapicfg install (to create a TAPI application directory partition) or tapicfg remove (to remove a TAPI application directory partition).

This command-line tool can be run on any computer that is a member of the domain.

User-supplied text (such as the names of TAPI application directory partitions, servers, and domains) with International or Unicode characters are only displayed correctly if appropriate fonts and language support are installed.

You can still use Internet Locator Service (ILS) servers in your organization, if ILS is needed to support certain applications, because TAPI clients running Windows XP or a Windows Server 2003 operating system can query either ILS servers or TAPI application directory partitions.

You can use Tapicfg to create or remove service connection points. If the TAPI application directory partition is renamed for any reason (for example, if you rename the domain in which it resides), you must remove the existing service connection point and create a new one that contains the new DNS name of the TAPI application directory partition to be published. Otherwise, TAPI clients are unable to locate and access the TAPI application directory partition. You can also remove a service connection point for maintenance or security purposes (for example, if you do not want to expose TAPI data on a specific TAPI application directory partition).

Examples

To create a TAPI application directory partition named tapifiction.testdom.microsoft.com on a server named testdc.testdom.microsoft.com and then set it as the default TAPI application directory partition for the new domain, type:

tapicfg install /directory:tapifiction.testdom.microsoft.com /server:testdc.testdom.microsoft.com /forcedefault

To display the name of the default TAPI application directory partition for the new domain, type:

tapicfg show /defaultonly

Formatting legend

Format | Meaning
Italic | Information that the user must supply
Bold | Elements that the user must type exactly as shown
Ellipsis (...) | Parameter that can be repeated several times in a command line
Between brackets ([]) | Optional items
Between braces ({}); choices separated by pipe (|). Example: {even|odd} | Set of choices from which the user must choose only one
Courier font | Code or program output

See Also

Command shell overviewCommand-line reference A-ZCreate a TAPI application directory partitionRemove a TAPI application directory partition


Taskkill

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows XP,Windows Server 2000,Windows Server 2003,Windows Server 2003 R2,Windows 7

Ends one or more tasks or processes. Processes can be ended by process ID or image name. Taskkill replaces the kill tool.

For examples of how to use this command, see Examples.

Syntax

Copy Code
taskkill [/s <Computer> [/u [<Domain>\]<UserName> [/p [<Password>]]]] {[/fi <Filter>] [...] [/pid <ProcessID> | /im <ImageName>]} [/f] [/t]

Parameters

Parameter | Description
/s <Computer> | Specifies the name or IP address of a remote computer (do not use backslashes). The default is the local computer.
/u <Domain>\<UserName> | Runs the command with the account permissions of the user who is specified by UserName or Domain\UserName. /u can be specified only if /s is specified. The default is the permissions of the user who is currently logged on to the computer that is issuing the command.
/p <Password> | Specifies the password of the user account that is specified in the /u parameter.
/fi <Filter> | Applies a filter to select a set of tasks. You can use more than one filter or use the wildcard character (*) to specify all tasks or image names. See the following table for valid filter names, operators, and values.
/pid <ProcessID> | Specifies the process ID of the process to be terminated.
/im <ImageName> | Specifies the image name of the process to be terminated. Use the wildcard character (*) to specify all image names.
/f | Specifies that processes be forcefully terminated. This parameter is ignored for remote processes; all remote processes are forcefully terminated.
/t | Terminates the specified process and any child processes started by it.

Filter names, operators, and values

Filter Name | Valid Operators | Valid Value(s)
STATUS | eq, ne | RUNNING | NOT RESPONDING | UNKNOWN
IMAGENAME | eq, ne | Image name
PID | eq, ne, gt, lt, ge, le | PID value
SESSION | eq, ne, gt, lt, ge, le | Session number
CPUTIME | eq, ne, gt, lt, ge, le | CPU time in the format HH:MM:SS, where MM and SS are between 0 and 59 and HH is any unsigned number
MEMUSAGE | eq, ne, gt, lt, ge, le | Memory usage in KB
USERNAME | eq, ne | Any valid user name (User or Domain\User)
SERVICES | eq, ne | Service name
WINDOWTITLE | eq, ne | Window title
MODULES | eq, ne | DLL name

Remarks

  • The WINDOWTITLE and STATUS filters are not supported when a remote system is specified.

  • The wildcard character (*) is accepted for the /im option only when a filter is applied.

  • Termination of remote processes is always carried out forcefully, regardless of whether the /f option is specified.

  • Supplying a computer name to the HOSTNAME filter causes a shutdown and all processes are stopped.

  • You can use tasklist to determine the process ID (PID) for the process to be terminated.

Examples

To end the processes with process IDs 1230, 1241, and 1253, type:

Copy Code
taskkill /pid 1230 /pid 1241 /pid 1253

To forcefully end the process "Notepad.exe" if it was started by the system, type:

Copy Code
taskkill /f /fi "USERNAME eq NT AUTHORITY\SYSTEM" /im notepad.exe

To end all processes on the remote computer "Srvmain" with an image name beginning with "note," while using the credentials for the user account Hiropln, type:

Copy Code
taskkill /s srvmain /u maindom\hiropln /p p@ssW23 /fi "IMAGENAME eq note*" /im *

To end the process with the process ID 2134 and any child processes that it started, but only if those processes were started by the Administrator account, type:

Copy Code
taskkill /pid 2134 /t /fi "username eq administrator"

To end all processes that have a process ID greater than or equal to 1000, regardless of their image names, type:

Copy Code
taskkill /f /fi "PID ge 1000" /im *

Additional references

Command-Line Syntax Key


Tasklist

Applies To: Windows 7,Windows Server 2003 R2,Windows Server 2003,Windows Server 2000,Windows XP,Windows Server 2008 R2,Windows Server 2008

Displays a list of currently running processes on the local computer or on a remote computer. Tasklist replaces the tlist tool.

For examples of how to use this command, see Examples.

Syntax

Copy Code
tasklist [/s <Computer> [/u [<Domain>\]<UserName> [/p <Password>]]] [{/m <Module> | /svc | /v}] [/fo {table | list | csv}] [/nh] [/fi <Filter> [/fi <Filter> [ ... ]]]

Parameters

Parameter | Description
/s <Computer> | Specifies the name or IP address of a remote computer (do not use backslashes). The default is the local computer.
/u [<Domain>\]<UserName> | Runs the command with the account permissions of the user who is specified by UserName or Domain\UserName. /u can be specified only if /s is specified. The default is the permissions of the user who is currently logged on to the computer that is issuing the command.
/p <Password> | Specifies the password of the user account that is specified in the /u parameter.
/m <Module> | Lists all tasks with DLL modules loaded that match the given pattern name. If the module name is not specified, this option displays all modules loaded by each task.
/svc | Lists all the service information for each process without truncation. Valid when the /fo parameter is set to table.
/v | Displays verbose task information in the output. For complete verbose output without truncation, use /v and /svc together.
/fo {table | list | csv} | Specifies the format to use for the output. Valid values are table, list, and csv. The default format for output is table.
/nh | Suppresses column headers in the output. Valid when the /fo parameter is set to table or csv.
/fi <Filter> | Specifies the types of processes to include in or exclude from the query. See the following table for valid filter names, operators, and values.
/? | Displays help at the command prompt.

Filter names, operators, and values

Filter Name | Valid Operators | Valid Values
STATUS | eq, ne | RUNNING | NOT RESPONDING | UNKNOWN
IMAGENAME | eq, ne | Image name
PID | eq, ne, gt, lt, ge, le | PID value
SESSION | eq, ne, gt, lt, ge, le | Session number
SESSIONNAME | eq, ne | Session name
CPUTIME | eq, ne, gt, lt, ge, le | CPU time in the format HH:MM:SS, where MM and SS are between 0 and 59 and HH is any unsigned number
MEMUSAGE | eq, ne, gt, lt, ge, le | Memory usage in KB
USERNAME | eq, ne | Any valid user name
SERVICES | eq, ne | Service name
WINDOWTITLE | eq, ne | Window title
MODULES | eq, ne | DLL name

Remarks

  • The WINDOWTITLE and STATUS filters are not supported when a remote system is specified.

Examples

To list all tasks with a process ID greater than 1000, and display them in CSV format, type:

Copy Code
tasklist /v /fi "PID gt 1000" /fo csv

To list the system processes that are currently running, type:

Copy Code
tasklist /fi "USERNAME ne NT AUTHORITY\SYSTEM" /fi "STATUS eq running"

To list detailed information for all processes that are currently running, type:

Copy Code
tasklist /v /fi "STATUS eq running"

To list all the service information for processes on the remote computer "Srvmain" that have a DLL name beginning with "ntdll," type:

Copy Code
tasklist /s srvmain /svc /fi "MODULES eq ntdll*"

To list the processes on the remote computer "Srvmain," using the credentials of your currently logged-on user account, type:

Copy Code
tasklist /s srvmain

To list the processes on the remote computer "Srvmain," using the credentials of the user account Hiropln, type:

Copy Code
tasklist /s srvmain /u maindom\hiropln /p p@ssW23

Additional references

Command-Line Syntax Key


Tcmsetup

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows XP,Windows Server 2003 with SP1,Windows Server 2003 with SP2,Windows Server 2003,Windows Vista,Windows Server 2003 R2,Windows 7,Windows Server 2008 R2 with SP1

Sets up or disables the TAPI client.

Syntax

Copy Code
tcmsetup [/q] [/x] /c <Server1> [<Server2> …]
tcmsetup  [/q] /c /d

Parameters

Parameter | Description
/q | Prevents the display of message boxes.
/x | Specifies that connection-oriented callbacks will be used for heavy traffic networks where packet loss is high. When this parameter is omitted, connectionless callbacks will be used.
/c | Required. Specifies client setup.
<Server1> | Required. Specifies the name of the remote server that has the TAPI service providers that the client will use. The client will use the service providers' lines and phones. The client must be in the same domain as the server or in a domain that has a two-way trust relationship with the domain that contains the server.
<Server2>… | Specifies any additional server or servers that will be available to this client. If you specify a list of servers is, use a space to separate the server names.
/d | Clears the list of remote servers. Disables the TAPI client by preventing it from using the TAPI service providers that are on the remote servers.
/? | Displays help at the command prompt.

Remarks

  • To perform this procedure, you must be a member of the Administrators group on the local computer, or you must have been delegated the appropriate authority. If the computer is joined to a domain, members of the Domain Admins group might be able to perform this procedure. As a security best practice, consider using Run as to perform this procedure.

  • In order for TAPI to function correctly, you must run tcmsetup to specify the remote servers that will be used by TAPI clients.

  • Before a client user can use a phone or line on a TAPI server, the telephony server administrator must assign the user to the phone or line.

  • The list of telephony servers that is created by this command replaces any existing list of telephony servers available to the client. You cannot use this command to add to the existing list.

Additional references

Command-Line Syntax Key

Command shell overview

Specify telephony servers on a client computer

Assign a telephony user to a line or phone

Runas

Using Run as


Telnet

Applies To: Windows 7,Windows Server 2003 R2,Windows Vista,Windows Server 2003,Windows Server 2000,Windows XP,Windows Server 2008 R2,Windows Server 2008

Communicates with a computer running the Telnet Server service. For examples of how this command can be used, see Examples.

Syntax

Copy Code
telnet [/a] [/e <EscapeChar>] [/f <FileName>] [/l <UserName>] [/t {vt100 | vt52 | ansi | vtnt}] [<Host> [<Port>]] [/?]

Parameters

Parameter | Description
/a | Attempt automatic logon. Same as /l option except uses the currently logged on user’s name.
/e <EscapeChar> | Escape character used to enter the Telnet client prompt.
/f <FileName> | File name used for client side logging.
/l <UserName> | Specifies the user name to log on with on the remote computer.
/t {vt100 | vt52 | ansi | vtnt} | Specifies the terminal type. Supported terminal types are vt100, vt52, ansi, and vtnt.
<Host> [<Port>] | Specifies the hostname or IP address of the remote computer to connect to, and optionally the TCP port to use (default is TCP port 23).
/? | Displays Help at the command prompt. Alternatively, you can type /h.

Remarks

  • You must install the Telnet client software before you can run this command. For more information, see Installing Telnet.

  • You can run Telnet without parameters to enter the Telnet context, indicated by the Telnet prompt (Microsoft Telnet>). From the Telnet prompt, you can use Telnet commands to manage the computer running the Telnet client.

Examples

Use Telnet to connect to the computer running the Telnet Server Service at telnet.microsoft.com.

Copy Code
telnet telnet.microsoft.com

Use Telnet to connect to the computer running the Telnet Server Service at telnet.microsoft.com on TCP port 44 and log the session activity in a local file called telnetlog.txt

Copy Code
telnet /f telnetlog.txt telnet.microsoft.com 44

Additional references

  • Installing Telnet

  • Telnet Technical Reference

  • Command-Line Syntax Key


Telnet: close

Applies To: Windows 7,Windows Server 2003 R2,Windows Server 2003,Windows Vista,Windows Server 2000,Windows XP,Windows Server 2008 R2,Windows Server 2008

Closes the current connection. For examples of how this command can be used, see Examples.

Syntax

Copy Code
c[lose]

Parameters

none

Examples

Close the current connection.

Copy Code
c

Additional references

  • Command-Line Syntax Key


Telnet: display

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows XP,Windows Server 2000,Windows Vista,Windows Server 2003,Windows Server 2003 R2,Windows 7

Displays operating parameters. For examples of how this command can be used, see Examples.

Syntax

Copy Code
d[isplay]

Parameters

none

Examples

Display operating parameters.

Copy Code
d

Additional references

  • Command-Line Syntax Key


Telnet: open

Applies To: Windows 7,Windows Server 2003 R2,Windows Server 2003,Windows Vista,Windows Server 2000,Windows XP,Windows Server 2008 R2,Windows Server 2008

Connects to a Telnet server. For examples of how this command can be used, see Examples.

Syntax

Copy Code
o[pen] <HostName> [<Port>]

Parameters

Parameter | Description
<HostName> | Specifies the computer name or IP address.
[<Port>] | Specifies the TCP port that the Telnet server is listening on. The default is TCP port 23.

Examples

Connect to a Telnet server at telnet.microsoft.com.

Copy Code
o telnet.microsoft.com

Additional references

  • Command-Line Syntax Key


Telnet: quit

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows XP,Windows Server 2000,Windows Server 2003,Windows Vista,Windows Server 2003 R2,Windows 7

Exits Telnet. For examples of how this command can be used, see Examples.

Syntax

Copy Code
q[uit]

Parameters

none

Examples

Exit Telnet.

Copy Code
q

Additional references

  • Command-Line Syntax Key


Telnet: set

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows XP,Windows Server 2000,Windows Vista,Windows Server 2003,Windows Server 2003 R2,Windows 7

Sets options. For examples of how this command can be used, see Examples.

Syntax

Copy Code
set [bsasdel] [crlf] [delasbs] [escape <Char>] [localecho] [logfile <FileName>] [logging] [mode {console | stream}] [ntlm] [term {ansi | vt100 | vt52 | vtnt}] [?]

Parameters

Parameter | Description
bsasdel | Sends Backspace as a Delete.
crlf | Sends CR & LF (0x0D, 0x 0A) when the Enter key is pressed. Known as “New line mode”.
delasbs | Sends Delete as a Backspace.
escape <Character> | Sets the escape character used to enter the Telnet client prompt. The escape character can be a single character, or it can be a combination of the CTRL key plus a character. To set a control-key combination, hold down the CTRL key while you type the character that you want to assign.
localecho | Turns on local echo.
logfile <FileName> | Logs the current Telnet session to the local file. Logging begins automatically when you set this option.
logging | Turns on logging. If no log file is set, an error message appears.
mode {console | screen} | Sets the operation mode.
ntlm | Turns on NTLM authentication.
term {ansi | vt100 | vt52 | vtnt} | Sets the terminal type.
? | Displays Help for this command.

Remarks

  1. You can use the unset command to turn off an option that was previously set.

  2. On non-English versions of Telnet, the codeset <option> is available. Codeset <option> sets the current code set to an option, which can be any one of the following: Shift JIS, Japanese EUC, JIS Kanji, JIS Kanji (78), DEC Kanji, NEC Kanji. You should set the same code set on the remote computer.

Examples

Set the log file and begin logging to the local file tnlog.txt

Copy Code
set logfile tnlog.txt

Additional references

  • Command-Line Syntax Key


Telnet: send

Applies To: Windows 7,Windows Server 2003 R2,Windows Vista,Windows Server 2003,Windows Server 2000,Windows XP,Windows Server 2008 R2,Windows Server 2008

Sends Telnet commands to the Telnet server. For examples of how this command can be used, see Examples.

Syntax

Copy Code
sen[d] {ao | ayt | brk | esc | ip | synch | <string>} [?]

Parameters

Parameter | Description
ao | Sends the Telnet command “Abort Output”.
ayt | Sends the Telnet command “Are You There”.
brk | Sends the Telnet command “brk”.
esc | Sends the current Telnet escape character.
ip | Sends the Telnet command “Interrupt Process”.
synch | Sends the Telnet command “synch”.
<string> | Sends whatever string you type to the Telnet server.
? | Displays Help associated with this command.

Examples

Send “Are you there” to the Telnet server.

Copy Code
sen ayt

Additional references

  • Command-Line Syntax Key


Telnet: status

Applies To: Windows 7,Windows Server 2003 R2,Windows Server 2003,Windows Vista,Windows Server 2000,Windows XP,Windows Server 2008 R2,Windows Server 2008

Displays status information. For examples of how this command can be used, see Examples.

Syntax

Copy Code
st[atus]

Parameters

none

Examples

Display status information.

Copy Code
st

Additional references

  • Command-Line Syntax Key


Telnet: unset

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows XP,Windows Server 2000,Windows Vista,Windows Server 2003,Windows Server 2003 R2,Windows 7

Turns off previously set options. For examples of how this command can be used, see Examples.

Syntax

Copy Code
u[nset] {bsasdel | crlf | delasbs | escape | localecho | logging | ntlm} [?]

Parameters

Parameter | Description
bsasdel | Sends Backspace as a Backspace.
crlf | Sends the Enter key as a CR. Also known as line feed mode.
delasbs | Sends Delete as Delete.
escape | Removes the escape character setting.
localecho | Turns off localecho.
logging | Turns off logging.
ntlm | Turns off NTLM authentication.
? | Displays Help for this command.

Examples

Turn off logging.

Copy Code
u logging

Additional references

  • Command-Line Syntax Key


Telnet: ?

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows XP,Windows Server 2000,Windows Vista,Windows Server 2003,Windows Server 2003 R2,Windows 7

Displays Telnet Help. For examples of how this command can be used, see Examples.

Syntax

Copy Code
?

Parameters

none

Remarks

You can also type h for Help.

Examples

Display Telnet Help.

Copy Code
?

Additional references

  • Command-Line Syntax Key


Tftp

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows XP,Windows Vista,Windows Server 2003,Windows Server 2000,Windows Server 2003 R2,Windows 7

Transfers files to and from a remote computer, typically a computer running UNIX, that is running the Trivial File Transfer Protocol (TFTP) service or daemon. TFTP is typically used by embedded devices or systems that retrieve firmware, configuration information, or a system image during the boot process from a TFTP server. For examples of how this command can be used, see Examples.

Syntax

Copy Code
tftp [-i] [<Host>] [{get | put}] <Source> [<Destination>]

Parameters

Parameter | Description
-i | Specifies binary image transfer mode (also called octet mode). In binary image mode, the file is transferred in one-byte units. Use this mode when transferring binary files. If -i is omitted, the file is transferred in ASCII mode. This is the default transfer mode. This mode converts the end-of-line (EOL) characters to an appropriate format for the specified computer. Use this mode when transferring text files. If a file transfer is successful, the data transfer rate is displayed.
<Host> | Specifies the local or remote computer.
put | Transfers the file Source on the local computer to the file Destination on the remote computer. Because the TFTP protocol does not support user authentication, the user must be logged onto the remote computer, and the files must be writable on the remote computer.
get | Transfers the file Destination on the remote computer to the file Source on the local computer.
<Source> | Specifies the file to transfer.
<Destination> | Specifies where to transfer the file.

Remarks

  • You can install the TFTP client using the Add Features Wizard.

  • The TFTP protocol does not support any authentication or encryption mechanism, and as such can introduce a security risk when present. Installing the TFTP client is not recommended for systems connected to the Internet.

  • The TFTP client is optional software, and marked as deprecated on Windows Vista and later versions of the Windows operating system. A TFTP server service is no longer provided by Microsoft for security reasons.

Examples

Copy the file boot.img from the remote computer Host1.

Copy Code
tftp –i Host1 get boot.img

Additional references

  • Command-Line Syntax Key


Time

Applies To: Windows 7,Windows Server 2003 R2,Windows Server 2000,Windows Server 2003,Windows XP,Windows Server 2008 R2,Windows Server 2008

Displays or sets the system time. If used without parameters, time displays the current system time and prompts you to enter a new time.

For examples of how to use this command, see Examples.

Syntax

Copy Code
time [/t | [<HH>[:<MM>[:<SS>]] [am|pm]]]

Parameters

Parameter | Description
<HH>[:<MM>[:<SS>[.<NN>]]] [am|pm] | Sets the system time to the new time specified, where HH is in hours (required), MM is in minutes, and SS is in seconds. NN can be used to specify hundredths of a second. If am or pm is not specified, time uses the 24-hour format by default.
/t | Displays the current time without prompting you for a new time.
/? | Displays help at the command prompt.

Remarks

  • To change the current time, you must have administrative credentials.

  • You must separate values for HH, MM, and SS with colons (:). SS and NN must be separated with a period (.).

  • Valid HH values are 0 through 24.

  • Valid MM and SS values are 0 through 59.

Examples

If command extensions are enabled, to display the current system time, type:

Copy Code
time /t

To change the current system time to 5:30 P.M., type either of the following:

Copy Code
time 17:30:00
time 5:30 pm

To display the current system time, followed by a prompt to enter a new time, type:

Copy Code
The current time is: 17:33:31.35
Enter the new time:

To keep the current time and return to the command prompt, press ENTER. To change the current time, type the new time and then press ENTER.

Additional references

Command-Line Syntax Key


Timeout

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows XP,Windows Server 2003,Windows Vista,Windows Server 2000,Windows Server 2003 R2,Windows 7

Pauses the command processor for the specified number of seconds.

For examples of how to use this command, see Examples.

Syntax

Copy Code
timeout/t <TimeoutInSeconds> [/nobreak]

Parameters

Parameter | Description
/t <TimeoutInSeconds> | Specifies the decimal number of seconds (between -1 and 99999) to wait before the command processor continues processing. The value -1 causes the computer to wait indefinitely for a keystroke.
/nobreak | Specifies to ignore user key strokes.
/? | Displays help at the command prompt.

Remarks

  • The timeout command is typically used in batch files.

  • A user keystroke resumes the command processor execution immediately, even if the timeout period has not expired.

  • When used in conjunction with the sleep command, timeout is similar to the pause command.

Examples

To pause the command processor for ten seconds, type:

Copy Code
timeout /t 10

To pause the command processor for 100 seconds and ignore any keystroke, type:

Copy Code
timeout /t 100 /nobreak

To pause the command processor indefinitely until a key is pressed, type:

Copy Code
timeout /t -1

Additional references

Command-Line Syntax Key


Title

Applies To: Windows 7,Windows Server 2003 R2,Windows Server 2000,Windows Vista,Windows Server 2003,Windows XP,Windows Server 2008 R2,Windows Server 2008

Creates a title for the Command Prompt window.

For examples of how to use this command, see Examples.

Syntax

Copy Code
title [<String>]

Parameters

Parameter | Description
<String> | Specifies the title of the Command Prompt window.
/? | Displays help at the command prompt.

Remarks

  • To create window title for batch programs, include the title command at the beginning of a batch program.

  • After a window title is set, you can reset it only by using the title command.

Examples

In the following sample script, the title of the Command Prompt window is changed to "Updating Files" while the batch file executes the copy command. After the command is executed, the text Files Updated is displayed, and the title of the Command Prompt window is changed back to "Command Prompt."

Copy Code
@echo off
title Updating Files
copy \\server\share\*.xls c:\users\common\*.xls
echo Files Updated.
title Command Prompt

Additional references

Command-Line Syntax Key


Tlntadmn

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Vista,Windows 7

Administers a local or remote computer that is running the Telnet Server Service. For examples of how this command can be used, see Examples.

Syntax

Copy Code
tlntadmn [<ComputerName>] [-u <UserName>] [-p <Password>] [{start | stop | pause | continue}] [-s {<SessionID> | all}] [-k {<SessionID> | all}] [-m {<SessionID> | all} “<Message>”] [config [dom = <Domain>] [ctrlakeymap = {yes | no}] [timeout = <hh>:<mm>:<ss>] [timeoutactive = {yes | no}] [maxfail = <Attempts>] [maxconn = <Connections>] [port = <Number>] [sec {+ | -}NTLM {+ | -}passwd] [mode = {console | stream}]] [-?]

Parameters

Parameter | Description
<ComputerName> | Specifies the name of the server to connect to. The default is the local computer.
-u <UserName> -p <Password> | Specifies administrative credentials for a remote server that you want to administer. This parameter is required if you want to administer a remote server to which you are not logged on with administrative credentials.
start | Starts the Telnet Server Service.
stop | Stops the Telnet Server Service
pause | Pauses the Telnet Server Service. No new connections will be accepted.
continue | Resumes the Telnet Server Service.
-s {<SessionID> | all} | Displays active Telnet sessions.
-k {<SessionID> | all} | Ends Telnet sessions. Type the Session ID to end a specific session, or type all to end all the sessions.
-m {<SessionID> | all} “<Message>” | Sends a message to one or more sessions. Type the session ID to send a message to a specific session, or type all to send a message to all sessions. Type the message that you want to send between quotation marks.
config dom = <Domain> | Configures the default domain for the server.
config ctrlakeymap = {yes | no} | Specifies if you want the Telnet server to interpret CTRL+A as ALT. Type yes to map the shortcut key, or type no to prevent the mapping.
config timeout = <hh>:<mm>:<ss> | Sets the time-out period in hours, minutes, and seconds.
config timeoutactive = {yes | no | Enables the idle session timeout.
config maxfail = <Attempts> | Sets the maximum number of failed logon attempts before disconnecting.
config maxconn = <Connections> | Sets the maximum number of connections.
config port = <Number> | Sets the Telnet port. You must specify the port with an integer smaller than 1024.
config sec {+ | -}NTLM {+ | -}passwd | Specifies whether you want to use NTLM, a password, or both to authenticate logon attempts. To use a particular type of authentication, type a plus sign (+) before that type of authentication. To prevent using a particular type of authentication, type a minus sign (-) before that type of authentication.
config mode = {console | stream} | Specifies the mode of operation.
-? | Displays Help at the command prompt.

Remarks

  • To display the server settings, type tlntadmn without any parameters.

  • To use the tlntadmn command, you must log on to the local computer with administrative credentials. To administer a remote computer, you must also provide administrative credentials for the remote computer. You can do so by logging on to the local computer with an account that has administrative credentials for both the local computer and the remote computer. If you cannot use this method, you can use the -u and -p parameters to provide administrative credentials for the remote computer.

Examples

Configure the idle session timeout to 30 minutes.

Copy Code
tlntadmn config timeout=0:30:0

Display active Telnet sessions.

Copy Code
tlntadmn -s

Additional references

  • Telnet Operations Guide

  • Command-Line Syntax Key


Tracerpt

Applies To: Windows 7,Windows Server 2003 R2,Windows Server 2003,Windows Vista,Windows Server 2000,Windows Server 2008 R2,Windows Server 2008,Windows XP

The tracerpt command can be used to parse Event Trace Logs, log files generated by Performance Monitor, and real-time Event Trace providers. It generates dump files, report files, and report schemas.

For examples of how to use tracerpt, see Examples.

Syntax

Copy Code
tracerpt <[-l] <value [value [...]]>|-rt <session_name [session_name [...]]>> [options]

Options

Option flag | Description
-? | Displays context sensitive help.
-config <filename> | Load a settings file containing command options.
-y | Answer yes to all questions without prompting.
-f <XML | HTML> | Define report format.
-of <CSV | EVTX | XML> | Define dump format. Default is XML.
-df <filename> | Create a Microsoft-specific counting/reporting schema file.
-int <filename> | Dump the interpreted event structure to the specified file.
-rts | Report raw timestamp in the event trace header. Can only be used with -o, not -report or -summary.
-tmf <filename> | Specify a Trace Message Format definition file.
-tp <value> | Specify the TMF file search path. Multiple paths may be used, separated by a semicolon (;).
-i <value> | Specify the provider image path. The matching PDB will be located in the Symbol Server. Multiple paths can be used, separated by a semicolon (;).
-pdb <value> | Specify the symbol server path. Multiple paths can be used, separated by a semicolon (;).
-gmt | Convert WPP payload timestamps to Greenwich Mean Time.
-rl <value> | Define System Report Level from 1 to 5. Default is 1.
-summary [filename] | Generate a summary report text file. Filename if not specified is summary.txt.
-o [filename] | Generate a text output file. Filename if not specified is dumpfile.xml.
-report [filename] | Generate a text output report file. Filename if not specified is workload.xml.
-lr | Specify "less restrictive." This uses best efforts for events that do not match the events schema.
-export [filename] | Generate an Event Schema export file. Filename if not specified is schema.man.
[-l] <value [value […]]> | Specify the Event Trace log file to process.
-rt <session_name [session_name […]]> | Specify Real-time Event Trace Session data sources.

Examples

  • This example creates a report based on the two event logs logfile1.etl and logfile2.etl and creates the dump file logdump.xml in XML format.

    Copy Code
    tracerpt logfile1.etl logfile2.etl -o logdump.xml -of XML
  • This example creates a report based on the event log logfile.etl, creates the dump file logdmp.xml in XML format, uses best efforts to identify events not in the schema, produces a summary report file logdump.txt, and produces the report file logrpt.xml.

    Copy Code
    tracerpt logfile.etl -o logdmp.xml -of XML -lr -summary logdmp.txt -report logrpt.xml
  • This example uses the two event logs logfile1.etl and logfile2.etl to produce a dump file and report file with the default filenames.

    Copy Code
    tracerpt logfile1.etl logfile2.etl -o -report
  • This example uses the event log logfile.etl and the performance log counterfile.blg to produce the report file logrpt.xml and the Microsoft-specific XML schema file schema.xml.

    Copy Code
    tracerpt logfile.etl counterfile.blg -report logrpt.xml -df schema.xml
  • This example reads the real-time Event Trace Session "NT Kernel Logger" and produces the dump file logfile.csv in CSV format.

    Copy Code
    tracerpt -rt "NT Kernel Logger" -o logfile.csv -of CSV


Tracert
See Also

Applies To: Windows XP,Windows Server 2008,Windows Server 2008 R2,Windows Server 2000,Windows Vista,Windows Server 2003,Windows 7,Windows Server 2003 R2

Tracert

Determines the path taken to a destination by sending Internet Control Message Protocol (ICMP) Echo Request or ICMPv6 messages to the destination with incrementally increasing Time to Live (TTL) field values. The path displayed is the list of near-side router interfaces of the routers in the path between a source host and a destination. The near-side interface is the interface of the router that is closest to the sending host in the path. Used without parameters, tracert displays help.
Syntax

tracert [-d] [-h MaximumHops] [-j HostList] [-w Timeout] [-R] [-S SrcAddr] [-4][-6] TargetName

Parameters
-d

Prevents tracert from attempting to resolve the IP addresses of intermediate routers to their names. This can speed up the display of tracert results.

-h MaximumHops

Specifies the maximum number of hops in the path to search for the target (destination). The default is 30 hops.

-j HostList

Specifies that Echo Request messages use the Loose Source Route option in the IP header with the set of intermediate destinations specified in HostList. With loose source routing, successive intermediate destinations can be separated by one or multiple routers. The maximum number of addresses or names in the host list is 9. The HostList is a series of IP addresses (in dotted decimal notation) separated by spaces. Use this parameter only when tracing IPv4 addresses.

-w Timeout

Specifies the amount of time in milliseconds to wait for the ICMP Time Exceeded or Echo Reply message corresponding to a given Echo Request message to be received. If not received within the time-out, an asterisk (*) is displayed. The default time-out is 4000 (4 seconds).

-R

Specifies that the IPv6 Routing extension header be used to send an Echo Request message to the local host, using the destination as an intermediate destination and testing the reverse route.

-S

Specifies the source address to use in the Echo Request messages. Use this parameter only when tracing IPv6 addresses.

-4

Specifies that Tracert.exe can use only IPv4 for this trace.

-6

Specifies that Tracert.exe can use only IPv6 for this trace.

TargetName

Specifies the destination, identified either by IP address or host name.

-?

Displays help at the command prompt.

Remarks
  • This diagnostic tool determines the path taken to a destination by sending ICMP Echo Request messages with varying Time to Live (TTL) values to the destination. Each router along the path is required to decrement the TTL in an IP packet by at least 1 before forwarding it. Effectively, the TTL is a maximum link counter. When the TTL on a packet reaches 0, the router is expected to return an ICMP Time Exceeded message to the source computer. Tracert determines the path by sending the first Echo Request message with a TTL of 1 and incrementing the TTL by 1 on each subsequent transmission until the target responds or the maximum number of hops is reached. The maximum number of hops is 30 by default and can be specified using the -h parameter. The path is determined by examining the ICMP Time Exceeded messages returned by intermediate routers and the Echo Reply message returned by the destination. However, some routers do not return Time Exceeded messages for packets with expired TTL values and are invisible to the tracert command. In this case, a row of asterisks (*) is displayed for that hop.

  • To trace a path and provide network latency and packet loss for each router and link in the path, use the pathping command.

  • This command is available only if the Internet Protocol (TCP/IP) protocol is installed as a component in the properties of a network adapter in Network Connections.

Examples

To trace the path to the host named corp7.microsoft.com, type:

tracert corp7.microsoft.com

To trace the path to the host named corp7.microsoft.com and prevent the resolution of each IP address to its name, type:

tracert -d corp7.microsoft.com

To trace the path to the host named corp7.microsoft.com and use the loose source route 10.12.0.1-10.29.3.1-10.1.44.1, type:

tracert -j 10.12.0.1 10.29.3.1 10.1.44.1 corp7.microsoft.com

Formatting legend

Format | Meaning
Italic | Information that the user must supply
Bold | Elements that the user must type exactly as shown
Ellipsis (...) | Parameter that can be repeated several times in a command line
Between brackets ([]) | Optional items
Between braces ({}); choices separated by pipe (|). Example: {even|odd} | Set of choices from which the user must choose only one
Courier font | Code or program output

See Also

Command-line reference A-ZCommand shell overviewPathping


Tree

Applies To: Windows Server 2003 R2,Windows 7,Windows Server 2003,Windows Vista,Windows Server 2000,Windows Server 2008 R2,Windows Server 2008,Windows XP

Displays the directory structure of a path or of the disk in a drive graphically.

For examples of how to use this command, see Examples.

Syntax

Copy Code
tree [<Drive>:][<Path>] [/f] [/a]

Parameters

Parameter | Description
<Drive>: | Specifies the drive that contains the disk for which you want to display the directory structure.
<Path> | Specifies the directory for which you want to display the directory structure.
/f | Displays the names of the files in each directory.
/a | Specifies that tree is to use text characters instead of graphic characters to show the lines that link subdirectories.
/? | Displays help at the command prompt.

Remarks

The structure displayed by tree depends upon the parameters that you specify at the command prompt. If you do not specify a drive or path, tree displays the tree structure beginning with the current directory of the current drive.

Examples

To display the names of all the subdirectories on the disk in your current drive, type:

Copy Code
tree \

To display, one screen at a time, the files in all the directories on drive C, type:

Copy Code
tree c:\ /f | more

To print a list of all the directories on drive C, type:

Copy Code
tree c:\ /f  prn

Additional references

Command-Line Syntax Key


Tscon

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Vista

Connects to another session on a terminal server.

For examples of how to use this command, see Examples.

Syntax

Copy Code
tscon {<SessionID> | <SessionName>} [/dest:<SessionName>] [/password:<pw> | /password:*] [/v]

Parameters

Parameter | Description
<SessionID> | Specifies the ID of the session to which you want to connect. If you use the optional /dest:<SessionName> parameter, this is the ID of the session to which you want to connect.
<SessionName> | Specifies the name of the session to which you want to connect.
/dest:<SessionName> | Specifies the name of the current session. This session will disconnect when you connect to the new session.
/password:<pw> | Specifies the password of the user who owns the session to which you want to connect. This password is required when the connecting user does not own the session.
/password:* | Prompts for the password of the user who owns the session to which you want to connect.
/v | Displays information about the actions being performed.
/? | Displays help at the command prompt.

Remarks

  • You must have Full Control access permission or Connect special access permission to connect to another session.

  • The /dest:<SessionName> parameter allows you to connect the session of another user to a different session.

  • If you do not specify a password in the <Password> parameter, and the target session belongs to a user other than the current one, tscon fails.

  • You cannot connect to the console session.

Examples

  • To connect to session 12 on the current terminal server and disconnect the current session, type:

    Copy Code
    tscon 12
  • To connect to session 23 on the current terminal server, by using the password mypass, and disconnect the current session, type:

    Copy Code
    tscon 23 /password:mypass
  • To connect the session named TERM03 to the session named TERM05, and then disconnect session TERM05, if it is connected, type:

    Copy Code
    tscon TERM03 /v /dest:TERM05

Additional references

Command-Line Syntax Key

Terminal Services Command Reference


Tsdiscon

Applies To: Windows Vista,Windows Server 2008 R2,Windows Server 2008

Disconnects a session from a terminal server.

For examples of how to use this command, see Examples.

Syntax

Copy Code
tsdiscon [<SessionID> | <SessionName>] [/server:<ServerName>] [/v]

Parameters

Parameter | Description
<SessionId> | Specifies the ID of the session to disconnect.
<SessionName> | Specifies the name of the session to disconnect.
/server:<ServerName> | Specifies the terminal server that contains the session that you want to disconnect. Otherwise, the current terminal server is used.
/v | Displays information about the actions being performed.
/? | Displays help at the command prompt.

Remarks

  • You must have Full Control permission or Disconnect special access permission to disconnect another user from a session.

  • If no session ID or session name is specified, tsdiscon disconnects the current session.

  • Any applications that were running when you disconnected the session are automatically running when you reconnect to that session with no loss of data. Use reset session to end the running applications of the disconnected session, but be aware that this might result in loss of data at the session.

  • The /server parameter is required only if you use tsdiscon from a remote server.

  • The console session cannot be disconnected.

Examples

  • To disconnect the current session, type:

    Copy Code
    tsdiscon
  • To disconnect session 10, type:

    Copy Code
    tsdiscon 10
  • To disconnect the session named TERM04, type:

    Copy Code
    tsdiscon TERM04

Additional references

Command-Line Syntax Key

Terminal Services Command Reference


Tsecimp

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows XP,Windows Server 2003 with SP1,Windows Vista,Windows Server 2003,Windows Server 2003 with SP2,Windows Server 2003 R2,Windows 7,Windows Server 2008 R2 with SP1

Imports assignment information from an Extensible Markup Language (XML) file into the TAPI server security file (Tsec.ini). You can also use this command to display the list of TAPI providers and the lines devices associated with each of them, validate the structure of the XML file without importing the contents, and check domain membership.

Syntax

Copy Code
tsecimp –f <Filename> [{-v | -u}]
tsecimp -d

Parameters

Parameter | Description
-f <Filename> | Required. Specifies the name of the XML file that contains the assignment information that you want to import.
-v | Validates the structure of the XML file without importing the information into the Tsec.ini file.
-u | Checks whether each user is a member of the domain specified in the XML file. The computer on which you use this parameter must be connected to the network. This parameter might significantly slow performance if you are processing a large amount of user assignment information.
-d | Displays a list of installed telephony providers. For each telephony provider, the associated line devices are listed, as well as the addresses and users associated with each line device.
/? | Displays help at the command prompt.

Remarks

  • The XML file from which you want to import assignment information must follow the structure described below.

    • UserList element

      The UserList is the top element of the XML file.

    • User element

      Each User element contains information about a user who is a member of a domain. Each user might be assigned one or more line devices.

      Additionally, each User element might have an attribute named NoMerge. When this attribute is specified, all current line device assignments for the user are removed before new ones are made. You can use this attribute to easily remove unwanted user assignments. By default, this attribute is not set.

      The User element must contain a single DomainUserName element, which specifies the domain and user name of the user. The User element might also contain one FriendlyName element, which specifies a friendly name for the user.

      The User element might contain one LineList element. If a LineList element is not present, all line devices for this user are removed.

    • LineList element

      The LineList element contains information about each line or device that might be assigned to the user. Each LineList element can contain more than one Line element.

    • Line element

      Each Line element specifies a line device. You must identify each line device by adding either an Address element or a PermanentID element under the Line element.

      For each Line element, you can set the Remove attribute. If you set this attribute, the user is no longer assigned that line device. If this attribute is not set, the user gains access to that line device. No error is given if the line device is not available to the user.

  • The following sample XML code segments illustrate correct usage of the elements defined above.

    • The following code removes all line devices assigned to User1.

      Copy Code
      <UserList>
  <User NoMerge="1">
    <DomainUser>domain1\user1</DomainUser>
  </User>
</UserList>
    • The following code removes all line devices assigned to User1 before assigning one line with address 99999. User1 will have no other lines devices assigned, regardless of whether any line devices were assigned previously.

      Copy Code
      <UserList>
  <User NoMerge="1">
    <DomainUser>domain1\user1</DomainUser>
    <FriendlyName>User1</FriendlyName>
    <LineList>
      <Line>
        <Address>99999</Address>
      </Line>
    </LineList>
  </User>
</UserList>
    • The following code adds one line device for User1 without deleting any previously assigned line devices.

      Copy Code
      <UserList>
  <User>
    <DomainUser>domain1\user1</DomainUser>
    <FriendlyName>User1</FriendlyName>
    <LineList>
      <Line>
        <Address>99999</Address>
      </Line>
    </LineList>
  </User>
</UserList>
    • The following code adds line address 99999 and removes line address 88888 from User1's access.

      Copy Code
      <UserList>
  <User>
    <DomainUser>domain1\user1</DomainUser>
    <FriendlyName>User1</FriendlyName>
    <LineList>
      <Line>
        <Address>99999</Address>
      </Line>
      <Line Remove="1">
        <Address>88888</Address>
      </Line>
    </LineList>
  </User>
</UserList>
    • The following code adds permanent device 1000 and removes line 88888 from User1's access.

      Copy Code
      <UserList>
  <User>
    <DomainUser>domain1\user1</DomainUser>
    <FriendlyName>User1</FriendlyName>
    <LineList>
      <Line>
        <PermanentID>1000</PermanentID>
      </Line>
      <Line Remove="1">
        <Address>88888</Address>
      </Line>
    </LineList>
  </User>
</UserList>
  • The following sample output appears after the -d command-line option is specified to display the current TAPI configuration. For each telephony provider, the associated line devices are listed, as well as the addresses and users associated with each line device.

    Copy Code
    NDIS Proxy TAPI Service Provider
        Line: "WAN Miniport (L2TP)"
                Permanent ID: 12345678910

NDIS Proxy TAPI Service Provider
        Line: "LPT1DOMAIN1\User1"
                Permanent ID: 12345678910

Microsoft H.323 Telephony Service Provider
        Line: "H323 Line"
                Permanent ID: 123456
                Addresses:
                        BLDG1-TAPI32

Additional references

Command-Line Syntax Key

Command shell overview


Tskill

Applies To: Windows Vista,Windows Server 2008 R2,Windows Server 2008

Ends a process running in a session on a terminal server.

For examples of how to use this command, see Examples.

Syntax

Copy Code
tskill {<ProcessID> | <ProcessName>} [/server:<ServerName>] [/id:<SessionID> | /a] [/v]

Parameters

Parameter | Description
<ProcessID> | Specifies the ID of the process that you want to end.
<ProcessName> | Specifies the name of the process that you want to end. This parameter can include wildcard characters.
/server:<ServerName> | Specifies the terminal server that contains the process that you want to end. If /server is not specified, the current terminal server is used.
/id:<SessionID> | Ends the process that is running in the specified session.
/a | Ends the process that is running in all sessions.
/v | Displays information about the actions being performed.
/? | Displays help at the command prompt.

Remarks

  • You can use tskill to end only those processes that belong to you, unless you are an administrator. Administrators have full access to all tskill functions and can end processes that are running in other user sessions.

  • When all processes that are running in a session end, the session also ends.

  • If you use the ProcessName and the /server:ServerName parameters, you must also specify either the /id:SessionID or the /a parameter.

Examples

  • To end process 6543, type:

    Copy Code
    tskill 6543
  • To end the process "explorer" running on session 5, type:

    Copy Code
    tskill explorer /id:5

Additional references

Command-Line Syntax Key

Terminal Services Command Reference


Tsprof

Applies To: Windows Server 2008,Windows Server 2008 R2

Copies the Terminal Services user configuration information from one user to another.

The Terminal Services user configuration information is displayed in the Terminal Services extensions to Local Users and Groups and Active Directory Users and Computers.

Tsprof can also set the profile path for a user.

For examples of how to use this command, see Examples.

Syntax

Copy Code
tsprof /update {/domain:<DomainName> | /local} /profile:<Path> <UserName>
tsprof /copy {/domain:<DomainName> | /local} [/profile:<Path>] <Src_usr> <Dest_usr>
tsprof /q {/domain:<DomainName> | /local} <UserName>

Parameters

Parameter | Description
/update | Updates profile path information for <UserName> in domain <DomainName> to <ProfilePath>.
/domain:<DomainName> | Specifies the name of the domain in which the operation is applied.
/local | Applies the operation only to local user accounts.
/profile:<Path> | Specifies the profile path as displayed in the Terminal Services extensions in Local Users and Groups and Active Directory Users and Computers.
<UserName> | Specifies the name of the user for whom you want to update or query the server profile path.
/copy | Copies user configuration information from <SourceUser> to <DestinationUser> and updates the profile path information for <DestinationUser> to <ProfilePath>. Both <SourceUser> and <DestinationUser> must either be local or must be in domain <DomainName>.
<Src_usr> | Specifies the name of the user from whom you want to copy the user configuration information.
<Dest_usr> | Specifies the name of the user to whom you want to copy the user configuration information.
/q | Displays the current profile path of the user for whom you want to query the server profile path.
/? | Displays help at the command prompt.

Remarks

  • The tsprof command is only available when you have installed the Terminal Server role service on a computer running Microsoft Windows Server® 2008.

Examples

  • To copy user configuration information from LocalUser1 to LocalUser2, type:

    Copy Code
    tsprof /copy /local LocalUser1 LocalUser2
  • To set the Terminal Services profile path for LocalUser1 to a directory called "c:\profiles," type:

    Copy Code
    tsprof /update /local /profile:c:\profiles LocalUser1

Additional references

Command-Line Syntax Key

Terminal Services Command Reference


Type

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Server 2003 with SP1,Windows XP,Windows Server 2003,Windows Vista,Windows Server 2000,Windows Server 2003 with SP2,Windows Server 2003 R2,Windows 7

Displays the contents of a text file. Use the type command to view a text file without modifying it.

For examples of how to use this command, see Examples.

Syntax

Copy Code
type [<Drive>:][<Path>]<FileName>

Parameters

Parameter | Description
[<Drive>:][<Path>]<FileName> | Specifies the location and name of the file or files that you want to view. Separate multiple file names with spaces.
/? | Displays help at the command prompt.

Remarks

  • If FileName contains spaces, enclose it in quotation marks (for example, "File Name Containing Spaces.txt").

  • If you display a binary file or a file that is created by a program, you may see strange characters on the screen, including formfeed characters and escape-sequence symbols. These characters represent control codes that are used in the binary file. In general, avoid using the type command to display binary files.

Examples

To display the contents of a file named Holiday.mar, type:

Copy Code
type holiday.mar

To display the contents of a lengthy file named Holiday.mar one screen at a time, type:

Copy Code
type holiday.mar | more

Additional references

Command-Line Syntax Key


Typeperf

Applies To: Windows 7,Windows Server 2003 R2,Windows Server 2000,Windows Server 2003 with SP2,Windows Vista,Windows Server 2003,Windows XP,Windows Server 2003 with SP1,Windows Server 2008,Windows Server 2008 R2

The typeperf command writes performance data to the command window or to a log file. To stop typeperf, press CTRL+C.

For examples of how to use typeperf, see Examples.

Syntax

Copy Code
typeperf <counter [counter ...]> [options]
typeperf -cf <filename> [options]
typeperf -q [object] [options]
typeperf -qx [object] [options]

Parameters

Parameter | Description
<counter [counter […]]> | Specifies performance counters to monitor.
Note
<counter> is the full name of a performance counter in \\Computer\Object(Instance)\Counter format, such as \\Server1\Processor(0)\% User Time.

Options

Option | Description
-? | Displays context-sensitive help.
-f <CSV|TSV|BIN|SQL> | Specifies the output file format. The default is CSV.
-cf <filename> | Specifies a file containing a list of performance counters to monitor, with one counter per line.
-si <[[hh:]mm:]ss> | Specifies the sample interval. The default is one second.
-o <filename> | Specifies the path for the output file, or the SQL database. The default is STDOUT (written to the command window).
-q [object] | Display a list of installed counters (no instances). To list counters for one object, include the object name. ***EXAMPLE
-qx [object] | Display a list of installed counters with instances. To list counters for one object, include the object name.
-sc <samples> | Specifies the number of samples to collect. The default is to collect data until CTRL+C is pressed.
-config <filename> | Specifies a settings file containing command options.
-s <computer_name> | Specifies a remote computer to monitor if no computer is specified in the counter path.
-y | Answer yes to all questions without prompting.

Examples

  • The following example writes the values for the local computer's performance counter \\Processor(_Total)\% Processor Time to the command window at a default sample interval of 1 second until CTRL+C is pressed.

    Copy Code
    typeperf "\Processor)_Total)\% Processor Time"
  • The following example writes the values for the list of counters in the file counters.txt to the tab-delimited file domain2.tsv at a sample interval of 5 seconds until 50 samples have been collected.

    Copy Code
    typeperf -cf counters.txt -si 5 -sc 50 -f TSV -o domain2.tsv
  • The following example queries installed counters with instances for the counter object PhysicalDisk and writes the resulting list to the file counters.txt.

    Copy Code
    typeperf -qx PhysicalDisk -o counters.txt


Uddiconfig

Applies To: Windows Server 2008

Saves Universal Description, Discovery, and Integration (UDDI) configuration settings to an XML file.

The UDDI configuration tool, Uddiconfig.exe, is a command-line tool that saves configuration settings from UDDI Services components to an XML file or takes configuration settings from an XML file and applies them to UDDI Services components. You can use the UDDI configuration tool to back up your configuration settings after you install or make changes to UDDI Services. If necessary, you can restore the last known good configuration settings that you saved in the XML file by using the UDDI configuration tool.

You can use this tool to adjust any of the configuration settings that the UDDI Services Microsoft Management Console (MMC) snap-in exposes. When you apply configuration settings, all the settings that are stored in the configuration file are applied to the corresponding UDDI Services components on the target computer. When you save the settings, all the configuration settings from all the UDDI Services components on the target computer are written to the output file.

UDDI is an industry specification for publishing and locating information about Web services. It defines an information framework that you can use to describe and classify your organization, its services, and the technical details about the interfaces of the Web services that you expose. This information framework provides consistent discovery of services or interfaces of a particular type, classification, or function. UDDI also defines a set of application programming interfaces (APIs) that applications and services can use to interact directly with UDDI data. For example, you can develop services that automatically publish and update their UDDI data, react dynamically to service availability, or automatically discover interface details for other services with which they interact.

To use Uddiconfig.exe, you must run the uddiconfig command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

Membership in Administrators, or equivalent, on the target computer is the minimum required to complete this procedure. Review details about using the appropriate accounts and group memberships at Local and Domain Default Groups (http://go.microsoft.com/fwlink/?LinkId=83477).

For examples of how to use this command, see Examples.

Syntax

Copy Code
uddiconfig.exe /o[<drive>:][<path>]<FileName> | /f[<drive>:][<path>]<FileName>[/s <ComputerName>][/u <UserName> /p <Password>]

Parameters

Parameter | Description
/o [<drive>:][<path>] <FileName> | Saves settings from the UDDI Services components on the target computer to a file that is specified by FileName.
/f [<drive>:][<path>] <FileName> | Applies configuration settings from a file that is specified by FileName to the UDDI Services components on a target computer.
/s <ComputerName> | The NETBIOS name of the remote computer that hosts the UDDI Services components.
/u <UserName> | Specifies the user name to use on the remote computer that is specified by ComputerName. UserName should be in the form USER@DOMAIN or DOMAIN\USER.
/p <Password> | Specifies the password for UserName.
? | /h | /help | Displays Help for this command.

Remarks

Uddiconfig.exe recognizes the Web server configuration settings in the following table.

Web server configuration settings | Description
logging\event log | Specifies the level of information that is published to the event log by the UDDI Services Web server component. Type: log enumeration Value: None, Error, Warning, FailAudit, PassAudit, Info, Verbose
logging\logFile | Specifies the level of information that is published to the log file by the UDDI Services Web server component. Type: log enumeration Value: None, Error, Warning, FailAudit, PassAudit, Info, Verbose
dataBaseConnection\readComputer | The name of the computer that hosts the UDDI Services Database components that the UDDI Services Web server uses for read operations. Type: string Value: 255 characters maximum
dataBaseConnection\writeComputer | The name of the computer that hosts the UDDI Services Database components that the UDDI Services Web server uses for write operations. Type: string Value: 255 characters maximum

Uddiconfig.exe recognizes the site configuration settings in the following table.

Site configuration settings | Description
roles\administratorsGroup | The name of the group that defines the users that have Administrator credentials on the site. Type: string Value: <GroupName>, BUILTIN\<GroupName>, or <domain>\<GroupName>
roles\coordinatorsGroup | The name of the group that defines the users that have Coordinator credentials on the site. Type: string Value: <GroupName>, BUILTIN\<GroupName>, or <domain>\<GroupName>
roles\publishersGroup | The name of the group that defines the users that have Publisher credentials on the site. Type: string Value: <GroupName>, BUILTIN\<GroupName>, or <domain>\<GroupName>
roles\usersGroup | The name of the group that defines the users that have User privileges on the site. Type: string Value: <GroupName>, BUILTIN\<GroupName>, or <domain>\<GroupName>
security\accessControl | The type of authentication that is required to access the site. Type: authenticationEnumeration Value: WindowsIntegratedUddiServices, UddiServices, WindowsIntegrated, WindowsIntegratedAuthenticatedReads
security\requireSSL | Determines whether Secure Sockets Layer (SSL) encryption is required to interact with the site. Type: Boolean Value: true or false
security\cryptography\tokenExpirationMinutes | Specifies the amount of time, in minutes, in which the Simple Object Access Protocol (SOAP) authentication token expires for UDDI Publisher–authenticated publications. Type: integer Value: 1–1000
security\cryptography\automaticKeyReset | Determines whether the cryptography key that is used to generate SOAP authentication tokens is regenerated automatically after a set interval. Type: Boolean Value: true or false
security\cryptography\automaticKeyResetDays | Specifies the amount of time, in days, that the cryptography key that is used to generate SOAP authentication tokens is reset. Type: integer Value: 1–1000
advanced\Operator | The value that is used to populate the Operator attribute in SOAP API responses that include an Operator attribute. Type: string Value: <UDDISiteName>
advanced\Find.MaxRowsDefault | The maximum number of rows that are returned on SOAP API find requests. Type: integer Value: 1–1000
advanced\DefaultDiscoveryURL | The prefix for the default discovery URL that is attached to providers that are published in this site. Type: string Value: http://<ServerName>

Examples

To save configuration settings from UDDI Services components that are operating on the local computer using the current user's credentials and to save them to the file C:\Config.xml, at the command line, type the following command, and then press ENTER:

Copy Code
uddiconfig /o C:\config.xml

To capture configuration settings from UDDI Services components that are operating on a remote computer named UDDISVCS using Administrator credentials and to save them to a file C:\config.xml, at the command line, type the following command, and then press ENTER:

Copy Code
uddiconfig /s UDDISVCS /u Administrator /p lsA93j%g /o c:\config.xml

To apply configuration settings from file C:\Config.xml to UDDI Services components that are operating on the local computer using the current user's credentials, at the command line, type the following command, and then press ENTER:

Copy Code
uddiconfig /f c:\config.xml

Additional references

  • Command-Line Syntax Key


Umount
See Also

Applies To: Windows Server 2008,Windows Vista

You can use umount to remove Network File System (NFS)–mounted drives.

Syntax

umount [-f] [{-a | DriveLetter:[...] | NetworkMount[...]}]

Description

The umount command-line utility disconnects the specified NFS-mounted drive. You must supply at least one of the following options or arguments.

-f

Forces deletion of Network File System (NFS) network drives.

-a

Deletes all NFS network drives. If there are active connections, umount prompts you for confirmation unless you also use the -f option.

DriveLetter

The letter of the logical drive to be disconnected.

NetworkMount

The network mount point to be disconnected. This mount must have been created using the net use Windows command-line utility without specifying a drive letter.

See Also

Concepts

Mount


Ver

Applies To: Windows 7,Windows Server 2003 R2,Windows Vista,Windows Server 2003,Windows Server 2003 with SP2,Windows Server 2000,Windows Server 2008 R2,Windows Server 2008,Windows Server 2003 with SP1,Windows XP

Displays the operating system version number.

For examples of how to use this command, see Examples.

Syntax

Copy Code
ver

Parameters

Parameter | Description
/? | Displays help at the command prompt.

Examples

To obtain the version number of the operating system, type:

ver

Additional references

Command-Line Syntax Key


Verify

Applies To: Windows XP,Windows Server 2008,Windows Server 2008 R2,Windows Vista,Windows Server 2003,Windows Server 2003 R2,Windows 7

Tells cmd whether to verify that your files are written correctly to a disk. If used without parameters, verify displays the current setting.

For examples of how to use this command, see Examples.

Syntax

Copy Code
verify [on | off]

Parameters

Parameter | Description
[on | off] | Switches the verify setting on or off.
/? | Displays help at the command prompt.

Examples

To display the current verify setting, type:

Copy Code
verify

To turn the verify setting on, type:

Copy Code
Verify on

Additional references

Command-Line Syntax Key


Vol

Applies To: Windows 7,Windows Server 2003 R2,Windows Server 2003,Windows Vista,Windows Server 2000,Windows Server 2008 R2,Windows Server 2008,Windows XP

Displays the disk volume label and serial number, if they exist. If used without parameters, vol displays information for the current drive.

Syntax

Copy Code
vol [<Drive>:]

Parameters

Parameter | Description
<Drive>: | Specifies the drive that contains the disk for which you want to display the volume label and serial number.
/? | Displays help at the command prompt.

Additional references

Command-Line Syntax Key


Vssadmin

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Server 2003,Windows Server 2003 R2

Displays current volume shadow copy backups and all installed shadow copy writers and providers. To view the command syntax for any of the commands in the following table, click the command name.

Command | Description
Vssadmin add shadowstorage | Adds a volume shadow copy storage association.
Vssadmin create shadow | Creates a new volume shadow copy.
Vssadmin delete shadows | Deletes volume shadow copies.
Vssadmin delete shadowstorage | Deletes volume shadow copy storage associations.
Vssadmin list providers | Lists registered volume shadow copy providers.
Vssadmin list shadows | Lists existing volume shadow copies.
Vssadmin list shadowstorage | Lists all shadow copy storage associations on the system.
Vssadmin list volumes | Lists volumes that are eligible for shadow copies.
Vssadmin list writers | Lists all subscribed volume shadow copy writers on the system.
Vssadmin resize shadowstorage | Resizes the maximum size for a shadow copy storage association.


Vssadmin add shadowstorage

Applies To: Windows Server 2003 R2,Windows Server 2003,Windows Server 2008 R2,Windows Server 2008

Adds a shadow copy storage association for a specified volume.

For examples of how to use this command, see Examples.

Syntax

Copy Code
vssadmin add shadowstorage /for=<ForVolumeSpec> /on=<OnVolumeSpec> [/maxsize=<MaxSizeSpec>]

Parameters

Parameter | Description
/for=<ForVolumeSpec> | Specifies the volume for which the shadow copy storage association is to be added.
/on=<OnVolumeSpec> | Specifies the volume to be used as storage for the volume that is defined in the /for parameter.
/maxsize=<MaxSizeSpec> | Specifies the maximum amount of storage space that can be used on the volume specified in the /on parameter. If MaxSizeSpec is not specified, there is no limit placed on the amount of space that can be used. If the maximum number of shadow copy storage associations have already been made, an error is returned. Note that MaxSizeSpec must be 300 MB or greater and it must be expressed in one of the following units: bytes, KB, MB, GB, TB, PB, or EB. These units can be abbreviated as B, K, M, G, T, P, and E, respectively. If no unit is specified, MaxSizeSpec uses bytes (B) by default.

Examples

To specify that for volume C, volume D is to be used for storage and the maximum size for storage space is to be 900 MB, type:

Copy Code
vssadmin add shadowstorage /for=c: /on=d: /maxsize=900mb

Additional references

Command-Line Syntax Key

Vssadmin


Vssadmin create shadow

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Server 2003,Windows Server 2003 R2

Creates a new shadow copy of a specified volume.

For examples of how to use this command, see Examples.

Syntax

Copy Code
vssadmin create shadow /for=<ForVolumeSpec> [/autoretry=<MaxRetryMinutes>]

Parameters

Parameter | Description
/for=<ForVolumeSpec> | Specifies the volume to be shadow copied. Note that the ForVolumeSpec value must be a local volume drive letter or mount point.
/autoretry=<MaxRetryMinutes> | Specifies the maximum amount of time (in minutes) during which the vssadmin command will attempt to create the shadow copy, if another process is simultaneously attempting to create a shadow copy.

Examples

To create a shadow copy of volume C, type:

Copy Code
vssadmin create shadow /for=c:

Additional references

Command-Line Syntax Key

Vssadmin


Vssadmin delete shadows

Applies To: Windows Server 2003 R2,Windows Server 2003,Windows Server 2008 R2,Windows Server 2008

Deletes shadow copies of a specified volume.

For examples of how to use this command, see Examples.

Syntax

Copy Code
vssadmin delete shadows /for=<ForVolumeSpec> [/oldest | /all | /shadow=<ShadowID>] [/quiet]

Parameters

Parameter Description

/for=<ForVolumeSpec>

Specifies the volume for which the shadow copy is to be deleted.

/oldest

Deletes only the oldest shadow copy.

/all

Deletes all of the shadow copies for the specified volume.

/shadow=<ShadowID>

Deletes the shadow copy specified by ShadowID. To get the shadow copy ID, use the vssadmin list shadows command. When you type a shadow copy ID, use the following format, where each X represents a hexadecimal character:

Copy Code
XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX

/quiet

Specifies that the command will not display messages while it is running.

Remarks

  • You can delete only shadow copies that have the client-accessible type.

Examples:

To delete the oldest shadow copy of volume C, type:

Copy Code
vssadmin delete shadows /for=c: /oldest

Additional references

Command-Line Syntax Key

Vssadmin

Vssadmin list shadows


Vssadmin delete shadowstorage

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Server 2003,Windows Server 2003 R2

Deletes volume shadow copy storage associations.

Syntax

Copy Code
vssadmin delete shadowstorage /for=<ForVolumeSpec> [/on=<OnVolumeSpec>] [/quiet]

Parameters

Parameter | Description
/for=<ForVolumeSpec> | Specifies the volume to be shadow copied. ForVolumeSpec must be a local volume drive letter or mount point.
/on=<OnVolumeSpec> | Specifies the storage volume. If you do not use /on, all shadow copy storage associations will be deleted for the specified ForVolumeSpec.
/quiet | Specifies to run the command without displaying messages.

Additional references

Command-Line Syntax Key

Vssadmin


Vssadmin list providers

Applies To: Windows Server 2003 R2,Windows Server 2003,Windows Server 2008 R2,Windows Server 2008

Lists registered volume shadow copy providers.

For examples of how to use this command, see Examples.

Syntax

Copy Code
vssadmin list providers

Parameters

There are no parameters for this command.

Remarks

  • The vssadmin list providers command displays the provider name, the provider type, the provider ID, and the version of each installed shadow copy provider.

Examples

To list the currently registered shadow copy providers, type:

Copy Code
vssadmin list providers

Output similar to the following is displayed:

Copy Code
Provider name: 'Microsoft Software Shadow Copy provider 1.0'
   Provider type: System
   Provider Id: {b5946137-7b9f-4925-af80-51abd60b20d5}
   Version: 1.0.0.7

Additional references

Command-Line Syntax Key

Vssadmin


Vssadmin list shadows

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Server 2003,Windows Server 2003 R2

Lists all existing shadow copies of a specified volume. If you use this command without parameters, it displays all volume shadow copies on the computer, in the order dictated by Shadow Copy Set.

Syntax

Copy Code
vssadmin list shadows [/for=<ForVolumeSpec>] [/shadow=<ShadowID>]

Parameters

Parameter Description

/for=<ForVolumeSpec>

Specifies the volume for which the shadow copies are to be listed.

/shadow=<ShadowID>

Lists the shadow copy specified by ShadowID. To get the shadow copy ID, use the vssadmin list shadows command. When you type a shadow copy ID, use the following format, where each X represents a hexadecimal character:

Copy Code
XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX

Additional references

Command-Line Syntax Key

Vssadmin


Vssadmin list shadowstorage

Applies To: Windows Server 2003 R2,Windows Server 2003,Windows Server 2008 R2,Windows Server 2008

Lists all shadow copy storage associations on the computer.

Syntax

Copy Code
vssadmin list shadowstorage {/for=<ForVolumeSpec> | /on=<onVolumeSpec>}

Parameters

Parameter | Description
/for=<ForVolumeSpec> | Specifies the volume for which shadow copy storage associations are to be listed.
/on=<onVolumeSpec> | Specifies the storage volume for which shadow copy storage associations are to be listed.

Remarks <optional section>

  • To list all of the associations for a specified volume, use the /for parameter but do not use the /on parameter.

  • To list all of the associations on a specified storage volume, use the /on parameter but do not use the /for parameter.

Additional references

Command-Line Syntax Key

Vssadmin


Vssadmin list volumes

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Server 2003,Windows Server 2003 R2

Lists volumes that are eligible for shadow copies.

Syntax

Copy Code
vssadmin list volumes

Parameters

No parameters.

Additional references

Command-Line Syntax Key

Vssadmin


Vssadmin list writers

Applies To: Windows Server 2003 R2,Windows Server 2003,Windows Server 2008 R2,Windows Server 2008

Lists subscribed volume shadow copy writers.

Syntax

Copy Code
vssadmin list writers

Parameters

No parameters.

Additional references

Command-Line Syntax Key

Vssadmin


Vssadmin resize shadowstorage

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Server 2003,Windows Server 2003 R2

Resizes the maximum amount of storage space that can be used for shadow copy storage.

The minimum amount of storage space that can be used for shadow copy storage can be specified by using the MinDiffAreaFileSize registry value. For more information, see MinDiffAreaFileSize (http://go.microsoft.com/fwlink/?LinkId=190313).

Caution
Resizing the storage association may cause shadow copies to disappear.

Syntax

Copy Code
vssadmin resize shadowstorage /for=<ForVolumeSpec> /on=<OnVolumeSpec> [/maxsize=<MaxSizeSpec>]

Parameters

Parameter Description

/for=<ForVolumeSpec>

Specifies the volume for which the maximum amount of storage space is to be resized.

/on=<OnVolumeSpec>

Specifies the storage volume.

[/maxsize=<MaxSizeSpec>]
  • Specifies the maximum amount of space that can be used for storing shadow copies. If no value is specified for /maxsize, there is no limit placed on the amount of storage space that can be used.

  • The MaxSizeSpec value must be 1 MB or greater and must be expressed in one of the following units: KB, MB, GB, TB, PB, or EB. If no unit is specified, MaxSizeSpec uses bytes by default.

Additional references

Command-Line Syntax Key

Vssadmin


W32tm

Applies To: Windows SBS 2003,Windows Server 2003 R2,Windows 7,Windows SBS 2008,Windows Server 2008 R2 with SP1,Windows Server 2008 R2 Foundation,Windows Vista,Windows Server 2003,Microsoft Server Products,Windows Server 2003 with SP2,Windows Server 2008 Foundation,Windows Essential Business Server,Windows Server 2008 R2,Windows Server 2008,Windows HPC Server 2008 R2,Windows HPC Server 2008,Windows XP,Windows Home Server,Windows Server 2003 with SP1,Windows Server 7,Windows Home Server 2011

You can use the W32tm.exe tool to configure Windows Time service (W32time) settings. You can also use W32tm.exe to diagnose problems with the time service. W32tm.exe is the preferred command-line tool for configuring, monitoring, or troubleshooting the Windows Time service. For examples of how you can use this command, see Examples.

Syntax

Copy Code
W32tm </parameter> </param2>

Parameters

Parameter Description

W32tm /?

W32tm command-line Help

W32tm /register

Registers the time service to run as a service, and adds default configuration to the registry.

W32tm /unregister

Unregisters the time service, and removes all configuration information from the registry.

w32tm /monitor

[/domain:<domain name>] [/computers:<name>[,<name>[,<name>...]]] [/threads:<num>]

Domain—Specifies which domain to monitor. If no domain name is specified, or neither the domain nor computers option is specified, the default domain is used. This option might be used more than once.

computers—Monitors the given list of computers. Computer names are separated by commas, with no spaces. If a name has a prefix of a ‘*’, it is treated as a primary domain controller (PDC). You can use this option more than once.

threads—Specifies the number of computers to analyze simultaneously. The default value is 3. The allowed range is 1 through 50.

w32tm /ntte <NT time epoch>

Converts a Windows NT system time, in (10^-7)s intervals from 0h 1-Jan 1601, into a readable format.

w32tm /ntpte <NTP time epoch>

Converts a Network Time Protocol (NTP) time, in (2^-32)s intervals from 0h 1-Jan 1900, into a readable format.

w32tm /resync

[/computer:<computer>]

[/nowait]

[/rediscover]

[/soft]

Tells a computer that it should resynchronize its clock as soon as possible, throwing out all accumulated error statistics.

computer:<computer>—Specifies the computer that should resynchronize. If a computer is not specified, the local computer will resynchronize.

nowait—Do not wait for the resynchronization to occur; return immediately. Otherwise, wait for the resynchronization to complete before returning.

rediscover—Redetect the network configuration and rediscover network sources; then, resynchronize.

soft—This option is only provided for compatibility with older time servers and will resynchronize using existing error statistics..

w32tm /stripchart

/computer:<target>

[/period:<refresh>]

[/dataonly]

[/samples:<count>]

[/packetinfo]

[ipprotocol:<4|6>

Displays a strip chart of the offset between this computer and another computer.

computer:<target>—The computer to measure the offset against.

period:<refresh>—The time between samples, in seconds. The default value is 2 seconds.

Dataonly—Display only the data, without graphics.

samples:<count>—Collect <count> samples; then, stop. If a value is not specified, samples will be collected until the user types Ctrl+C is pressed.

packetinfo—Print out NTP packet response message.

Ipprotocol—Specify the IP protocol to use. The default is to use whatever is available.

w32tm /config

[/computer:<target>]

[/update]

[/manualpeerlist:<peers>]

[/syncfromflags:<source>]

[/LocalClockDispersion:<seconds>]

[/reliable:(YES|NO)]

[/largephaseoffset:<milliseconds>]

computer:<target>—Adjusts the configuration of <target>. If a value is not specified, the default is the local computer.

update—Notifies the time service that the configuration has changed, causing the changes to take effect.

manualpeerlist:<peers>—Sets the manual peer list to <peers>, which is a space-delimited list of Domain Name System (DNS) and/or IP addresses. When you are specifying multiple peers, this option must be enclosed in quotation marks (“).

syncfromflags:<source>—Sets what sources the NTP client should synchronize from. <source> should be a comma-separated list of these keywords (not case sensitive):

  • MANUAL— Include peers from the manual peer list.

  • DOMHIER— Synchronize from a domain controller in the domain hierarchy.

  • NO—Do not synchronize from any server.

  • ALL—Synchronize from both manual and domain peers.

LocalClockDispersion:<seconds>—Configures the accuracy of the internal clock that W32time will assume when it cannot acquire time from its configured sources.

reliable:(YES|NO)—Set whether this computer is a reliable time source.

This setting is meaningful only on domain controllers.

  • YES—This computer is a reliable time service.

  • NO—This computer is not a reliable time service.

largephaseoffset:<milliseconds>—Sets the time difference between local time and network time that W32time will consider to be a spike.

w32tm /tz

Displays the current time zone settings.

w32tm /dumpreg

[/subkey:<key>]

[/computer:<target>]

Displays the values that are associated with a given registry key.

The default key is HKLM\System\CurrentControlSet\Services\W32Time

(the root key for the time service).

subkey:<key>—Displays the values that are associated with subkey <key> of the default key.

computer:<target>—Queries registry settings for computer <target>.

w32tm /query [/computer:<target>] {/source | /configuration | /peers | /status} [/verbose]

This parameter was first made available in the Windows Time client versions of Windows Vista, and Windows Server 2008.

Displays a computer's Windows Time service information.

computer:<target>—Query the information of <target>. If a value is not specified, the default value is the local computer.

source—Display the time source.

configuration—Display the configuration of run time and where the setting comes from. In verbose mode, display the undefined or unused setting also.

peers—Display a list of peers and their status.

status—Display Windows Time service status.

verbose—Set the verbose mode to display more information.

w32tm /debug {/disable | {/enable /file:<name> /size:<bytes> /entries:<value> [/truncate]}}

This parameter was first made available in the Windows Time client versions of Windows Vista and Windows Server 2008.

Enables or disables local computer Windows Time service private log.

disable—Disable the private log.

enable—Enable the private log.

  • file:<name>—Specify the absolute file name.

  • size:<bytes>—Specify the maximum size for circular logging.

  • entries:<value>—Contains a list of flags, specified by number and separated by commas, that specify the types of information that should be logged. Valid numbers are 0 to 300. A range of numbers is valid, in addition to single numbers, such as 0 through 100,103,106. Value 0-300 is for logging all information.

truncate—Truncate the file if it exists.

Remarks

The Windows Time service is not a full-featured NTP solution that meets time-sensitive application needs, and it is not supported by Microsoft as such. For more information, see article 939322 in the Microsoft Knowledge Base (http://go.microsoft.com/fwlink/?LinkID=179459).

If you have questions about the Windows Time service, please post them to the Directory Services forum (http://go.microsoft.com/fwlink/?LinkId=195451).

Examples

If you want to set the local Windows Time client to point to two different time servers, one named ntpserver.contoso.com and another named clock.adatum.com, type the following command at the command line, and then press ENTER:

Copy Code
w32tm /config /manualpeerlist:ntpserver.contoso.com,clock.adatum.com /syncfromflags:manual /update

For a list of valid NTP servers that are available on the Internet for external time synchronization, see article 262680 in the Microsoft Knowledge Base (http://go.microsoft.com/fwlink/?LinkID=60401).

If you want to check the Windows Time client configuration from a client computer running Windows 7 that has a host name of CONTOSOW1, run the following command:

Copy Code
W32tm /query /computer:contosoW1 /configuration

The output of this command is a list of configuration parameters that are set for the Windows Time client.

Additional references

  • Command-Line Syntax Key

  • Windows Time Service Technical Reference


Waitfor

Applies To: Windows Server 2003 with SP1,Windows XP,Windows Server 2008,Windows Server 2008 R2,Windows Server 2000,Windows Server 2003 with SP2,Windows Server 2003,Windows Vista,Windows 7,Windows Server 2003 R2

Sends or waits for a signal on a system. Waitfor is used to synchronize computers across a network.

For examples of how to use this command, see Examples.

Syntax

Copy Code
waitfor [/s <Computer> [/u [<Domain>\]<User> [/p [<Password>]]]] /si <SignalName>
waitfor [/t <Timeout>] <SignalName>

Parameters

Parameter | Description
/s <Computer> | Specifies the name or IP address of a remote computer (do not use backslashes). The default is the local computer. This parameter applies to all files and folders specified in the command.
/u [<Domain>\]<User> | Runs the script using the credentials of the specified user account. By default, waitfor uses the current user's credentials.
/p [<Password>] | Specifies the password of the user account that is specified in the /u parameter.
/si | Sends the specified signal across the network.
/t <Timeout> | Specifies the number of seconds to wait for a signal. By default, waitfor waits indefinitely.
<SignalName> | Specifies the signal that waitfor waits for or sends. SignalName is not case-sensitive.
/? | Displays help at the command prompt.

Remarks

  • Signal names cannot exceed 225 characters. Valid characters include a-z, A-Z, 0-9, and the ASCII extended character set (128-255).

  • If you do not use /s, the signal is broadcast to all the systems in a domain. If you use /s, the signal is sent only to the specified system.

  • You can run multiple instances of waitfor on a single computer, but each instance of waitfor must wait for a different signal. Only one instance of waitfor can wait for a given signal on a given computer.

  • You can activate a signal manually by using the /si command-line option.

  • Waitfor runs only on Windows XP and servers running a Windows Server 2003 operating system, but it can send signals to any computer running a Windows operating system.

  • Computers can only receive signals if they are in the same domain as the computer sending the signal.

  • You can use waitfor when you test software builds. For example, the compiling computer can send a signal to several computers running waitfor after the compile has completed successfully. On receipt of the signal, the batch file that includes waitfor can instruct the computers to immediately start installing software or running tests on the compiled build.

Examples

To wait until the "espresso\build007" signal is received, type:

Copy Code
waitfor espresso\build007

By default, waitfor waits indefinitely for a signal.

To wait 10 seconds for the "espresso\compile007" signal to be received before timing out, type:

Copy Code
waitfor /t 10 espresso\build007

To manually activate the "espresso\build007" signal, type:

Copy Code
waitfor /si espresso\build007

Additional references

Command-Line Syntax Key


Wbadmin

Applies To: Windows Vista,Windows Server 2008 R2,Windows Server 2008

Enables you to back up and restore your operating system, volumes, files, folders, and applications from a command prompt.

To configure a regularly scheduled backup, you must be a member of the Administrators group. To perform all other tasks with this command, you must be a member of the Backup Operators or the Administrators group, or you must have been delegated the appropriate permissions.

You must run wbadmin from an elevated command prompt. (To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.)

Copy Code

Subcommands

Subcommand | Description
Wbadmin enable backup | Configures and enables a regularly scheduled backup. This subcommand applies only to versions of Windows Server 2008 and Windows Server 2008 R2.
Wbadmin disable backup | Disables your daily backups. This subcommand applies only to Windows Server 2008 and Windows Server 2008 R2.
Wbadmin start backup | Runs a one-time backup. If used with no parameters, uses the settings from the daily backup schedule.
Wbadmin stop job | Stops the currently running backup or recovery operation.
Wbadmin get versions | Lists details of backups recoverable from the local computer or, if another location is specified, from another computer.
Wbadmin get items | Lists the items included in a backup.
Wbadmin start recovery | Runs a recovery of the volumes, applications, files, or folders specified. This subcommand applies only to Windows Server 2008 and Windows Server 2008 R2.
Wbadmin get status | Shows the status of the currently running backup or recovery operation.
Wbadmin get disks | Lists disks that are currently online. This subcommand applies only to Windows Server 2008 and Windows Server 2008 R2.
Wbadmin start systemstaterecovery | Runs a system state recovery. This subcommand applies only to Windows Server 2008 and Windows Server 2008 R2.
Wbadmin start systemstatebackup | Runs a system state backup. This subcommand applies only to Windows Server 2008 and Windows Server 2008 R2.
Wbadmin delete systemstatebackup | Deletes one or more system state backups. This subcommand applies only to Windows Server 2008 and Windows Server 2008 R2.
Wbadmin start sysrecovery | Runs a recovery of the full system (at least all the volumes that contain the operating system's state). This subcommand applies only to Windows Server 2008 and Windows Server 2008 R2, and it is only available if you are using the Windows Recovery Environment.
Wbadmin restore catalog | Recovers a backup catalog from a specified storage location in the case where the backup catalog on the local computer has been corrupted. This subcommand applies only to Windows Server 2008 and Windows Server 2008 R2.
Wbadmin delete catalog | Deletes the backup catalog on the local computer. Use this subcommand only if the backup catalog on this computer is corrupted and you have no backups stored at another location that you can use to restore the catalog. This subcommand applies only to Windows Server 2008 and Windows Server 2008 R2.

Remarks

The wbadmin command replaces the ntbackup command that was released with previous versions of Windows. You cannot recover backups that you created with ntbackup by using wbadmin. However, a version of ntbackup is available as a download for Windows Server 2008, Windows Vista, Windows Server 2008 R2, or Windows 7 users who want to recover backups that they created using ntbackup. This downloadable version of ntbackup enables you to perform recoveries only of legacy backups, and it cannot be used on computers running Windows Server 2008, Windows Vista, Windows Server 2008 R2, or Windows 7 to create new backups. To download this version of ntbackup, see http://go.microsoft.com/fwlink/?LinkId=82917. And for more information about using this download, see article 974674 in the Microsoft Knowledge Base (http://go.microsoft.com/fwlink/?LinkId=194761).

Additional references

  • Backup and Recovery

  • Windows Server Backup Cmdlets in Windows PowerShell


Wbadmin enable backup

Applies To: Windows Server 2008 R2,Windows Server 2008

Creates and enables a daily backup schedule or modifies an existing backup schedule. With no parameters specified, it displays the currently scheduled backup settings.

Note
This subcommand applies only to Windows Server 2008 and Windows Server 2008 R2.

To configure or modify a daily backup schedule, you must be a member of either the Administrators or Backup Operators group. In addition, you must run wbadmin from an elevated command prompt. (To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.)

For examples of how to use this subcommand, see Examples.

Syntax

Syntax for Windows Server 2008:

Copy Code
wbadmin enable backup
[-addtarget:<BackupTargetDisk>]
[-removetarget:<BackupTargetDisk>]
[-schedule:<TimeToRunBackup>]
[-include:<VolumesToInclude>]
[-allCritical]
[-quiet]

Syntax for Windows Server 2008 R2:

Copy Code
wbadmin enable backup
[-addtarget:<BackupTarget>]
[-removetarget:<BackupTarget>]
[-schedule:<TimeToRunBackup>]
[-include:<VolumesToInclude>]
[-nonRecurseInclude:<ItemsToInclude>]
[-exclude:<ItemsToExclude>]
[-nonRecurseExclude:<ItemsToExclude>][-systemState]
[-allCritical]
[-vssFull | -vssCopy]
[-user:<UserName>]
[-password:<Password>]
[-quiet]

Parameters

Parameter Description

-addtarget

For Windows Server 2008, specifies the storage location for backups. Requires you to specify a destination for backups as a disk identifier (see Remarks). The disk is formatted before use, and any existing data on it is permanently erased.

For Windows Server 2008 R2, Specifies the storage location for backups. Requires you to specify the location as a disk, volume, or Universal Naming Convention (UNC) path to a remote shared folder (\\<servername>\<sharename>\). By default, the backup will be saved at: \\<servername>\<sharename>\WindowsImageBackup\<ComputerBackedUp>\. If you specify a disk, the disk will be formatted before use, and any existing data on it is permanently erased. If you specify a shared folder, you cannot add more locations. You can only specify one shared folder as a storage location at a time.

Important
If you save a backup to a remote shared folder, that backup will be overwritten if you use the same folder to back up the same computer again. In addition, if the backup operation fails, you may end up with no backup because the older backup will be overwritten, but the newer backup will not be usable. You can avoid this by creating subfolders in the remote shared folder to organize your backups. If you do this, the subfolders will need twice the space of the parent folder.

Only one location can be specified in a single command. Multiple volume and disk backup storage locations can be added by running the command again.

-removetarget

Specifies the storage location that you want to remove from the existing backup schedule. Requires you to specify the location as a disk identifier (see Remarks).

-schedule

Specifies times of day to create a backup, formatted as HH:MM and comma delimited.

-include

For Windows Server 2008, specifies the comma-delimited list of volume drive letters, volume mount points, or GUID-based volume names to include in the backup.

For Windows Server 2008 R2, Specifies the comma-delimited list of items to include in the backup. You can include multiple files, folders, or volumes. Volume paths can be specified using volume drive letters, volume mount points, or GUID-based volume names. If you use a GUID-based volume name, it should be terminated with a backslash (\). You can use the wildcard character (*) in the file name when specifying a path to a file.

-nonRecurseInclude

For Windows Server 2008 R2, specifies the non-recursive, comma-delimited list of items to include in the backup. You can include multiple files, folders, or volumes. Volume paths can be specified using volume drive letters, volume mount points, or GUID-based volume names. If you use a GUID-based volume name, it should be terminated with a backslash (\). You can use the wildcard character (*) in the file name when specifying a path to a file. Should be used only when the -backupTarget parameter is used.

-exclude

For Windows Server 2008 R2, specifies the comma-delimited list of items to exclude from the backup. You can exclude files, folders, or volumes. Volume paths can be specified using volume drive letters, volume mount points, or GUID-based volume names. If you use a GUID-based volume name, it should be terminated with a backslash (\). You can use the wildcard character (*) in the file name when specifying a path to a file.

-nonRecurseExclude

For Windows Server 2008 R2, specifies the non-recursive, comma-delimited list of items to exclude from the backup. You can exclude files, folders, or volumes. Volume paths can be specified using volume drive letters, volume mount points, or GUID-based volume names. If you use a GUID-based volume name, it should be terminated with a backslash (\). You can use the wildcard character (*) in the file name when specifying a path to a file.

-systemState

For Windows°7 and Windows Server 2008 R2, creates a backup that includes the system state in addition to any other items that you specified with the -include parameter. The system state contains boot files (Boot.ini, NDTLDR, NTDetect.com), the Windows Registry including COM settings, the SYSVOL (Group Policies and Logon Scripts), the Active Directory and NTDS.DIT on Domain Controllers and, if the certificates service is installed, the Certificate Store. If your server has the Web server role installed, the IIS Metadirectory will be included. If the server is part of a cluster, Cluster Service information will also be included.

-allCritical

Specifies that all critical volumes (volumes that contain operating system's state) be included in the backups. This parameter is useful if you are creating a backup for full system or system state recovery. It should be used only when -backupTarget is specified, otherwise the command will fail. Can be used with the -include option.

Tip
The target volume for a critical-volume backup can be a local drive, but it cannot be any of the volumes that are included in the backup.

-vssFull

For Windows Server 2008 R2, Performs a full back up using the Volume Shadow Copy Service (VSS). All files are backed up, each file's history is updated to reflect that it was backed up, and the logs of previous backups may be truncated. If this parameter is not used wbadmin start backup makes a copy backup, but the history of files being backed up is not updated.

Caution
Do not use this parameter if you are using a product other than Windows Server Backup to back up applications that are on the volumes included in the current backup. Doing so can potentially break the incremental, differential, or other type of backups that the other backup product is creating because the history that they are relying on to determine how much data to backup might be missing and they might perform a full backup unnecessarily.

-vssCopy

For Windows Server 2008 R2, performs a copy backup using VSS. All files are backed up but the history of the files being backup up is not updated so you preserve the all the information on which files where changed, deleted, and so on, as well as any application log files. Using this type of backup does not affect the sequence of incremental and differential backups that might happen independent of this copy backup. This is the default value.

Warning
A copy backup cannot be used for incremental or differential backups or restores.

-user

For Windows Server 2008 R2, specifies the user with write permission to the backup storage destination (if it is a remote shared folder). The user needs to be a member of the Administrators group or Backup Operators group on the computer that is getting backed up.

-password

For Windows Server 2008 R2, specifies the password for the user name provided by the parameter -user.

-quiet

Runs the subcommand with no prompts to the user.

Remarks

To view the disk identifier value for your disks, type wbadmin get disks.

Examples

The following examples show how the wbadmin enable backup command can be used in different backup scenarios:

Scenario #1

  • Schedule backups of hard disk drives e:, d:\mountpoint, and \\?\Volume{cc566d14-44a0-11d9-9d93-806e6f6e6963}\

  • Save the files to the disk DiskID

  • Run backups daily at 9:00 A.M. and 6:00 P.M.

Copy Code
wbadmin enable backup -addtarget:DiskID -schedule:09:00,18:00 -include:e:,d:\mountpoint,\\?\Volume{cc566d14-44a0-11d9-9d93-806e6f6e6963}\

Scenario #2

  • Schedule backups of the folder d:\documents to the network location \\backupshare\backup1

  • Use the network credentials for the backup administrator Aaren Ekelund (aekel), who is a member of the domain CONTOSOEAST to authenticate access to the network share. Aaren’s password is $3hM9^5lp.

  • Run backups daily at 12:00 A.M. and 7:00 P.M.

Copy Code
wbadmin enable backup –addtarget:\\backupshare\backup1 –include: d:\documents –user:CONTOSOEAST\aekel –password:$3hM9^5lp –schedule:00:00,19:00

Scenario #3

  • Schedule backups of volume t: and folder d:\documents to the drive h:, but exclude the folder d:\documents\~tmp

  • Perform a full backup using the Volume Shadow Copy Service.

  • Run backups daily at 1:00 A.M.

Copy Code
wbadmin enable backup –addtarget:H: –include T:,D:\documents –exclude D:\documents\~tmp –vssfull –schedule:01:00

Additional references

  • Command-Line Syntax Key

  • Wbadmin


Wbadmin disable backup

Applies To: Windows Server 2008,Windows Server 2008 R2

Stops running the existing scheduled daily backups.

Note
This subcommand applies only to Windows Server 2008 and Windows Server 2008 R2.

To disable a scheduled daily backup, you must be a member of the Administrators group, or you must have been delegated the appropriate permissions. In addition, you must run wbadmin from an elevated command prompt. (To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.)

Syntax

Copy Code
wbadmin disable backup
[-quiet]

Parameters

Parameter | Description
-quiet | Runs the subcommand with no prompts to the user.

Additional references

  • Command-Line Syntax Key

  • Wbadmin


Wbadmin start backup

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista

Creates a backup using specified parameters. If no parameters are specified and you have created a scheduled daily backup, this subcommand creates the backup by using the settings for the scheduled backup. If parameters are specified, it creates a Volume Shadow Copy Service (VSS) copy backup and will not update the history of the files that are being backed up.

To create a one-time backup with this subcommand, you must be a member of the Backup Operators group or the Administrators group, or you must have been delegated the appropriate permissions. In addition, you must run wbadmin from an elevated command prompt. (To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.)

For examples of how to use this subcommand, see Examples.

Syntax

Syntax for Windows°Vista and Windows Server 2008:

Copy Code
wbadmin start backup
[-backupTarget:{<BackupTargetLocation> | <TargetNetworkShare>}]
[-include:<VolumesToInclude>]
[-allCritical]
[-noVerify]
[-user:<UserName>]
[-password:<Password>]
[-noinheritAcl]
[-vssFull]
[-quiet]

Syntax for Windows°7 and Windows Server 2008 R2:

Copy Code
Wbadmin start backup
[-backupTarget:{<BackupTargetLocation> | <TargetNetworkShare>}]
[-include:<ItemsToInclude>]
[-nonRecurseInclude:<ItemsToInclude>]
[-exclude:<ItemsToExclude>]
[-nonRecurseExclude:<ItemsToExclude>]
[-allCritical]
[-systemState]
[-noVerify]
[-user:<UserName>]
[-password:<Password>]
[-noInheritAcl]
[-vssFull | -vssCopy]
[-quiet]

Parameters

Parameter Description

-backupTarget

Specifies the storage location for this backup. Requires a hard disk drive letter (f:), a volume GUID-based path in the format of \\?\Volume{GUID}, or a Universal Naming Convention (UNC) path to a remote shared folder (\\<servername>\<sharename>\). By default, the backup will be saved at: \\<servername>\<sharename>\WindowsImageBackup\<ComputerBackedUp>\.

Important
If you save a backup to a remote shared folder, that backup will be overwritten if you use the same folder to back up the same computer again. In addition, if the backup operation fails, you may end up with no backup because the older backup will be overwritten, but the newer backup will not be usable. You can avoid this by creating subfolders in the remote shared folder to organize your backups. If you do this, the subfolders will need twice the space as the parent folder.

-include

For Windows°Vista and Windows Server 2008, specifies the comma-delimited list of volume drive letters, volume mount points, or GUID-based volume names to include in the backup. This parameter should be used only when the -backupTarget parameter is used.

For Windows°7 and Windows Server 2008 R2, specifies the comma-delimited list of items to include in the backup. You can include multiple files, folders, or volumes. Volume paths can be specified using volume drive letters, volume mount points, or GUID-based volume names. If you use a GUID-based volume name, it should be terminated with a backslash (\). You can use the wildcard character (*) in the file name when specifying a path to a file. Should be used only when the -backupTarget parameter is used.

-exclude

For Windows°7 and Windows Server 2008 R2, specifies the comma-delimited list of items to exclude from the backup. You can exclude files, folders, or volumes. Volume paths can be specified using volume drive letters, volume mount points, or GUID-based volume names. If you use a GUID-based volume name, it should be terminated with a backslash (\). You can use the wildcard character (*) in the file name when specifying a path to a file. Should be used only when the -backupTarget parameter is used.

-nonRecurseInclude

For Windows°7 and Windows Server 2008 R2, specifies the non-recursive, comma-delimited list of items to include in the backup. You can include multiple files, folders, or volumes. Volume paths can be specified using volume drive letters, volume mount points, or GUID-based volume names. If you use a GUID-based volume name, it should be terminated with a backslash (\). You can use the wildcard character (*) in the file name when specifying a path to a file. Should be used only when the -backupTarget parameter is used.

-nonRecurseExclude

For Windows°7 and Windows Server 2008 R2, specifies the non-recursive, comma-delimited list of items to exclude from the backup. You can exclude files, folders, or volumes. Volume paths can be specified using volume drive letters, volume mount points, or GUID-based volume names. If you use a GUID-based volume name, it should be terminated with a backslash (\). You can use the wildcard character (*) in the file name when specifying a path to a file. Should be used only when the -backupTarget parameter is used.

-allCritical

Specifies that all critical volumes (volumes that contain operating system's state) be included in the backups. This parameter is useful if you are creating a backup for bare metal recovery. It should be used only when -backupTarget is specified, otherwise the command will fail. Can be used with the -include option.

Tip
The target volume for a critical-volume backup can be a local drive, but it cannot be any of the volumes that are included in the backup.

-systemState

For Windows°7 and Windows Server 2008 R2, creates a backup that includes the system state in addition to any other items that you specified with the -include parameter. The system state contains boot files (Boot.ini, NDTLDR, NTDetect.com), the Windows Registry including COM settings, the SYSVOL (Group Policies and Logon Scripts), the Active Directory and NTDS.DIT on Domain Controllers and, if the certificates service is installed, the Certificate Store. If your server has the Web server role installed, the IIS Metadirectory will be included. If the server is part of a cluster, Cluster Service information will also be included.

-noVerify

Specifies that backups saved to removable media (such as a DVD) are not verified for errors. If you do not use this parameter, backups saved to removable media are verified for errors.

-user

If the backup is saved to a remote shared folder, specifies the user name with write permission to the folder.

-password

Specifies the password for the user name that is provided by the parameter -user.

-noInheritAcl

Applies the access control list (ACL) permissions that correspond to the credentials provided by the -user and -password parameters to \\<servername>\<sharename>\WindowsImageBackup\<ComputerBackedUp>\ (the folder that contains the backup). To access the backup later, you must use these credentials or be a member of the Administrators group or the Backup Operators group on the computer with the shared folder. If -noInheritAcl is not used, the ACL permissions from the remote shared folder are applied to the <ComputerBackedUp> folder by default so that anyone with access to the remote shared folder can access the backup.

-vssFull

Performs a full back up using the Volume Shadow Copy Service (VSS). All files are backed up, each file's history is updated to reflect that it was backed up, and the logs of previous backups may be truncated. If this parameter is not used wbadmin start backup makes a copy backup, but the history of files being backed up is not updated.

Caution
Do not use this parameter if you are using a product other than Windows Server Backup to back up applications that are on the volumes included in the current backup. Doing so can potentially break the incremental, differential, or other type of backups that the other backup product is creating because the history that they are relying on to determine how much data to backup might be missing and they might perform a full backup unnecessarily.

-vssCopy

For Windows 7 andWindows Server 2008 R2, performs a copy backup using VSS. All files are backed up but the history of the files being backup up is not updated so you preserve the all the information on which files where changed, deleted, and so on, as well as any application log files. Using this type of backup does not affect the sequence of incremental and differential backups that might happen independent of this copy backup. This is the default value.

Warning
A copy backup cannot be used for incremental or differential backups or restores.

-quiet

Runs the subcommand with no prompts to the user.

Examples

The following examples show how the wbadmin start backup command can be used in different backup scenarios:

Scenario #1

  • Create a backup of volumes e:, d:\mountpoint, and \\?\Volume{cc566d14-4410-11d9-9d93-806e6f6e6963}

  • Save the backup to volume f:

Copy Code
wbadmin start backup -backupTarget:f: -include:e:,d:\mountpoint,\\?\Volume{cc566d14-44a0-11d9-9d93-806e6f6e6963}\

Scenario #2

  • Perform a one-time backup of f:\folder1 and h:\folder2 to volume d:.

  • Backup the system state

  • Make a copy backup so that the normally scheduled differential backup is not impacted.

Copy Code
wbadmin start backup –backupTarget:d: -include:g\folder1,h:\folder2 –systemstate -vsscopy

Scenario #3

  • Perform a one-time backup of d:\folder1 that should be backed up non-recursively.

  • Backup the folder to the network location \\backupshare\backup1

  • Restrict access to the backup to members of the Administrators or Backup Operators group.

Copy Code
wbadmin start backup –backupTarget: \\backupshare\backup1 -noinheritacl -nonrecurseinclude:d:\folder1

Additional references

  • Command-Line Syntax Key

  • Wbadmin


Wbadmin stop job

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Vista

Cancels the backup or recovery operation that is currently running. Canceled operations cannot be restarted—you must rerun a canceled backup or recovery operation from the beginning.

To stop a backup or recovery operation with this subcommand, you must be a member of the Backup Operators group or the Administrators group, or you must have been delegated the appropriate authority. In addition, you must run wbadmin from an elevated command prompt. (To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.)

Syntax

Copy Code
wbadmin stop job
[-quiet]

Parameters

Parameter | Description
-quiet | Runs the subcommand with no prompts to the user.

Additional references

  • Command-Line Syntax Key

  • Wbadmin


Wbadmin get versions

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista

Lists details about the available backups that are stored on the local computer or another computer. When this subcommand is used without parameters, it lists all backups of the local computer, even if those backups are not available. The details provided for a backup include the backup time, the backup storage location, the version identifier (needed for the wbadmin get items subcommand and to perform recoveries), and the type of recoveries you can perform.

To get details about available backups using this subcommand, you must be a member of the Backup Operators group or the Administrators group, or you must have been delegated the appropriate permissions. In addition, you must run wbadmin from an elevated command prompt. (To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.)

For examples of how to use this subcommand, see Examples.

Syntax

Copy Code
wbadmin get versions
[-backupTarget:{<BackupTargetLocation> | <NetworkSharePath>}]
[-machine:BackupMachineName]

Parameters

Parameter | Description
-backupTarget | Specifies the storage location that contains the backups that you want the details for. Use for listing backups stored at that target location. Backup target locations can be locally attached disk drives, volumes, remote shared folders, removable media such as DVD drives or other optical media. If wbadmin get versions is run on the same computer where the backup was created, this parameter is not needed. However, this parameter is required to get information about a backup created from another computer.
-machine | Specifies the computer that you want backup details for. Use when backups of multiple computers are stored in the same location. Should be used when -backupTarget is specified.

Remarks

To list items available for recovery from a specific backup, use wbadmin get items.

Examples

To see a list of available backups that are stored on volume h, type:

Copy Code
wbadmin get versions -backupTarget:h:

To see a list of available backups that are stored in the remote shared folder \\servername\share for the computer server01, type:

Copy Code
wbadmin get versions -backupTarget:\\servername\share -machine:server01

Additional references

  • Command-Line Syntax Key

  • Wbadmin

  • Get-WBBackupTarget


Wbadmin get items

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista

Lists the items included in a specific backup.

To use this subcommand, you must be a member of the Backup Operators group or the Administrators group, or you must have been delegated the appropriate permissions. In addition, you must run wbadmin from an elevated command prompt. (To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.)

For examples of how to use this subcommand, see Examples.

Syntax

Copy Code
wbadmin get items
-version:<VersionIdentifier>
[-backupTarget:{<BackupTargetLocation> | <NetworkSharePath>}]
[-machine:<BackupMachineName>]

Parameters

Parameter | Description
-version | Specifies the version of the backup in MM/DD/YYYY-HH:MM format. If you do not know the version information, type wbadmin get versions.
-backupTarget | Specifies the storage location that contains the backups for which you want the details. Use for listing backups stored at that target location. Backup target locations can be locally attached disk drives, volumes, remote shared folders, removable media such as DVD drives or other optical media.If wbadmin get items is run on the same computer where the backup was created, this parameter is not needed. However, this parameter is required to get information about a backup created from another computer.
-machine | Specifies the name of the computer that you want the backup details for. Useful when multiple computers have been backed up to the same location. Should be used when -backupTarget is specified.

Examples

To list items from the backup that was run on March 31, 2005 at 9:00 A.M., type:

Copy Code
wbadmin get items -version:03/31/2005-09:00

To list items from the backup of server01 that was run on April 30, 2005 at 9:00 A.M. and stored on \\servername\share, type:

Copy Code
wbadmin get items -version:04/30/2005-09:00 -backupTarget:\\servername\share -machine:server01

Additional references

  • Command-Line Syntax Key

  • Wbadmin

  • Get-WBBackupSet


Wbadmin start recovery

Applies To: Windows Server 2008,Windows Server 2008 R2

Runs a recovery operation based on the parameters that you specify.

Note
This subcommand applies only to Windows Server 2008 and Windows Server 2008 R2.

To perform a recovery with this subcommand, you must be a member of the Backup Operators group or the Administrators group, or you must have been delegated the appropriate permissions. In addition, you must run wbadmin from an elevated command prompt. (To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.)

For examples of how to use this subcommand, see Examples.

Syntax

Copy Code
wbadmin start recovery
-version:<VersionIdentifier>
-items:{<VolumesToRecover> | <AppsToRecover> | <FilesOrFoldersToRecover>}
-itemtype:{Volume | App | File}
[-backupTarget:{<VolumeHostingBackup> | <NetworkShareHostingBackup>}]
[-machine:<BackupMachineName>]
[-recoveryTarget:{<TargetVolumeForRecovery> | <TargetPathForRecovery>}]
[-recursive]
[-overwrite:{Overwrite | CreateCopy | Skip}]
[-notRestoreAcl]
[-skipBadClusterCheck]
[-noRollForward]
[-quiet]

Parameters

Parameter Description

-version

Specifies the version identifier of the backup to recover in MM/DD/YYYY-HH:MM format. If you do not know the version identifier, type wbadmin get versions.

-items

Specifies a comma-delimited list of volumes, applications, files, or folders to recover.

  • If -itemtype is Volume, you can specify only a single volume—by providing the volume drive letter, volume mount point, or GUID-based volume name.

  • If -itemtype is App, you can specify only a single application. To be recovered, the application must have registered with Windows Server Backup. You can also use the value ADIFM to recover an installation of Active Directory. See Remarks in for more information.

  • If -itemtype is File, you can specify files or folders, but they should be part of the same volume and they should be under the same parent folder.

-itemtype

Specifies type of items to recover. Must be Volume, App, or File.

-backupTarget

Specifies the storage location that contains the backup that you want to recover. This parameter is useful when the location is different from where backups of this computer are usually stored.

-machine

Specifies the name of the computer that you want to recover the backup for. This parameter is useful when multiple computers have been backed up to the same location. It should be used when the -backupTarget parameter is specified.

-recoveryTarget

Specifies the location to restore to. This parameter is useful if this location is different than the location that was previously backed up. It can also be used for restorations of volumes, files, or applications. If you are restoring a volume, you can specify the volume drive letter of the alternate volume. If you are restoring a file or application, you can specify an alternate recovery location.

-recursive

Valid only when recovering files. Recovers the files in the folders and all files subordinate to the specified folders. By default, only files which reside directly in the specified folders are recovered.

-overwrite

Valid only when recovering files. Specifies the action to take when a file that is being recovered already exists in the same location.

  • Skip causes Windows Server Backup to skip the existing file and continue with recovery of the next file.

  • CreateCopy causes Windows Server Backup to create a copy of the existing file so that the existing file is not modified.

  • Overwrite causes Windows Server Backup to overwrite the existing file with the file from the backup.

-notRestoreAcl

Valid only when recovering files. Specifies to not restore the security access control lists (ACLs) of the files being recovered from the backup. By default, the security ACLs are restored (the default value is true). If this parameter is used, the ACLs for the restored files will be inherited from the location to which the files are being restored.

-skipBadClusterCheck

Valid only when recovering volumes. Skips checking the disks that you are recovering to for bad cluster information. If you are recovering to an alternate server or hardware, we recommend that you do not use this parameter. You can manually run the command chkdsk /b on these disks at any time to check them for bad clusters, and then update the file system information accordingly.

Important
Until you run chkdsk as described, the bad clusters reported on your recovered system may not be accurate.

-noRollForward

Valid only when recovering applications. Allows for previous point-in-time recovery of an application if the latest version from the backups is selected. For other versions of the application that are not the latest, previous point-in-time recovery is done as the default.

-quiet

Runs the subcommand with no prompts to the user.

Remarks

  • To view a list of items that are available for recovery from a specific backup version, use wbadmin get items. If a volume did not have a mount point or drive letter at the time of backup, then this subcommand would return a GUID-based volume name that should be used for recovering the volume.

  • When the -itemtype is App, you can use a value of ADIFM for -item to perform an install from media operation to recover all the related data needed for Active Directory Domain Services. ADIFM creates a copy of the Active Directory database, registry, and SYSVOL state, and then saves this information in the location specified by -recoveryTarget. Use this parameter only when -recoveryTarget is specified.

    Note
    Before using wbadmin to perform an install from media operation, you should consider using the ntdsutil command because ntdsutil only copies the minimum amount of data needed, and it uses a more secure data transport method.

Examples

To run a recovery of the backup from March 31, 2005, taken at 9:00 A.M., of volume d:, type:

Copy Code
wbadmin start recovery -version:03/31/2005-09:00 -itemType:Volume -items:d:

To run a recovery to drive d of the backup from March 31, 2005, taken at 9:00 A.M., of the registry, type:

Copy Code
wbadmin start recovery -version:03/31/2005-09:00 -itemType:App -items:Registry -recoverytarget:d:\

To run a recovery of the backup from March 31, 2005, taken at 9:00 A.M., of the d:\folder and folders subordinate to d:\folder, type:

Copy Code
wbadmin start recovery -version:03/31/2005-09:00 -itemType:File -items:d:\folder -recursive

To run a recovery of the backup from March 31, 2005, taken at 9:00 A.M., of the volume \\?\Volume{cc566d14-44a0-11d9-9d93-806e6f6e6963}\, type:

Copy Code
wbadmin start recovery -version:03/31/2005-09:00 -itemType:Volume
-items:\\?\Volume{cc566d14-44a0-11d9-9d93-806e6f6e6963}\

To run a recovery of the backup from April 30, 2005, taken at 9:00 A.M., of the shared folder \\servername\share from server01, type:

Copy Code
wbadmin start recovery -version:04/30/2005-09:00 -backupTarget:\\servername\share -machine:server01

Additional references

  • Command-Line Syntax Key

  • Wbadmin

  • For more information about Active Directory Domain Services Installation and Removal, see the step-by-step guide (http://go.microsoft.com/fwlink/?LinkId=86727).


Wbadmin get status

Applies To: Windows Vista,Windows Server 2008,Windows Server 2008 R2

Reports the status of the backup or recovery operation that is currently running.

To use this subcommand, you must be a member of the Backup Operators group or the Administrators group, or you must have been delegated the appropriate permissions. In addition, you must run wbadmin from an elevated command prompt. (To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.)

Syntax

Copy Code
wbadmin get status

Parameters

This subcommand has no parameters.

Remarks

  • This subcommand will not stop until the current backup or recovery operation is finished—the subcommand will continue to run even if you close the command window.

  • If you want to stop the current backup or recovery operation, use the wbadmin stop job subcommand.

Additional references

  • Command-Line Syntax Key

  • Wbadmin


Wbadmin get disks

Applies To: Windows Server 2008,Windows Server 2008 R2

Lists the internal and external disks that are currently online for the local computer.

Note
This subcommand applies only to Windows Server 2008.

To list the disks that are online with this subcommand, you must be a member of the Backup Operators group or the Administrators group, or you must have been delegated the appropriate permissions. In addition, you must run wbadmin from an elevated command prompt. (To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.)

Syntax

Copy Code
wbadmin get disks

Parameters

This subcommand has no parameters.

Additional references

  • Command-Line Syntax Key

  • Wbadmin


Wbadmin start systemstaterecovery

Applies To: Windows Server 2008 R2,Windows Server 2008

Performs a system state recovery to a location and from a backup that you specify.

Note
This subcommand applies only to Windows Server 2008 and Windows Server 2008 R2.

Windows Server Backup does not back up or recover registry user hives (HKEY_CURRENT_USER) as part of system state backup or system state recovery.

To perform a system state recovery with this subcommand, you must be a member of the Backup Operators group or the Administrators group, or you must have been delegated the appropriate permissions. In addition, you must run wbadmin from an elevated command prompt. (To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.)

For examples of how to use this command, see Examples.

Syntax

Syntax for Windows Server 2008:

Copy Code
wbadmin start systemstaterecovery
-version:<VersionIdentifier>
-showsummary
[-backupTarget:{<BackupDestinationVolume> | <NetworkSharePath>}]
[-machine:<BackupMachineName>]
[-recoveryTarget:<TargetPathForRecovery>]
[-authsysvol]
[-quiet]

Syntax for Windows Server 2008 R2:

Copy Code
wbadmin start systemstaterecovery
-version:<VersionIdentifier>
-showsummary
[-backupTarget:{<BackupDestinationVolume> | <NetworkSharePath>}]
[-machine:<BackupMachineName>]
[-recoveryTarget:<TargetPathForRecovery>]
[-authsysvol]
[-autoReboot]
[-quiet]

Parameters

Parameter | Description
-version | Specifies the version identifier for the backup to recover in MM/DD/YYYY-HH:MM format. If you do not know the version identifier, type wbadmin get versions.
-showsummary | Reports the summary of the last system state recovery (after the restart required to complete the operation). This parameter cannot be accompanied by any other parameters.
-backupTarget | Specifies the storage location that contains the backup or backups you want to recover. This parameter is useful when the storage location is different from where the backups of this computer are usually stored.
-machine | Specifies the name of the computer that you want to recover. This parameter is useful when multiple computers have been backed up to the same location. Should be used when the -backupTarget parameter is specified.
-recoveryTarget | Specifies the directory to restore to. This parameter is useful if the backup is restored to an alternate location.
-authsysvol | If used, performs an authoritative restore of SYSVOL (the System Volume shared directory).
-autoReboot | In Windows Server 2008 R2, specifies to restart the system at the end of the system state recovery operation. This parameter is valid only for a recovery to the original location. We do not recommend you use this parameter if you need to perform steps after the recovery operation.
-quiet | Runs the subcommand with no prompts to the user.

Examples

  • To perform a system state recovery of the backup from 03/31/2005 at 9:00 A.M., type:

    Copy Code
    wbadmin start systemstaterecovery -version:03/31/2005-09:00
  • To perform a system state recovery of the backup from 04/30/2005 at 9:00 A.M. that is stored on the shared resource \\servername\share for server01, type:

    Copy Code
    wbadmin start systemstaterecovery -version:04/30/2005-09:00 -backupTarget:\\servername\share -machine:server01

Additional references

  • Command-Line Syntax Key

  • Wbadmin


Wbadmin start systemstatebackup

Applies To: Windows Server 2008,Windows Server 2008 R2

Creates a system state backup of the local computer and stores it on the location specified.

Note
This subcommand applies only to Windows Server 2008 and Windows Server 2008 R2.

Windows Server Backup does not back up or recover registry user hives (HKEY_CURRENT_USER) as part of system state backup or system state recovery.

To perform a system state backup with this subcommand, you must be a member of the Backup Operators group or the Administrators group, or you must have been delegated the appropriate permissions. In addition, you must run wbadmin from an elevated command prompt. (To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.)

For examples of how to use this subcommand, see Examples.

Syntax

Copy Code
wbadmin start systemstatebackup
-backupTarget:<VolumeName>
[-quiet]

Parameters

Parameter | Description
-backupTarget | Specifies the location where you want to store the backup. The storage location requires a drive letter or a GUID-based volume of the format: \\?\Volume{GUID}. A system state backup to a shared network folder is not supported.
-quiet | Runs the subcommand with no prompts to the user.

Remarks

For information about saving a system state backup to a volume that, in turn, contains system state files, see article 944530 in the Microsoft Knowledge Base (http://go.microsoft.com/fwlink/?LinkId=110439).

Examples

To create a system state backup and store it on volume f, type:

Copy Code
wbadmin start systemstatebackup -backupTarget:f:

Additional references

  • Command-Line Syntax Key

  • Wbadmin


Wbadmin delete systemstatebackup

Applies To: Windows Server 2008 R2,Windows Server 2008

Deletes the system state backups that you specify. If the specified volume contains backups other than system state backups of your local server, those backups will not be deleted. In Windows Server 2008, each system state backup is a full backup and is stored in a separate directory. This means that a system state backup on Windows Server 2008 consumes the space needed for a full backup every time it occurs. In Windows Server 2008 R2 system state backups are incremental and use VSS shadow copies for creating different versions of the backup, making better use of disk space.

Note
This subcommand applies only to Windows Server 2008 and Windows Server 2008 R2.

Windows Server Backup does not back up or recover registry user hives (HKEY_CURRENT_USER) as part of system state backup or system state recovery.

To delete a system state backup with this subcommand, you must be a member of the Backup Operators group or the Administrators group, or you must have been delegated the appropriate permissions. In addition, you must run wbadmin from an elevated command prompt. (To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.)

For examples of how to use this command, see Examples.

Syntax

Copy Code
wbadmin delete systemstatebackup
{-keepVersions:<NumberofCopies> | -version:<VersionIdentifier> | -deleteOldest}
[-backupTarget:<VolumeName>]
[-machine:<BackupMachineName>]
[-quiet]
Important
One and only one of these parameters must be specified: -keepVersions, -version, or -deleteOldest.

Parameters

Parameter Description

-keepVersions

Specifies the number of the latest system state backups to keep. The value must be a positive integer. The parameter value -keepVersions:0 deletes all the system state backups.

-version

Specifies the version identifier of the backup in MM/DD/YYYY-HH:MM format. If you do not know the version identifier, type wbadmin get versions.

Versions that are exclusively system state backups can be deleted using this command. Use wbadmin get items to view the version type.

-deleteOldest

Deletes the oldest system state backup.

-backupTarget

Specifies the storage location for the backup that you want to delete. The storage location for backups of disks can be a drive letter, a mount point, or a GUID-based volume path. This value only needs to be specified for locating backups that are not of the local computer. Information about backups for the local computer will be available in the backup catalog on the local computer.

-machine

Specifies the computer whose system state backup you want to delete. Useful when multiple computers were backed up to the same location. Should be used when the -backupTarget parameter is specified.

-quiet

Runs the subcommand with no prompts to the user.

Examples

To delete the system state backup created on March 31, 2006 at 10:00 AM, type:

Copy Code
wbadmin delete systemstatebackup -version:03/31/2006-10:00

To delete all system state backups, except the three most recent, type:

Copy Code
wbadmin delete systemstatebackup -keepVersions:3

To delete the oldest system state backup stored on disk f, type:

Copy Code
wbadmin delete systemstatebackup -backupTarget:f -deleteOldest

Additional references

  • Command-Line Syntax Key

  • Wbadmin


Wbadmin start sysrecovery

Applies To: Windows Server 2008 R2,Windows Server 2008

Performs a system recovery (bare metal recovery) using the parameters that you specify.

This subcommand can be run only from the Windows Recovery Environment, and it is not listed by default in the usage text of Wbadmin. (In Windows Server 2008 to access the Windows Recovery Environment insert a Windows Setup disc, and follow the steps in the wizard until you see the link Repair your computer. In Windows Server 2008 R2, to access the Windows Recovery Environment use the Windows Setup disc or start/restart the computer, press F8, and then select Repair Your Computer from the list of startup options.)

Note
This subcommand applies only to Windows Server 2008 and Windows Server 2008 R2.

To perform a system recovery with this subcommand, you must be a member of the Backup Operators group or the Administrators group, or you must have been delegated the appropriate permissions.

For examples of how to use this subcommand, see Examples.

Syntax

Copy Code
wbadmin start sysrecovery
-version:<VersionIdentifier>
-backupTarget:{<BackupDestinationVolume> | <NetworkShareHostingBackup>}
[-machine:<BackupMachineName>]
[-restoreAllVolumes]
[-recreateDisks]
[-excludeDisks]
[-skipBadClusterCheck]
[-quiet]

Parameters

Parameter Description

-version

Specifies the version identifier for the backup to recover in MM/DD/YYYY-HH:MM format. If you do not know the version identifier, type wbadmin get versions.

-backupTarget

Specifies the storage location that contains the backup or backups that you want to recover. This parameter is useful when the storage location is different from where backups of this computer are usually stored.

-machine

Specifies the name of the computer that you want to recover. This parameter is useful when multiple computers have been backed up to the same location. Should be used when the -backupTarget parameter is specified.

-restoreAllVolumes

Recovers all volumes from the selected backup. If this parameter is not specified, only critical volumes (volumes that contain the system state and operating system components) are recovered. This parameter is useful when you need to recover non-critical volumes during system recovery.

-recreateDisks

Recovers a disk configuration to the state that existed when the backup was created.

Warning
This parameter deletes all data on volumes that host operating system components. It might also delete data from data volumes.

-excludeDisks

Valid only when specified with the -recreateDisks parameter and must be input as a comma-delimited list of disk identifiers (as listed in the output of wbadmin get disks). Excluded disks are not partitioned or formatted. This parameter helps preserve data on disks that you do not want modified during the recovery operation.

-skipBadClusterCheck

Skips checking your recovery disks for bad cluster information. If you are restoring to an alternate server or hardware, we recommend that you do not use this parameter. You can manually run chkdsk /b on your recovery disks at any time to check them for bad clusters, and then update the file system information accordingly.

Warning
Until you run chkdsk as described, the bad clusters reported on your recovered system may not be accurate.

-quiet

Runs the command with no prompts to the user.

Examples

To start recovering the information from the backup that was run on March 31, 2005 at 9:00 A.M., located on drive d:, type:

Copy Code
wbadmin start sysrecovery -version:03/31/2005-09:00 -backupTarget:d:

To start recovering the information from the backup that was run on April 30, 2005 at 9:00 A.M., located in the shared folder \\servername\shared: for server01, type:

Copy Code
wbadmin start sysrecovery -version:04/30/2005-09:00 -backupTarget:\\servername\share -machine:server01

Additional references

  • Command-Line Syntax Key

  • Wbadmin


Wbadmin restore catalog

Applies To: Windows Server 2008,Windows Server 2008 R2

Recovers a backup catalog for the local computer from a storage location that you specify.

Note
This subcommand applies only to Windows Server 2008 and Windows Server 2008 R2.

To recover a backup catalog with this subcommand, you must be a member of the Backup Operators group or the Administrators group, or you must have been delegated the appropriate permissions. In addition, you must run wbadmin from an elevated command prompt. (To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.)

For examples of how to use this subcommand, see Examples.

Syntax

Copy Code
wbadmin restore catalog
-backupTarget:{<BackupDestinationVolume> | <NetworkShareHostingBackup>}
[-machine:<BackupMachineName>]
[-quiet]

Parameters

Parameter | Description
-backupTarget | Specifies the location of the backup catalog of the system as it was at the point after the backup was created.
-machine | Specifies the name of the computer that you want to recover the backup catalog for. Use when backups for multiple computers have been stored at the same location. Should be used when -backupTarget is specified.
-quiet | Runs the subcommand with no prompts to the user.

Remarks

If the location (disk, DVD, or remote shared folder) where you store your backups is damaged or lost and cannot be used to restore the backup catalog, use wbadmin delete catalog to delete the corrupted catalog. In this case, you should create a new backup once your backup catalog is deleted.

Examples

To restore a catalog from a backup stored on disk d:, type:

Copy Code
wbadmin restore catalog -backupTarget:d

To restore a catalog from a backup stored in the shared folder \\servername\share of server01, type:

Copy Code
wbadmin restore catalog -backupTarget:\\servername\share -machine:server01

Additional references

  • Command-Line Syntax Key

  • Wbadmin


Wbadmin delete catalog

Applies To: Windows Server 2008,Windows Server 2008 R2

Deletes the backup catalog that is stored on the local computer. Use this command when the backup catalog has been corrupted and you cannot restore it using wbadmin restore catalog.

Note
This subcommand applies only to Windows Server 2008 and Windows Server 2008 R2.

To delete a backup catalog with this subcommand, you must be a member of the Backup Operators group or the Administrators group, or you must have been delegated the appropriate permissions. In addition, you must run wbadmin from an elevated command prompt. (To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.)

Syntax

Copy Code
wbadmin delete catalog
[-quiet]

Parameters

Parameter | Description
-quiet | Runs the subcommand with no prompts to the user.

Remarks

If you delete the backup catalog for a computer, you will not be able to access the backups created of that computer using the Windows Server Backup snap-in. In this case, if you can access another backup location, use wbadmin restore catalog to restore the backup catalog from that location. You should create a new backup once your backup catalog is deleted.

Additional references

  • Command-Line Syntax Key

  • Wbadmin


Wdsutil

Applies To: Windows Server 2008 R2,Windows Server 2008

WDSUTIL is a command-line utility used for managing your Windows Deployment Services server. To run these commands, click Start, right-click Command Prompt, and click Run as administrator.

Commands

Command | Description
/add | Adds objects or prestages computers.
/approve-AutoAddDevices | Approves computers that are pending administrator approval.
/convert-RiprepImage | Converts an existing Remote Installation Preparation (RIPrep) image to a Windows Image (.wim) file.
/copy-DriverGroup | Copies an image or a driver group.
/delete-AutoAddDevices | Deletes computers that are in the Auto-Add database (which stores information about the computers on the server).
/disable | Disables all services for Windows Deployment Services.
/disconnect-Client | Disconnects a client from a multicast transmission or namespace.
/enable | Enables all services for Windows Deployment Services.
/export-Image | Exports an image from the image store to a .wim file.
/get | Retrieves properties and attributes about the specified object.
/initialize-Server | Configures a Windows Deployment Services server for initial use.
/new | Creates new capture and discover images as well as multicast transmissions and namespaces.
/progress | Displays the progress status while a command is being executed.
/reject-AutoAddDevices | Rejects computers that are pending administrator approval.
/remove | Removes objects.
/replace-Image | Replaces a boot or installation image with a new version of that image.
/set | Sets properties and attributes on the specified object.
/start | Starts all services on the Windows Deployment Services server, including multicast transmissions, namespaces, and the Transport Server.
/stop | Stops all services on the Windows Deployment Services server.
/uninitialize-Server | Reverts changes made during server initialization.
/update-ServerFiles | Updates server files on the RemoteInstall share.
/verbose | Displays verbose output for the specified command.


/add

Applies To: Windows Server 2008,Windows Server 2008 R2

Subcommands

Subcommand | Description
/add-Device | Prestages a computer in Active Directory.
/add-Image | Adds boot or installation images.
/add-ImageGroup | Adds an image group.
/add-DriverGroupPackage | Adds a driver package to a driver group.
/add-DriverGroupPackages | Adds driver packages to a driver group.
/add-DriverPackage | Adds a driver package to the server.
/add-ImageDriverPackage | Adds a driver package that is in the driver store to an existing boot image on the server. The image version must be Windows 7 or Windows Server 2008 R2.
/add-ImageDriverPackages | Adds driver packages from the driver store to a boot image on the server. The image version must be Windows 7 or Windows Server 2008 R2.
/add-AllDriverPackages | Adds driver packages from a folder to a server.
/add-DriverGroup | Adds a driver group to a server.
/Add-DriverGroupFilter | Adds a filter to a driver group on a server.


/add-Device

Applies To: Windows Server 2008 R2,Windows Server 2008

Prestages a computer in Active Directory Domain Services. Prestaged computers are also called known computers. This allows you to configure properties to control the installation for the client. For example, you can configure the network boot program and the unattend file that the client should receive, as well as the server from which the client should download the network boot program.

For examples of how you can use this command, see Examples.

Syntax

Copy Code
WDSUTIL /Add-Device /Device:<Device name> /ID:<UUID | MAC Address> [/ReferralServer:<Server name>] [/BootProgram:<Relative path>] [/WdsClientUnattend:<Relative path>]
[/User:<Domain\User | User@Domain>] [/JoinRights:{JoinOnly | Full}] [/JoinDomain:{Yes | No}] [/BootImagePath:<Relative path>] [/OU:<DN of OU>] [/Domain:<Domain>]

Parameters

Parameter Description

/Device:<computer name>

Specifies the name of the computer to be added.

/ID:<UUID | MAC Address>

Specifies either the GUID/UUID or the MAC address of the computer. A GUID/UUID must be in one of two formats—binary string or GUID string. For example:

Binary string: /ID:ACEFA3E81F20694E953EB2DAA1E8B1B6

GUID string: /ID:E8A3EFAC-201F-4E69-953E-B2DAA1E8B1B6

A MAC address must be in the following format: 00B056882FDC (no dashes) or 00-B0-56-88-2F-DC (with dashes)

[/ReferralServer:<Server name>]

Specifies the name of the server to be contacted to download the network boot program and the boot image by using Trivial File Transfer Protocol (TFTP).

[/BootProgram:<Relative path>]

Specifies the relative path from the RemoteInstall folder to the network boot program that this computer should receive. For example: "boot\x86\pxeboot.com"

[/WdsClientUnattend:<Relative path>]

Specifies the relative path from the RemoteInstall folder to the unattended installation file that automates the installation screens of the Windows Deployment Services client.

[/User:<Domain\User | User@Domain>]

Sets permissions on the computer account object to give the specified user the necessary rights to join the computer to the domain.

[/JoinRights:{JoinOnly | Full}]

Specifies the type of rights to be assigned to the user.

  • JoinOnly requires the administrator to reset the computer account before the user can join the computer to the domain.

  • Full gives full access to the user, which includes the right to join the computer to the domain.

[/JoinDomain:{Yes | No}]

Specifies whether or not the computer should be joined to the domain as this computer account during operating system installation. The default value is Yes.

[/BootImagePath:<Relative path>]

Specifies the relative path from the RemoteInstall folder to the boot image that this computer should use.

[/OU:<DN of OU>]

The distinguished name of the organizational unit where the computer account object should be created. For example: OU=MyOU,CN=Test, DC=Domain,DC=com. The default location is the default computer's container.

[/Domain:<Domain>]

The domain where the computer account object should be created. The default location is the local domain.

Examples

To add a computer by using a MAC address, type:

Copy Code
WDSUTIL /Add-Device /Device:Computer1 /ID:00-B0-56-88-2F-DC

To add a computer by using a GUID string, type:

Copy Code
WDSUTIL /Add-Device /Device:Computer1 /ID:{E8A3EFAC-201F-4E69-953F-B2DAA1E8B1B6} /ReferralServer:WDSServer1 /BootProgram:boot\x86\pxeboot.com
/WDSClientUnattend:WDSClientUnattend\unattend.xml /User:Domain\MyUser/JoinRights:Full /BootImagePath:boot\x86\images\boot.wim /OU:"OU=MyOU,CN=Test,DC=Domain,DC=com"

Additional references

Command-Line Syntax Key

/get-AllDevices

/get-Device

/set-Device


/add-Image

Applies To: Windows Server 2008,Windows Server 2008 R2

Adds images to a Windows Deployment Services server. For examples of how you can use this command, see Examples.

Syntax

For boot images, use the following syntax:

Copy Code
WDSUTIL /Add-Image /ImageFile:<wim file path> [/Server:<Server name>] /ImageType:Boot [/SkipVerify] [/Name:<Image name>] [/Description:<Image description>]
[/Filename:<New wim file name>]

For install images, use the following syntax:

Copy Code
WDSUTIL /Add-Image /ImageFile:<wim file path>
     [/Server:<Server name>]
     /ImageType:Install
     [/SkipVerify]
     [/ImageGroup:<Image group name>]
     [/SingleImage:<Single image name>]
         [/Name:<Name>]
         [/Description:<Description>]
     [/Filename:<File name>]
     [/UnattendFile:<Unattend file path>]

Parameters

Parameter | Description
/ImageFile:<.wim file path> | Specifies the full path and file name of the Windows Image (.wim) file that contains the images to be added.
[/Server:<Server name>] | Specifies the name of the server. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If a server name is not specified, the local server will be used.
/ImageType:{Boot|Install} | Specifies the type of images to be added.
[/SkipVerify] | Specifies that integrity verification will not be performed on the source image file before the image is added.
[/Name:<Name>] | Sets the display name of the image.
[/Description:<Description>] | Sets the description of the image.
[/Filename:<Filename>] | Specifies the new file name for the .wim file. This enables you to change the file name of the .wim file when adding the image. If no file name is specified, the source image file name will be used. In all cases, Windows Deployment Services checks to determine whether the file name is unique in the boot image store of the destination computer.
[/ImageGroup:<Image group name>] | Specifies the name of the image group in which the images are to be added. If more than one image group exists on the server, the image group must be specified. If this is not specified and an image group does not already exist, a new image group will be created. Otherwise, the existing image group will be used.
[/SingleImage:<Single image name>] [/Name:<Name>] [/Description:<Description>] | Copies the specified single image out of a .wim file, and sets the image's display name and description.
[/UnattendFile:<Unattend file path>] | Specifies the full path to the unattended installation file to be associated with the images that are being added. If /SingleImage is not specified, the same unattend file will be associated with all of the images in the .wim file.

Examples

To add a boot image, type:

Copy Code
WDSUTIL /Add-Image /ImageFile:"C:\MyFolder\Boot.wim" /ImageType:Boot
WDSUTIL /Verbose /Progress /Add-Image /ImageFile:\\MyServer\Share\Boot.wim /Server:MyWDSServer /ImageType:Boot /Name:"My WinPE Image"
/Description:"WinPE Image containing the WDS Client" /Filename:WDSBoot.wim

To add an install image, type one of the following:

Copy Code
WDSUTIL /Add-Image /ImageFile:"C:\MyFolder\Install.wim" /ImageType:Install
WDSUTIL /Verbose /Progress /Add-Image /ImageFile:\\MyServer\Share \Install.wim /Server:MyWDSServer /ImageType:Install /ImageGroup:ImageGroup1
/SingleImage:"Windows Professional" /Name:"My WDS Image"
/Description:"Windows Professional image with MSOffice" /Filename:"Win Pro.wim" /UnattendFile:"\\server\share\unattend.xml"

Additional references

Command-Line Syntax Key

/copy-Image

/export-Image

/get-Image

/remove-Image

/replace-Image

/set-Image


/add-ImageGroup

Applies To: Windows Server 2008 R2,Windows Server 2008

Adds an image group to a Windows Deployment Services server.

Syntax

Copy Code
WDSUTIL [Options] /Add-ImageGroup /ImageGroup:<Image group name> [/Server:<Server name>]

Parameters

Parameter | Description
/ImageGroup:<Image group name> | Specifies the name of the image group to be added.
[/Server:<Server name>] | Specifies the name of the server. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If a server name is not specified, the local server will be used.

Examples

To add an image group, type one of the following:

Copy Code
WDSUTIL /Add-ImageGroup /ImageGroup:ImageGroup2
WDSUTIL /Verbose /Add-ImageGroup /ImageGroup:"My Image Group" /Server:MyWDSServer

Additional references

Command-Line Syntax Key

/get-AllImageGroups

/get-ImageGroup

/remove-ImageGroup

/set-ImageGroup


/approve-AutoAddDevices

Applies To: Windows Server 2008,Windows Server 2008 R2

Approves computers that are pending administrative approval. When the Auto-Add policy is enabled, administrative approval is required before unknown computers (those that are not prestaged) can install an image. You can enable this policy using the PXE Response tab of the server’s properties page.

Syntax

Copy Code
WDSUTIL [Options] /Approve-AutoAddDevices [/Server:<Server name>] /RequestId:{<Request ID>| ALL} [/MachineName:<Device name>] [/OU:<DN of OU>]
[/User:<Domain\User | User@Domain>] [/JoinRights:{JoinOnly | Full}] [/JoinDomain:{Yes | No}] [/ReferralServer:<Server name>] [/BootProgram:<Relative path>] [/WdsClientUnattend:<Relative path>] [/BootImagePath:<Relative path>]

Parameters

Parameter Description

[/Server:<Server name>]

Specifies the name of the server. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If a server name is not specified, the local server will be used.

/RequestId:{Request ID | ALL}

Specifies the request ID assigned to the pending computer. Specify ALL to approve all pending computers.

[/MachineName:<Device name>]

Specifies the name of the computer to be added. You cannot use this option when approving all computers.

[/OU:<DN of OU>]

Specifies the distinguished name of the organizational unit (OU) where the computer account object should be created. For example: OU=MyOU,CN=Test,DC=Domain,DC=com. The default location is the container of the default computer.

[/User:<Domain\User | User@Domain>]

Sets permissions on the computer account object to assign the specified user the necessary rights.

[/JoinRights:{JoinOnly | Full}]

Specifies the type of rights to be assigned to the specified user.

  • JoinOnly requires the administrator to reset the computer account before the user can join the computer to the domain.

  • Full gives full access to the user, which includes the right to join the computer to the domain.

[/JoinDomain:{Yes | No}]

Specifies whether or not the computer should be joined to the domain as this computer account during operating system installation. The default value is Yes.

[/ReferralServer:<Server name>]

Specifies the name of the server to be contacted to download the network boot program and boot image by using Trivial File Transfer Protocol (TFTP).

[/BootProgram:<Relative path>]

Specifies the relative path from the RemoteInstall folder to the network boot program that this computer should receive. For example: boot\x86\pxeboot.com.

[/WdsClientUnattend:<Relative path>]

Specifies the relative path from the RemoteInstall folder to the unattend file that automates the Windows Deployment Services client.

[/BootImagePath:<Relative path>]

Specifies the relative path from the RemoteInstall folder to the boot image that this computer should receive.

Examples

To approve the computer with a RequestId of 12, type:

Copy Code
WDSUTIL /Approve-AutoAddDevices /RequestId:12

To approve the computer with a RequestID of 20 and deploy the image with the specified settings, type:

Copy Code
WDSUTIL /Approve-AutoAddDevices /RequestId:20 /MachineName:Computer1 /OU:"OU=Test,CN=Company,DC=Domain,DC=Com" /User:Domain\User1
/JoinRights:Full /ReferralServer:MyWDSServer /BootProgram:boot\x86\pxeboot.n12 /WdsClientUnattend:WDSClientUnattend\Unattend.xml /BootImagePath:boot\x86\images\boot.wim

To approve all pending computers, type:

Copy Code
WDSUTIL /Verbose /Approve-AutoAddDevices /RequestId:ALL

Additional references

Command-Line Syntax Key

/delete-AutoAddDevices

/get-AutoAddDevices

/reject-AutoAddDevices


/convert-RiprepImage

Applies To: Windows Server 2008 R2,Windows Server 2008

Converts an existing Remote Installation Preparation (RIPrep) image to Windows Image (.wim) format.

Syntax

Copy Code
WDSUTIL [Options] /Convert-RIPrepImage /FilePath:<File path and name>
     /DestinationImage
         /FilePath:<File path and name>
         [/Name:<Name>]
         [/Description:<Description>]
         [/InPlace]
         [/Overwrite:{Yes | No | Append}]

Parameters

Parameter Description

/FilePath:<File path and name>

Specifies the full path and file name of the .sif file that corresponds to the RIPrep image. This file is typically called Riprep.sif and is found in the \Templates subfolder of the folder that contains the RIPrep image.

/DestinationImage

Specifies the settings for the destination image, using the following options.

  • /FilePath:<File path and name> - Sets the full file path for the new file. For example: C:\Temp\convert.wim

  • [/Name:<Name>] - Sets the display name of the image. If no display name is specified, the display name of the source image will be used.

  • [/Description: <Description>] - Sets the description of the image.

  • [/InPlace] - Specifies that the conversion should take place on the original RIPrep image and not on a copy of the original image, which is the default behavior.

  • [/Overwrite:{Yes | No | Append}] - Determines whether the file specified in the /DestinationImage option should be overwritten if an existing file with that name already exists at /FilePath. Yes overwrites the existing file. No (default) causes an error to occur if another file with the same name already exists. Append attaches the generated image as a new image within the pre-existing .wim file.

Examples

To convert the specified RIPrep.sif image to RIPREP.wim, type:

Copy Code
WDSUTIL /Convert-RiPrepImage /FilePath:"R:\RemoteInstall\Setup\English
\Images\Win2k3.SP1\i386\Templates\riprep.sif" /DestinationImage
/FilePath:"C:\Temp\RIPREP.wim"

To convert the specified RIPrep.sif image to RIPREP.wim with the specified name and description, and overwrite it with the new file if a file already exists, type:

Copy Code
WDSUTIL /Verbose /Progress /Convert-RiPrepImage /FilePath:"\\Server
\RemInst\Setup\English\Images\WinXP.SP2\i386\Templates\riprep.sif"
/DestinationImage /FilePath:"\\Server\Share\RIPREP.wim"
/Name:"WindowsXP image" /Description:"Converted RIPREP image of WindowsXP"
/Overwrite:Append

Additional references

Command-Line Syntax Key


/copy-Image

Applies To: Windows Server 2008,Windows Server 2008 R2

Copies images that are within the same image group. To copy images between image groups, use the /export-Image command and then the /add-Image command.

For examples of how you can use this command, see Examples.

Syntax

Copy Code
WDSUTIL [Options] /Copy-Image /Image:<Image name> [/Server:<Server name>]
     /ImageType:Install
     [/ImageGroup:<Image group name>]
     [/Filename:<File name>]
     /DestinationImage
         /Name:<Name>
         /Filename:<File name>
         [/Description:<Description>]

Parameters

Parameter Description

/Image:<Image name>

Specifies the name of the image to be copied.

[/Server:<Server name>]

Specifies the name of the server. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server will be used.

/ImageType:Install

Specifies the type of image to be copied. This option must be set to install.

[/ImageGroup:<Image group name>]

Specifies the image group that contains the image to be copied. If no image group is specified and only one group exists on the server, that image group will be used by default. If more than one image group exists on the server, you must specify the image group.

[/Filename:<Filename>]

Specifies the file name of the image to be copied. If the source image cannot be uniquely identified by name, you must specify the file name.

/DestinationImage

Specifies the settings for the destination image, as described in the following table.

  • /Name:<Name> - Sets the display name of the image to be copied.

  • /Filename:<Filename> - Sets the name of the destination image file that will contain the image copy.

  • [/Description: <Description>] - Sets the description of the image copy.

Examples

To create a copy of the specified image and name it WindowsVista.wim, type:

Copy Code
WDSUTIL /Copy-Image /Image:"Windows Vista with Office" /ImageType:Install /DestinationImage /Name:"Copy of Windows Vista with Office" /Filename:"WindowsVista.wim"

To create a copy of the specified image, apply the specified settings, and name the copy WindowsVista.wim, type:

Copy Code
WDSUTIL /Verbose /Progress /Copy-Image /Image:"Windows Vista with Office" /Server:MyWDSServer /ImageType:Install /ImageGroup:ImageGroup1
/Filename:install.wim /DestinationImage /Name:"Copy of Windows Vista with Office" /Filename:"WindowsVista.wim" /Description:"This is a copy of the original Windows image with Office installed"

Additional references

Command-Line Syntax Key

/add-Image

/export-Image

/get-Image

/remove-Image

/replace-Image

/set-Image


/delete-AutoAddDevices

Applies To: Windows Server 2008 R2,Windows Server 2008

Deletes computers that are pending, rejected, or approved from the Auto-Add database. This database stores information about these computers on the server.

Syntax

Copy Code
WDSUTIL /Delete-AutoAddDevices [/Server:<Server name>] /DeviceType:{PendingDevices | RejectedDevices |ApprovedDevices}

Parameters

Parameter Description

[/Server:<Server name>]

Specifies the name of the server. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server will be used.

/DeviceType:{PendingDevices | RejectedDevices |ApprovedDevices}

Specifies the type of computer to delete from the database. This can be any of the following three types:

  • PendingDevices returns all computers in the database that have a status of pending.

  • RejectedDevices returns all computers in the database that have a status of rejected.

  • ApprovedDevices returns all computers that have a status of approved.

Examples

To delete all rejected computers, type:

Copy Code
WDSUTIL /Delete-AutoAddDevices /DeviceType:RejectedDevices

To delete all approved computers, type:

Copy Code
WDSUTIL /Verbose /Delete-AutoAddDevices /Server:MyWDSServer /DeviceType:ApprovedDevices

Additional references

Command-Line Syntax Key

/approve-AutoAddDevices

/get-AutoAddDevices

/reject-AutoAddDevices


/disable

Applies To: Windows Server 2008,Windows Server 2008 R2

Disables all services for Windows Deployment Services.

Subcommands

Subcommand | Description
/disable-Server | Disables all Windows Deployment Services services on a specified server (Deployment Server).
/disable-TransportServer | Disables all Windows Deployment Services services on a specified Transport Server.


/disable-Server

Applies To: Windows Server 2008 R2,Windows Server 2008

Disables all services for a Windows Deployment Services server.

Syntax

Copy Code
WDSUTIL [Options] /Disable-Server [/Server:<Server name>]

Parameters

Parameter | Description
[/Server:<Server name>] | Specifies the name of the server. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server will be used.

Examples

To disable the server, run one of the following:

Copy Code
WDSUTIL /Disable-Server
WDSUTIL /Verbose /Disable-Server /Server:MyWDSServer

Additional references

Command-Line Syntax Key

/enable-Server

/get-Server

/initialize-Server

/set-Server

/start-Server

/stop-Server

/uninitialize-Server


/disable-TransportServer

Applies To: Windows Server 2008,Windows Server 2008 R2

Disables all services for a Transport Server.

Syntax

Copy Code
WDSUTIL [Options] /Disable-TransportServer [/Server:<Server name>]

Parameters

Parameter | Description
[/Server:<Server name>] | Specifies the name of the Transport Server to be disabled. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If no Transport Server name is specified, the local server will be used.

Examples

To disable the server, type:

Copy Code
WDSUTIL /Disable-TransportServer
WDSUTIL /Verbose /Disable-TransportServer /Server:MyWDSServer

Additional references

Command-Line Syntax Key

/enable-TransportServer

/get-TransportServer

/set-TransportServer

/start-TransportServer

/stop-TransportServer


/disconnect-Client

Applies To: Windows Server 2008 R2,Windows Server 2008

Disconnects a client from a multicast transmission or namespace. Unless you specify /Force, the client will fall back to another transfer method (if it is supported by the client).

Syntax

Copy Code
WDSUTIL /Disconnect-Client /ClientId:<Client ID> [/Server:<Server name>] [/Force]

Parameters

Parameter Description

/ClientId:<Client ID>

Specifies the ID of the client to be disconnected. To view the ID of a client, type WDSUTIL /get-multicasttransmission /show:clients.

[/Server:<Server name>]

Specifies the name of the server. This can be the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server is used.

[/Force]

Stops the installation completely and does not use a fallback method. Note that Wdsmcast.exe does not support any fallback mechanism. If you do not use this option, the default behavior is as follows:

  • If you are using the Windows Deployment Services client, the client continues the installation by using unicasting.

  • If you are not using the Windows Deployment Services client, the installation fails.

Important
You should use this option with caution because the installation will fail and the computer could be left in an unusable state.

Examples

To disconnect a client, type:

Copy Code
WDSUTIL /Disconnect-Client /ClientId:1

To disconnect a client and force the installation to fail, type:

Copy Code
WDSUTIL /Disconnect-Client /Server:MyWDSServer /ClientId:1 /Force

Additional references

Command-Line Syntax Key


/enable

Applies To: Windows Server 2008,Windows Server 2008 R2

Enables all services for Windows Deployment Services.

Subcommands

Subommand | Description
/enable-Server | Enables all services on a specified Windows Deployment Services server (Deployment Server).
/enable-TransportServer | Enables all services on a specified Transport Server.


/enable-Server

Applies To: Windows Server 2008 R2,Windows Server 2008

Enables all services for Windows Deployment Services.

Syntax

Copy Code
WDSUTIL [Options] /Enable-Server [/Server:<Server name>]

Parameters

Parameter | Description
[/Server:<Server name>] | Specifies the name of the server. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server will be used.

Examples

To enable the services on the server, run one of the following:

Copy Code
WDSUTIL /Enable-Server
WDSUTIL /Verbose /Enable-Server /Server:MyWDSServer

Additional references

Command-Line Syntax Key

/disable-Server

/get-Server

/initialize-Server

/set-Server

/start-Server

/stop-Server

/uninitialize-Server


/enable-TransportServer

Applies To: Windows Server 2008,Windows Server 2008 R2

Enables all services for the Transport Server.

Syntax

Copy Code
WDSUTIL [Options] /Enable-TransportServer [/Server:<Server name>]

Parameters

Parameter | Description
[/Server:<Server name>] | Specifies the name of the Transport Server. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If no name is specified, the local server will be used.

Examples

To enable the services on the server, run one of the following:

Copy Code
WDSUTIL /Enable-TransportServer
WDSUTIL /Verbose /Enable-TransportServer /Server:MyWDSServer

Additional references

Command-Line Syntax Key

/disable-TransportServer

/get-TransportServer

/set-TransportServer

/start-TransportServer

/stop-TransportServer


/export-Image

Applies To: Windows Server 2008 R2,Windows Server 2008

Exports an existing image from the image store to another Windows Image (.wim) file.

Syntax

For boot images:

Copy Code
WDSUTIL [Options] /Export-Image /Image:<Image name> [/Server:<Server name>]
     /ImageType:Boot /Architecture:{x86 | ia64 | x64} [/Filename:<File name>]
     /DestinationImage
         /Filepath:<File path and name>
         [/Name:<Name>]
         [/Description:<Description>]
     [/Overwrite:{Yes | No}]

For install images:

Copy Code
WDSUTIL [Options] /Export-Image /Image:<Image name> [/Server:<Server name>]
     /ImageType:Install [/ImageGroup:<Image group name>]
     [/Filename:<File name>]
     /DestinationImage
         /Filepath:<File path and name>
         [/Name:<Name>]
         [/Description:<Description>]
     [/Overwrite:{Yes | No | Append}]

Parameters

Parameter Description

/Image:<Image name>

Specifies the name of the image to be exported.

[/Server:<Server name>]

Specifies the name of the server. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server will be used.

/ImageType:{Boot | Install}

Specifies the type of image to be exported.

[/ImageGroup:<Image group name>]

Specifies the image group containing the image to be exported. If no image group name is specified and only one image group exists on the server, that image group will be used by default. If more than one image group exists on the server, the image group must be specified.

/Architecture:{x86 | ia64 | x64}

Specifies the architecture of the image to be exported. Because it is possible to have the same image name for boot images in different architectures, specifying the architecture value ensures that the correct image will be returned.

[/Filename:<Filename>]

If the image cannot be uniquely identified by name, the file name must be specified.

/DestinationImage

Specifies the settings for the destination image. You can specify these settings using the following options:

  • /FilePath:<File path and name> - Specifies the full file path for the new image.

  • [/Name:<Name>] - Sets the display name of the image. If no name is specified, the display name of the source image will be used.

  • [/Description: <Description>] - Sets the description of the image.

[/Overwrite:{Yes | No | Append}]

Determines whether the file specified in the /DestinationImage option will be overwritten if an existing file with that name already exists at the /FilePath.

  • Yes causes the existing file to be overwritten.

  • No (the default option) causes an error to occur if a file with the same name already exists.

  • Append causes the generated image to be appended as a new image within the existing .wim file.

Examples

To export a boot image, type one of the following:

Copy Code
WDSUTIL /Export-Image /Image:"WinPE boot image" /ImageType:Boot /Architecture:x86 /DestinationImage /FilePath:"C:\temp\boot.wim"
WDSUTIL /Verbose /Progress /Export-Image /Image:"WinPE boot image" /Server:MyWDSServer /ImageType:Boot /Architecture:x64 /Filename:boot.wim
/DestinationImage /FilePath:"\\Server\Share\ExportImage.wim" /Name:"Exported WinPE image" /Description:"WinPE Image from WDS server" /Overwrite:Yes

To export an install image, type one of the following:

Copy Code
WDSUTIL /Export-Image /Image:"Windows Vista with Office" /ImageType:Install /DestinationImage /FilePath:"C:\Temp\Install.wim"
WDSUTIL /Verbose /Progress /Export-Image /Image:"Windows Vista with Office" /Server:MyWDSServer /ImageType:Install /ImageGroup:ImageGroup1
/Filename:install.wim /DestinationImage /FilePath:\\server\share\export.wim /Name:"Exported Windows image" /Description:"Windows Vista image from WDS server" /Overwrite:Append

Additional references

Command-Line Syntax Key

/add-Image

/copy-Image

/get-Image

/remove-Image

/replace-Image

/set-Image


/get

Applies To: Windows Server 2008,Windows Server 2008 R2

Retrieves properties or attributes about the specified object.

Subcommands

Subcommand | Description
/get-AllDevices | Displays information about all prestaged computers.
/get-AllImageGroups | Displays information about all image groups.
/get-AllImages | Displays information about all images.
/get-AllMulticastTransmissions | Displays the attributes of all multicast transmissions.
/get-AllNamespaces | Displays the attributes of all namespaces.
/get-AllServers | Displays information about all Windows Deployment Services servers.
/get-AutoAddDevices | Displays computers that are pending administrative approval on a specified server.
/get-Device | Displays the attributes of an pending computer.
/get-Image | Displays the attributes of an existing image.
/get-ImageFile | Displays information about images in a specified .wim file.
/get-ImageGroup | Displays information about a specified image group.
/get-MulticastTransmission | Displays the attributes of a specified multicast transmission.
/get-Namespace | Displays the attributes of a specified namespace.
/get-Server | Displays information about a specified Windows Deployment Services server.
/get-TransportServer | Displays information about a specified Transport Server.
/get-DriverPackage | Displays information about driver packages on a server.
/get-AllDriverGroups | Displays information about all the driver groups on server.
/get-DriverGroup | Displays information about driver groups on a server.
/get-AllDriverPackages | Displays information about all the driver packages on a server that match the specified search criteria.
/get-DriverPackageFile | Displays information about a driver package, including the drivers and files it contains.


/get-AllDevices

Applies To: Windows Server 2008 R2,Windows Server 2008

Displays the Windows Deployment Services properties of all prestaged computers. A prestaged computer is a physical computer that has been linked to a computer account in Active Directory Domain Services.

Syntax

Copy Code
WDSUTIL [Options] /Get-AllDevices [/Forest:{Yes | No}] [/ReferralServer:<Server name>]

Parameters

Parameter | Description
[/Forest:{Yes | No}] | Specifies whether Windows Deployment Services should return computers in the entire forest or the local domain. The default setting is No, meaning that only the computers in the local domain are returned.
[/ReferralServer:<Server name>] | Returns only those computers that are prestaged for the specified server.

Examples

To view all computers, type one of the following:

Copy Code
WDSUTIL /Get-AllDevices
WDSUTIL /Verbose /Get-AllDevices /Forest:Yes /ReferralServer:MyWDSServer

Additional references

Command-Line Syntax Key

/set-Device

/add-Device

/get-Device


/get-AllImageGroups

Applies To: Windows Server 2008,Windows Server 2008 R2

Retrieves information about all image groups on a server and all images in those image groups.

Syntax

Copy Code
WDSUTIL [Options] /Get-AllImageGroups [/Server:<Server name>] [/Detailed]

Parameters

Parameter | Description
[/Server:<Server name>] | Specifies the name of the server. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server will be used.
[/Detailed] | Returns the image metadata from each image. If this parameter is not used, the default behavior is to return only the image name, description, and file name for each image.

Examples

To view information about the image groups, type one of the following:

Copy Code
WDSUTIL /Get-AllImageGroups
WDSUTIL /Verbose /Get-AllImageGroups /Server:MyWDSServer /Detailed

Additional references

Command-Line Syntax Key

/add-ImageGroup

/get-ImageGroup

/remove-ImageGroup

/set-ImageGroup


/get-AllImages

Applies To: Windows Server 2008 R2,Windows Server 2008

Retrieves information about all images on a server.

Syntax

Copy Code
WDSUTIL /Get-AllImages [/Server:<Server name>] /Show:{Boot | Install | LegacyRis | All} [/Detailed]

Parameters

Parameter Description

[/Server:<Server name>]

Specifies the name of the server. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server will be used.

/Show: {Boot | Install | LegacyRis | All}
  • Boot returns only boot images.

  • Install returns install images as well as information about the image groups that contain them.

  • LegacyRis returns only Remote Installation Services (RIS) images.

  • All returns boot image information, install image information (including information about the image groups), and RIS image information.

[/Detailed]

Indicates that all image metadata from each image should be returned. If this option is not used, the default behavior is to return only the image name, description, and file name.

Examples

To view information about the images, type one of the following:

Copy Code
WDSUTIL /Get-AllImages /Show:Install
WDSUTIL /Verbose /Get-AllImages /Server:MyWDSServer /Show:All /Detailed

Additional references

Command-Line Syntax Key

/add-Image

/copy-Image

/export-Image

/remove-Image

/replace-Image

/set-Image


/get-AllMulticastTransmissions

Applies To: Windows Server 2008,Windows Server 2008 R2

Displays information about all multicast transmissions on a server.

Syntax

For Windows Server 2008:

Copy Code
WDSUTIL /Get-AllMulticastTransmissions [/Server:<Server name>] [/Show:Clients] [/ExcludeDeletePending]

For Windows Server 2008 R2:

Copy Code
WDSUTIL /Get-AllMulticastTransmissions [/Server:<Server name>] [/Show:{Boot | Install | All}] [/Details:Clients]  [/ExcludeDeletePending]

Parameters

Parameter Explanation

[/Server:<Server name>]

Specifies the name of the server. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server will be used.

[/Show]

Windows Server 2008

/Show:Clients - Displays information about client computers that are connected to the multicast transmissions.

Windows Server 2008 R2

Show: {Boot | Install | All} - The type of image to return. Boot returns only boot image transmissions. Install returns only install image transmissions. All returns both image types.

/Details:clients

Only supported for Windows Server 2008 R2. If present, clients that are connected to the transmission will be displayed.

[/ExcludeDeletePending]

Excludes any deactivated transmissions from the list.

Examples

To view information about all transmissions, type:

  • Windows Server 2008: WDSUTIL /Get-AllMulticastTransmissions

  • Windows Server 2008 R2: WDSUTIL /Get-AllMulticastTransmissions /Show:All

To view information about all transmissions except deactivated transmissions, type:

  • Windows Server 2008: WDSUTIL /Get-AllMulticastTransmissions /Server:MyWDSServer /Show:Clients /ExcludeDeletePending

  • Windows Server 2008 R2: WDSUTIL /Get-AllMulticastTransmissions /Server:MyWDSServer /Show:All /Details:Clients /ExcludeDeletePending

Additional references

Command-Line Syntax Key

/get-MulticastTransmission

/new-MulticastTransmission

/remove-MulticastTransmission

/start-MulticastTransmission


/get-AllNamespaces

Applies To: Windows Server 2008 R2,Windows Server 2008

Displays information about all namespaces on a server.

Syntax

Windows Server 2008:

Copy Code
WDSUTIL /Get-AllNamespaces [/Server:<Server name>] [/ContentProvider:<name>] [/Show:Clients] [/ExcludeDeletePending]

Windows Server 2008 R2:

Copy Code
WDSUTIL /Get-AllNamespaces [/Server:<Server name>] [/ContentProvider:<name>] [/Details:Clients] [/ExcludeDeletePending]

Parameters

Parameter | Windows Server 2008 | Windows Server 2008 R2
[/Server:<Server name>] | Specifies the name of the server. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server will be used. |
[/ContentProvider:<name>] | Displays the namespaces for the specified content provider only. |
[/Show:Clients] | Only supported for Windows Server 2008. Displays information about client computers that are connected to the namespace. |
[/Details:Clients] | Only supported for Windows Server 2008 R2. Displays information about client computers that are connected to the namespace. |
[/ExcludeDeletePending] | Excludes any deactivated transmissions from the list. |

Examples

To view all namespaces, type:

Copy Code
WDSUTIL /Get-AllNamespaces

To view all namespaces except those that are deactivated, type:

  • Windows Server 2008

    Copy Code
    WDSUTIL /Get-AllNamespaces /Server:MyWDSServer /ContentProvider:"MyContentProv" /Show:Clients /ExcludeDeletePending
  • Windows Server 2008 R2

    Copy Code
    WDSUTIL /Get-AllNamespaces /Server:MyWDSServer /ContentProvider:"MyContentProv" /Details:Clients /ExcludeDeletePending

Additional references

Command-Line Syntax Key

/new-Namespace

/remove-Namespace

/start-Namespace


/get-AllServers

Applies To: Windows Server 2008,Windows Server 2008 R2

Retrieves information about all Windows Deployment Services servers.

Note
This command may take an extended amount of time to complete if there are many Windows Deployment Services servers in your environment or if the network connection linking the servers is slow.

Syntax

Copy Code
WDSUTIL [Options] /Get-AllServers /Show:{Config | Images | All} [/Detailed] [/Forest:{Yes | No}]

Parameters

Parameter Description

/Show:{Config | Images | All}

Specifies what type of information to return.

  • Config returns server configuration information.

  • Images returns information about image groups, boot images, and installation images on the server.

  • All returns server configuration and image information.

[/Detailed]

When used in conjunction with the /Show:Images or /Show:All, returns all image metadata from each image. If the /Detailed option is not specified, the default behavior is to return the image name, description, and file name.

[/Forest:{Yes | No}]

Specifies whether to return information for the entire forest or the local domain. If a value for this option is not specified, the default behavior is to return the servers in the local domain.

Examples

To view information about all servers, type:

Copy Code
WDSUTIL /Get-AllServers /Show:Config

To view detailed information about all servers, type:

Copy Code
WDSUTIL /Verbose /Get-AllServers /Show:All /Detailed /Forest:Yes

Additional references

Command-Line Syntax Key


/get-AutoAddDevices

Applies To: Windows Server 2008 R2,Windows Server 2008

Displays all computers that are in the Auto-Add database on a Windows Deployment Services server.

Syntax

Copy Code
WDSUTIL [Options] /Get-AutoAddDevices [/Server:<Server name>] /DeviceType:{PendingDevices | RejectedDevices | ApprovedDevices}

Parameters

Parameter Description

[/Server:<Server name>]

Specifies the name of the server. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server will be used.

/DeviceType:{PendingDevices | RejectedDevices | ApprovedDevices}

Specifies the type of computer to return.

  • PendingDevices returns all computers in the database that have a status of pending.

  • RejectedDevices returns all computers in the database that have a status of rejected.

  • ApprovedDevices returns all computers in the database that have a status of approved.

Examples

To see all of the approved computers, type:

Copy Code
WDSUTIL /Get-AutoAddDevices /DeviceType:ApprovedDevices

To see all of the rejected computers, type:

Copy Code
WDSUTIL /Verbose /Get-AutoAddDevices /DeviceType:RejectedDevices /Server:MyWDSServer

Additional references

Command-Line Syntax Key

/delete-AutoAddDevices

/approve-AutoAddDevices

/reject-AutoAddDevices


/get-Device

Applies To: Windows Server 2008,Windows Server 2008 R2

Retrieves Windows Deployment Services information about a prestaged computer (that is, a physical computer that has been lined to a computer account in Active Directory Domain Services.

Syntax

Copy Code
WDSUTIL /Get-Device {/Device:<Device name> | /ID:<MAC or UUID>} [/Domain:<Domain>] [/Forest:{Yes | No}]

Parameters

Parameter Description

/Device:<Device name>

Specifies the name of the computer (SAMAccountName).

/ID:<MAC or UUID>

Specifies either the MAC address or the UUID (GUID) of the computer, as shown in the following examples. Note that a valid GUID must be in one of two formats —binary string or GUID string

  • Binary string: /ID:ACEFA3E81F20694E953EB2DAA1E8B1B6

  • MAC address: 00B056882FDC (no dashes) or 00-B0-56-88-2F-DC (with dashes)

  • GUID string: /ID:E8A3EFAC-201F-4E69-953-B2DAA1E8B1B6

[/Domain:<Domain>]

Specifies the domain to be searched for the prestaged computer. The default value for this parameter is the local domain.

[/Forest:{Yes | No}]

Specifies whether Windows Deployment Services should search the entire forest or the local domain. The default value is No, meaning that only the local domain will be searched.

Examples

To get information by using the computer name, type:

Copy Code
WDSUTIL /Get-Device /Device:Computer1

To get information by using the MAC address, type:

Copy Code
WDSUTIL /Verbose /Get-Device /ID:"00-B0-56-88-2F-DC" /Domain:MyDomain

To get information by using the GUID string, type:

Copy Code
WDSUTIL /Verbose /Get-Device /ID:E8A3EFAC-201F-4E69-953-B2DAA1E8B1B6 /Forest:Yes

Additional references

Command-Line Syntax Key

/set-Device

/add-Device

/get-AllDevices


/get-Image

Applies To: Windows Server 2008 R2,Windows Server 2008

Retrieves information about an image.

Syntax

For boot images:

Copy Code
WDSUTIL [Options] /Get-Image /Image:<Image name> [/Server:<Server name>] /ImageType:Boot /Architecture:{x86 | ia64 | x64} [/Filename:<File name>]

For install images:

Copy Code
WDSUTIL [Options] /Get-Image /Image:<Image name> [/Server:<Server name>] /ImageType:Install [/ImageGroup:<Image group name>] [/Filename:<File name>]

Parameters

Parameter | Description
/Image:<Image name> | Specifies the name of the image.
[/Server:<Server name>] | Specifies the name of the server. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server will be used.
/ImageType:{Boot | Install} | Specifies the type of image.
/Architecture:{x86 | ia64 | x64} | Specifies the architecture of the image. Because it is possible to have the same image name for boot images in different architectures, specifying the architecture value ensures that the correct image is returned.
[/Filename:<File name>] | If the image cannot be uniquely identified by name, you must use this option to specify the file name.
[/ImageGroup:<Image group name>] | Specifies the image group that contains the image. If no image group is specified and only one image group exists on the server, that group will be used. If more than one image group exists on the server, you must use this parameter to specify the image group.

Examples

To retrieve information about a boot image, type one of the following:

Copy Code
WDSUTIL /Get-Image /Image:"WinPE boot image" /ImageType:Boot /Architecture:x86
WDSUTIL /Verbose /Get-Image /Image:"WinPE boot image" /Server:MyWDSServer /ImageType:Boot /Architecture:x86 /Filename:boot.wim

To retrieve information about an install image, type one of the following:

Copy Code
WDSUTIL /Get-Image /Image:"Windows Vista with Office" /ImageType:Install
WDSUTIL /Verbose /Get-Image /Image:"Windows Vista with Office" /Server:MyWDSServer /ImageType:Install /ImageGroup:ImageGroup1 /Filename:install.wim

Additional references

Command-Line Syntax Key

/add-Image

/copy-Image

/export-Image

/remove-Image

/replace-Image

/set-Image


/get-ImageFile

Applies To: Windows Server 2008,Windows Server 2008 R2

Retrieves information about the images contained in a Windows Image (.wim) file.

Syntax

Copy Code
WDSUTIL [Options] /Get-ImageFile /ImageFile:<wim file path> [/Detailed]

Parameters

Parameter | Description
/ImageFile:<WIM file path> | Specifies the full path and file name of the .wim file.
[/Detailed] | Returns all image metadata from each image. If this option is not used, the default behavior is to return only the image name, description, and file name.

Examples

To view information about an image, type:

Copy Code
WDSUTIL /Get-ImageFile /ImageFile:"C:\temp\install.wim"

To view detailed information, type:

Copy Code
WDSUTIL /Verbose /Get-ImageFile /ImageFile:"\\Server\Share\My Folder \install.wim" /Detailed

Additional references

Command-Line Syntax Key


/get-ImageGroup

Applies To: Windows Server 2008 R2,Windows Server 2008

Retrieves information about an image group and the images within it.

Syntax

Copy Code
WDSUTIL [Options] /Get-ImageGroup /ImageGroup:<Image group name> [/Server:<Server name>] [/Detailed]

Parameters

Parameter | Description
/ImageGroup:<Image group name> | Specifies the name of the image group.
[/Server:<Server name>] | Specifies the name of the server. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server will be used.
[/Detailed] | Returns the image metadata for each image. If this parameter is not use, the default behavior is to return only the image name, description, and file name.

Examples

To view information about an image group, type:

Copy Code
WDSUTIL /Get-ImageGroup /ImageGroup:ImageGroup1

To view information including metadata, type:

Copy Code
WDSUTIL /Verbose /Get-ImageGroup /ImageGroup:ImageGroup1 /Server:MyWDSServer /Detailed

Additional references

Command-Line Syntax Key

/add-ImageGroup

/get-AllImageGroups

/remove-ImageGroup

/set-ImageGroup


/get-MulticastTransmission

Applies To: Windows Server 2008,Windows Server 2008 R2

Displays information about the multicast transmission for a specified image.

Syntax

Windows Server 2008

Copy Code
WDSUTIL [Options] /Get-MulticastTransmission /Image:<Image name> [/Server:<Server name>] /ImageType:Install [/ImageGroup:<Image group name>]
[/Filename:<File name>] [/Show:Clients]

Windows Server 2008 R2

For boot image transmissions:

Copy Code
WDSUTIL [Options] /Get-MulticastTransmission /Image:<Image name>
    [/Server:<Server name>]
    [/Details:Clients]
    /ImageType:Boot
    /Architecture:{x86 | ia64 | x64}
        [/Filename:<File name>]

For install image transmissions:

Copy Code
WDSUTIL [Options] /Get-MulticastTransmission /Image:<Image name>
         [/Server:<Server name>]
         [/Details:Clients]
         /ImageType:Install
     [/ImageGroup:<Image Group>]
     [/Filename:<File name>]

Parameters

Parameter | Description
/Image:<Image name> | Displays the multicast transmission that is associated with this image.
[/Server:<Server name>] | Specifies the name of the server. This can be the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server is used.
/ImageType:Install | Specifies the image type. Note that this option must be set to Install.
[/ImageGroup:<Image group name>] | Specifies the image group that contains the image. If no image group name is specified and only one image group exists on the server, that image group is used. If more than one image group exists on the server, you must use this option to specify an image group.
/Architecture:{x86 | ia64 | x64} | Specifies the architecture of the boot image that is associated with the transmission. Because it is possible to have the same image name for boot images in different architectures, you should specify the architecture to ensure that the correct image is used.
[/Filename:<File name>] | Specifies the file that contains the image. If the image cannot be uniquely identified by name, you must use this option to specify the file name.
[/Show:Clients] or [/Details:Clients] | Displays information about client computers that are connected to the multicast transmission.

Examples

Windows Server 2008

To view information about the transmission for an image named “Vista with Office,” type one of the following:

Copy Code
WDSUTIL /Get-MulticastTransmission /Image:"Vista with Office" /ImageType:Install
WDSUTIL /Get-MulticastTransmission /Server:MyWDSServer /Image:"Vista with Office" /ImageType:Install /ImageGroup:ImageGroup1 /Filename:install.wim /Show:Clients

Windows Server 2008 R2

To view information about the transmission for an image named “Vista with Office,” type one of the following:

Copy Code
WDSUTIL /Get-MulticastTransmission /Image:"Vista with Office"
 /ImageType:Install
Copy Code
WDSUTIL /Get-MulticastTransmission /Server:MyWDSServer /Image:"Vista with Office" /ImageType:Install /ImageGroup:ImageGroup1 /Filename:install.wim /Details:Clients
Copy Code
WDSUTIL /Get-MulticastTransmission /Server:MyWDSServer /Image:"X64 Boot Image" /ImageType:Boot /Architecture:x64 /Filename:boot.wim /Details:Clients

Additional references

Command-Line Syntax Key

/get-AllMulticastTransmissions

/new-MulticastTransmission

/remove-MulticastTransmission

/start-MulticastTransmission


/get-Namespace

Applies To: Windows Server 2008 R2,Windows Server 2008

Displays information about a custom namespace.

Syntax

Windows Server 2008 R2

Copy Code
WDSUTIL /Get-Namespace /Namespace:<Namespace name> [/Server:<Server name>] [/Show:Clients]

Windows Server 2008 R2

Copy Code
WDSUTIL /Get-Namespace /Namespace:<Namespace name> [/Server:<Server name>] [/Details:Clients]

Parameters

Parameter Description

/Namespace:<Namespace name>

Specifies the name of the namespace. Note that this is not the friendly name, and it must be unique.

  • Deployment Server: The syntax for namespace name is /Namspace:WDS:<ImageGroup>/<ImageName>/<Index>. For example: WDS:ImageGroup1/install.wim/1

  • Transport Server: This value should match the name given to the namespace when it was created on the server.

[/Server:<Server name>]

Specifies the name of the server. This can be the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server is used.

[/Show:Clients] or [/Details:Clients]

Displays information about client computers that are connected to the specified namespace.

Examples

To view information about a namespace, type:

Copy Code
WDSUTIL /Get-Namespace /Namespace:"Custom Auto 1"

To view information about a namespace and the clients that are connected, type one of the following:

  • Windows Server 2008: WDSUTIL /Get-Namespace /Server:MyWDSServer /Namespace:"Custom Auto 1" /Show:Clients

  • Windows Server 2008 R2: WDSUTIL /Get-Namespace /Server:MyWDSServer /Namespace:"Custom Auto 1" /Details:Clients

Additional references

Command-Line Syntax Key

/get-AllNamespaces

/new-Namespace

/remove-Namespace

/start-Namespace


/get-Server

Applies To: Windows Server 2008,Windows Server 2008 R2

Retrieves information from the specified Windows Deployment Services server.

Syntax

Copy Code
WDSUTIL [Options] /Get-Server [/Server:<Server name>] /Show:{Config | Images | All} [/Detailed]

Parameters

Parameter Description

[/Server:<Server name>]

Specifies the name of the server. This can be the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server is used.

/Show:{Config | Images | All}

Specifies the type of information to return.

  • Config returns configuration information.

  • Images returns information about image groups, boot images, and install images.

  • All returns configuration information and image information.

[/Detailed]

You can use this option with /Show:Images or /Show:All to indicate that all image metadata from each image should be returned. If the /Detailed option is not used, the default behavior is to return the image name, description, and file name.

Examples

To view information about the server, type:

Copy Code
WDSUTIL /Get-Server /Show:Config

To view detailed information about the server, type:

Copy Code
WDSUTIL /Verbose /Get-Server /Server:MyWDSServer /Show:All /Detailed

Additional references

Command-Line Syntax Key

/disable-Server

/enable-Server

/initialize-Server

/set-Server

/start-Server

/stop-Server

/uninitialize-Server


/get-TransportServer

Applies To: Windows Server 2008 R2,Windows Server 2008

Displays information about a specified Transport Server.

Syntax

Copy Code
WDSUTIL [Options] /Get-TransportServer [/Server:<Server name>] /Show:{Config}

Parameters

Parameter | Description
[/Server:<Server name>] | Specifies the name of the server. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server will be used.
/Show:{Config} | Returns configuration information about the specified Transport Server.

Examples

To view information about the server, type:

Copy Code
WDSUTIL /Get-TransportServer /Show:Config

To view configuration information, type:

Copy Code
WDSUTIL /Get-TransportServer /Server:MyWDSServer /Show:Config

Additional references

Command-Line Syntax Key

/disable-TransportServer

/enable-TransportServer

/set-TransportServer

/start-TransportServer

/stop-TransportServer


/initialize-Server

Applies To: Windows Server 2008,Windows Server 2008 R2

Configures a Windows Deployment Services server for initial use after the server role has been installed. After you run this command, you should use the /add-Image command to add images to the server.

Syntax

Copy Code
WDSUTIL /Initialize-Server [/Server:<Server name>] /RemInst:<Full path> [/Authorize]

Parameters

Parameter | Description
[/Server:<Server name>] | Specifies the name of the server. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server will be used.
/RemInst:"<Full path>" | Specifies the full path and name of the RemoteInstall folder. If the specified folder does not already exist, this option will create it when the command is run. You should always enter a local path, even in the case of a remote computer. For example: D:\RemoteInstall.
[/Authorize] | Authorizes the server in Dynamic Host Control Protocol (DHCP). This option is necessary only if DHCP rogue detection is enabled, meaning that the Windows Deployment Services PXE server must be authorized in DHCP before client computers can be serviced. Note that DHCP rogue detection is disabled by default.

Examples

To initialize the server and set the RemoteInstall shared folder to the F: drive, type.

Copy Code
WDSUTIL /Initialize-Server /RemInst:"F:\RemoteInstall"

To initialize the server and set the RemoteInstall shared folder to the C: drive, type.

Copy Code
WDSUTIL /Verbose /Progress /Initialize-Server /Server:MyWDSServer /RemInst:"C:\RemoteInstall"

Additional references

Command-Line Syntax Key

/disable-Server

/enable-Server

/get-Server

/set-Server

/start-Server

/stop-Server

/uninitialize-Server


/new

Applies To: Windows Server 2008 R2,Windows Server 2008

Creates capture and discover images, multicast transmissions, and namespaces.

Subcommands

Subcommand | Description
/new-CaptureImage | Creates a new capture image from an existing boot image.
/new-DiscoverImage | Creates a new discover image from an existing boot image.
/new-MulticastTransmission | Creates a new multicast transmission.
/new-Namespace | Creates a new namespace.


/new-CaptureImage

Applies To: Windows Server 2008,Windows Server 2008 R2

Creates a new capture image from an existing boot image. Capture images are boot images that start the Windows Deployment Services capture utility instead of starting Setup. When you boot a reference computer (that has been prepared with Sysprep) into a capture image, a wizard creates an install image of the reference computer and saves it as a Windows Image (.wim) file. You can also add the image to media (such as a CD, DVD, or USB drive), and then boot a computer from that media. After you create the install image, you can add the image to the server for PXE boot deployment. For more information, see Creating Images (http://go.microsoft.com/fwlink/?LinkId=115311).

Syntax

Copy Code
WDSUTIL [Options] /New-CaptureImage [/Server:<Server name>]
     /Image:<Image name>
     /Architecture:{x86 | ia64 | x64}
     [/Filename:<File name>]
     /DestinationImage
        /FilePath:<File path and name>
        [/Name:<Name>]
        [/Description:<Description>]
        [/Overwrite:{Yes | No | Append}]
        [/UnattendFilePath:<File path>]

Parameters

Parameter Description

[/Server:<Server name>]

Specifies the name of the server. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server will be used.

/Image:<Image name>

Specifies the name of the source boot image.

/Architecture: {x86 | ia64 | x64}

Specifies the architecture of the image to use. Because you can have the same image name for different boot images in different architectures, specifying this ensures the correct image is used.

[/Filename: <Filename>]

If the image cannot be uniquely identified by name, you must use this option to specify the file name.

/DestinationImage

Specifies the settings for the destination image. You specify the settings using the following options:

  • /FilePath: <File path and name> Sets the full file path for the new capture image.

  • [/Name: <Name>] - Sets the display name of the image. If no display name is specified, the display name of the source image will be used.

  • [/Description: <Description>] - Sets the description of the image.

  • [/Overwrite: {Yes | No | Append}] - Determines whether the file specified in /DestinationImage should be overwritten if another file with that name already exists at the /FilePath. Yes overwrites the existing file. No (default) causes an error to occur if another file with the same name already exists. Append attaches the generated image as a new image within the existing .wim file.

  • [/UnattendFilePath: <File path>] - Sets the full path and name for the unattended image capture file.

Examples

To create a capture image and name it WinPECapture.wim, type:

Copy Code
WDSUTIL /New-CaptureImage /Image:"WinPE boot image" /Architecture:x86 /DestinationImage /FilePath:"C:\Temp\WinPECapture.wim"

To create a capture image and apply the specified settings, type:

Copy Code
WDSUTIL /Verbose /Progress /New-CaptureImage /Server:MyWDSServer /Image:"WinPE boot image" /Architecture:x64 /Filename:boot.wim
/DestinationImage /FilePath:"\\Server\Share\WinPECapture.wim" /Name:"New WinPE image" /Description:"WinPE image with capture utility" /Overwrite:No /UnattendFilePath:"\\Server\Share\WDSCapture.inf"

Additional references

Command-Line Syntax Key


/new-DiscoverImage

Applies To: Windows Server 2008 R2,Windows Server 2008

Creates a new discover image from an existing boot image. Discover images are boot images that force the Setup.exe program to start in Windows Deployment Services mode and then discover a Windows Deployment Services server. Typically these images are used to deploy images to computers that are not capable of booting to PXE. For more information, see Creating Images (http://go.microsoft.com/fwlink/?LinkId=115311).

Syntax

Copy Code
WDSUTIL [Options] /New-DiscoverImage [/Server:<Server name>]
     /Image:<Image name>
     /Architecture:{x86 | ia64 | x64}
     [/Filename:<File name>]
     /DestinationImage
         /FilePath:<File path and name>
         [/Name:<Name>]
         [/Description:<Description>]
         [/WDSServer:<Server name>]
         [/Overwrite:{Yes | No | Append}]

Parameters

Parameter Description

[/Server:<Server name>]

Specifies the name of the server. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server will be used.

/Image:<Image name>

Specifies the name of the source boot image.

/Architecture:{x86 | ia64 | x64}

Specifies the architecture of the image to be returned. Because it is possible to have the same image name for different boot images in different architectures, specifying the architecture value ensures that WDSUTIL returns the correct image.

[/Filename:<File name>]

If the image cannot be uniquely identified by name, you must use this option to specify the file name.

/DestinationImage

Specifies the settings for the destination image. You can specify the settings using the following options:

  • /FilePath:< File path and name> - Sets full file path for the new image.

  • [/Name:<Name>] - Sets the display name of the image. If no display name is specified, the display name of the source image will be used.

  • [/Description: <Description>] - Sets the description of the image.

  • [/WDSServer: <Server name>] - Specifies the name of the server that all clients who boot from the specified image should contact to download the install image. By default, all clients who boot this image will discover a valid Windows Deployment Services server. Using this option bypasses the discovery functionality and forces the booted client to contact the specified server.

  • [/Overwrite:{Yes | No | Append}] - Determines whether the file specified in /DestinationImage should be overwritten if another file with that name already exists at the /FilePath. Yes overwrites the existing file. No (default) causes an error to occur if another file with the same name already exists. Append attaches the generated image as a new image within the existing .wim file.

Examples

To create a discover image out of boot image, and name it WinPEDiscover.wim, type:

Copy Code
WDSUTIL /New-DiscoverImage /Image:"WinPE boot image" /Architecture:x86 /DestinationImage /FilePath:"C:\Temp\WinPEDiscover.wim"

To create a discover image out of boot image, and name it WinPEDiscover.wim with the specified settings, type:

Copy Code
WDSUTIL /Verbose /Progress /New-DiscoverImage /Server:MyWDSServer
/Image:"WinPE boot image" /Architecture:x64 /Filename:boot.wim /DestinationImage /FilePath:"\\Server\Share\WinPEDiscover.wim"
/Name:"New WinPE image" /Description:"WinPE image for WDS Client discovery" /Overwrite:No

Additional references

Command-Line Syntax Key


/new-MulticastTransmission

Applies To: Windows Server 2008,Windows Server 2008 R2

Creates a new multicast transmission for an image. This command is equivalent to creating a transmission by using the Windows Deployment Services MMC snap-in (right-click the Multicast Transmissions node, and then click Create Multicast Transmission). You should use this command when you have both the Deployment Server role service and the Transport Server role service installed (which is the default installation). If you have only the Transport Server role service installed, use /new-Namespace.

Syntax

For install images transmissions:

Copy Code
WDSUTIL [Options] /New-MulticastTransmission /Image:<Image name>
        [/Server:<Server name>]
        /FriendlyName:<Friendly name>
        [/Description:<Description>]
        /TransmissionType: {AutoCast | ScheduledCast}
            [/Time:<YYYY/MM/DD:hh:mm>]
            [/Clients:<Num of Clients>]
        /ImageType:Install
        [/ImageGroup:<Image Group>]
        [/Filename:<File name>]

For boot image transmissions (only supported for Windows Server 2008 R2):

Copy Code
WDSUTIL [Options] /New-MulticastTransmission /Image:<Image name>
        [/Server:<Server name>]
        /FriendlyName:<Friendly name>
        [/Description:<Description>]
        /TransmissionType: {AutoCast | ScheduledCast}
            [/Time:<YYYY/MM/DD:hh:mm>]
            [/Clients:<Num of Clients>]
        /ImageType:Boot
        /Architecture:{x86 | ia64 | x64}
        [/Filename:<File name>]

Parameters

Parameter Description

/Image:<Image name>

Specifies the name of the image to be transmitted using multicasting.

[/Server:<Server name>]

Specifies the name of the server. This can be the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server will be used.

/FriendlyName:<Friendly name>

Specifies the friendly name of the transmission.

[/Description:<Description>]

Specifies the description of the transmission.

/ImageType:{Boot|Install}

Specifies the type of image to be transmitted using multicasting. Note Boot is only supported for Windows Server 2008 R2.

[/ImageGroup:<Image group name>]

Specifies the image group that contains the image. If no image group name is specified and only one image group exists on the server, that image group is used. If more than one image group exists on the server, you must use this option to specify the image group name.

[/Filename:<File name>]

Specifies the file name. If the source image cannot be uniquely identified by name, you must use this option to specify the file name.

/TransmissionType:{AutoCast | ScheduledCast}

Specifies whether to start the transmission automatically (AutoCast) or based on the specified start criteria (ScheduledCast).

  • Auto-Cast. This transmission type indicates that as soon as an applicable client requests an install image, a multicast transmission of the selected image begins. As other clients request the same image, they are joined to the transmission that is already started.

  • Scheduled-Cast. This transmission type sets the start criteria for the transmission based on the number of clients that are requesting an image and/or a specific day and time. You can specify the following options:

    • [/Time: <time>] - Sets the time that the transmission should start by using the following format: YYYY/MM/DD:hh:mm.

    • [/Clients: <Number of clients>] - Sets the minimum number of clients to wait for before the transmission starts.

/Architecture:{x86 | ia64 | x64}

Specifies the architecture of the boot image to transmit using multicasting. Because it is possible to have the same name for boot images of different architectures, you should specify the architecture to ensure the correct image is used.

[/Filename:<File name>]

Specifies the file name. If the source image cannot be uniquely identified by name, you must specify the file name.

Examples

To create an Auto-Cast transmission of a boot image in Windows Server 2008 R2, type:

Copy Code
WDSUTIL /New-MulticastTransmission /FriendlyName:"WDS Boot Transmission"
/Image:"X64 Boot Image" /ImageType:Boot /Architecture:x64 /TransmissionType:AutoCast

To create an Auto-Cast transmission of an install image, type:

Copy Code
WDSUTIL /New-MulticastTransmission /FriendlyName:"WDS AutoCast Transmission"
/Image:"Vista with Office" /ImageType:Install /TransmissionType:AutoCast

To create a Scheduled-Cast transmission of an install image, type:

Copy Code
WDSUTIL /New-MulticastTransmission /FriendlyName:"WDS SchedCast Transmission" /Server:MyWDSServer /Image:"Vista with Office" /ImageType:Install
/TransmissionType:ScheduledCast /Time:"2006/11/20:17:00" /Clients:100

Additional references

Command-Line Syntax Key

/get-AllMulticastTransmissions

/get-MulticastTransmission

/remove-MulticastTransmission

/start-MulticastTransmission


/new-Namespace

Applies To: Windows Server 2008 R2,Windows Server 2008

Creates and configures a new namespace. You should use this option when you have only the Transport Server role service installed. If you have both the Deployment Server role service and the Transport Server role service installed (which is the default), use /new-MulticastTransmission. Note that you must register the content provider before you use this option.

Syntax

Copy Code
WDSUTIL [Options] /New-Namespace [/Server:<Server name>]
     /FriendlyName:<Friendly name>
     [/Description:<Description>]
     /Namespace:<Namespace name>
     /ContentProvider:<Name>
     [/ConfigString:<Configuration string>]
     /NamespaceType: {AutoCast | ScheduledCast}
         [/Time:<YYYY/MM/DD:hh:mm>]
         [/Clients:<Number of clients>]

Parameters

Parameter Description

[/Server:<Server name>]

Specifies the name of the server. This can be the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server is used.

/FriendlyName:<Friendly name>

Specifies the friendly name of the namespace.

[/Description:<Description>]

Sets the description of the namespace.

/Namespace:<Namespace name>

Specifies the name of the namespace. Note that this is not the friendly name, and it must be unique.

  • Deployment Server role service: The syntax for this option is /Namespace:WDS:<Image group>/<Image name>/<Index>. For example: WDS:ImageGroup1/install.wim/1

  • Transport Server role service: This value should match the name given when the namespace was created on the server.

/ContentProvider:<Name>]

Specifies the name of the content provider that will provide content for the namespace.

[/ConfigString:<Configuration string>]

Specifies the configuration string for the content provider.

/NamespaceType: {AutoCast | ScheduledCast}

Specifies the settings for the transmission. You specify the settings using the following options:

  • [/Time: <time>] - Sets the time that the transmission should start by using the following format: YYYY/MM/DD:hh:mm. This option applies only to Scheduled-Cast transmissions.

  • [/Clients: <Number of clients>] - Sets the minimum number of clients to wait for before the transmission starts. This option applies only to Scheduled-Cast transmissions.

Examples

To create an Auto-Cast namespace, type:

Copy Code
WDSUTIL /New-Namespace /FriendlyName:"Custom AutoCast Namespace" /Namespace:"Custom Auto 1" /ContentProvider:MyContentProvider /NamespaceType:AutoCast

To create a Scheduled-Cast namespace, type:

Copy Code
WDSUTIL /New-Namespace /Server:MyWDSServer /FriendlyName:"Custom Scheduled Namespace" /Namespace:"Custom Auto 1" /ContentProvider:MyContentProvider
/NamespaceType:ScheduledCast /Time:"2006/11/20:17:00" /Clients:20

Additional references

Command-Line Syntax Key

/get-AllNamespaces

/remove-Namespace

/start-Namespace


/reject-AutoAddDevices

Applies To: Windows Server 2008 R2,Windows Server 2008

Rejects computers that are pending administrative approval. When the Auto-Add policy is enabled, administrative approval is required before unknown computers (those that are not prestaged) can install an image. You can enable this policy using the PXE Response tab of the server’s properties page.

Syntax

Copy Code
WDSUTIL [Options] /Reject-AutoAddDevices [/Server:<Server name>] /RequestId:<Request ID or ALL>

Parameters

Parameter | Description
[/Server:<Server name>] | Specifies the name of the server. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server will be used.
/RequestId:<Request ID | ALL> | Specifies the request ID assigned to the pending computer. To reject all pending computers, specify ALL.

Examples

To reject a single computer, type:

Copy Code
WDSUTIL /Reject-AutoAddDevices /RequestId:12

To reject all computers, type:

Copy Code
WDSUTIL /Verbose /Reject-AutoAddDevices /Server:MyWDSServer /RequestId:ALL

Additional references

Command-Line Syntax Key

/approve-AutoAddDevices

/delete-AutoAddDevices

/get-AutoAddDevices


/remove

Applies To: Windows Server 2008,Windows Server 2008 R2

Subcommands

Subommand | Description
/remove-Image | Removes a boot or install image from the server.
/remove-ImageGroup | Removes an image group from the server.
/remove-MulticastTransmission | Disables multicast transmission of an image.
/remove-Namespace | Removes a namespace from the server.
/remove-DriverGroupPackage | Removes a driver package from a driver group on a server.
/remove-DriverGroupPackages | Removes driver packages from a driver group on a server.
/remove-DriverPackage | Removes a driver package from a server.
/remove-DriverPackages | Removes driver packages from a server.
/remove-DriverGroup | Removes a driver group from a server.
/Remove-DriverGroupFilter | Removes a filter rule from a driver group on a server.


/remove-Image

Applies To: Windows Server 2008 R2,Windows Server 2008

Deletes an image from a server.

Syntax

For boot images:

Copy Code
WDSUTIL [Options] /Remove-Image /Image:<Image name> [/Server:<Server name>] /ImageType:Boot /Architecture:{x86 | ia64 | x64} [/Filename:<Filename>]

For install images:

Copy Code
WDSUTIL [Options] /Remove-Image /Image:<Image name> [/Server:<Server name>] /ImageType:Install [/ImageGroup:<Image group name>] [/Filename:<Filename>]

Parameters

Parameter | Description
/Image:<Image name> | Specifies the name of the image.
[/Server:<Server name>] | Specifies the name of the server. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server will be used.
/ImageType:{Boot | Install} | Specifies the type of image.
/Architecture:{x86 | ia64 | x64} | Specifies the architecture of the image. Because it is possible to have the same image name for different boot images in different architectures, specifying the architecture value ensures that the correct image will be removed.
[/ImageGroup:<Image group name>] | Specifies the image group that contains the image. If no image group name is specified and only one image group exists on the server, that image group will be used. If more than one image group exists, you must use this option to specify the image group.
[/Filename:<File name>] | If the image cannot be uniquely identified by name, you must use this option to specify the file name.

Examples

To remove a boot image, type:

Copy Code
WDSUTIL /Remove-Image /Image:"WinPE Boot Image" /ImageType:Boot /Architecture:x86
Copy Code
WDSUTIL /Verbose /Remove-Image /Image:"WinPE Boot Image" /Server:MyWDSServer /ImageType:Boot /Architecture:x64 /Filename:boot.wim

To remove an install image, type:

Copy Code
WDSUTIL /Remove-Image /Image:"Windows Vista with Office" /ImageType:Install
Copy Code
WDSUTIL /Verbose /Remove-Image /Image:"Windows Vista with Office" /Server:MyWDSServer /ImageType:Install /ImageGroup:ImageGroup1 /Filename:install.wim

Additional references

Command-Line Syntax Key

/add-Image

/copy-Image

/export-Image

/get-Image

/replace-Image

/set-Image


/remove-ImageGroup

Applies To: Windows Server 2008,Windows Server 2008 R2

Removes an image group from a server.

Syntax

Copy Code
WDSUTIL [Options] /Remove-ImageGroup /ImageGroup:<Image group name> [/Server:<Server name>]

Parameters

Parameter | Description
/ImageGroup:<Image group name> | Specifies the name of the image group to be removed
[/Server:<Server name>] | Specifies the name of the server. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server will be used.

Examples

To remove the image group, type one of the following:

Copy Code
WDSUTIL /Remove-ImageGroup /ImageGroup:ImageGroup1
WDSUTIL /Verbose /Remove-ImageGroup /ImageGroup:"My Image Group" /Server:MyWDSServer

Additional references

Command-Line Syntax Key

/add-ImageGroup

/get-AllImageGroups

/get-ImageGroup

/set-ImageGroup


/remove-Namespace

Applies To: Windows Server 2008,Windows Server 2008 R2

Removes a custom namespace.

Syntax

Copy Code
WDSUTIL /Remove-Namespace /Namespace:<Namespace name> [/Server:<Server name>] [/Force]

Parameters

Parameter Description

/Namespace:<Namespace name>

Specifies the name of the namespace. This is not the friendly name, and it must be unique.

  • Deployment Server role service: The syntax for namespace name is /Namespace:WDS:<ImageGroup>/<ImageName>/<Index>. For example: WDS:ImageGroup1/install.wim/1

  • Transport Server role service: This value must match the name given to the namespace when it was created on the server.

[/Server:<Server name>]

Specifies the name of the server. This can be the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server is used.

[/Force]

Removes the namespace immediately and terminates all clients. Note that unless you specify /Force, existing clients can complete the transfer, but new clients are not able to join.

Examples

To stop a namespace (current clients can complete the transfer but new clients are not able to join), type:

Copy Code
WDSUTIL /Remove-Namespace /Namespace:"Custom Auto 1"

To force termination of all clients, type:

Copy Code
WDSUTIL /Remove-Namespace /Server:MyWDSServer /Namespace:"Custom Auto 1" /Force

Additional references

Command-Line Syntax Key

/get-AllNamespaces

/new-Namespace

/start-Namespace


/remove-MulticastTransmission

Applies To: Windows Server 2008 R2,Windows Server 2008

Disables multicast transmitting for an image. Unless you specify /Force, existing clients will complete the image transfer but new clients will not be allowed to join.

Syntax

Windows Server 2008

Copy Code
WDSUTIL /Remove-MulticastTransmission /Image:<Image name> [/Server:<Server name>] /ImageType:Install [/ImageGroup:<Image Group>] [/Filename:<File name>] [/Force]

Windows Server 2008 R2

For boot images:

Copy Code
WDSUTIL [Options] /Remove-MulticastTransmission /Image:<Image name>
\x20    [/Server:<Server name>]
\x20    /ImageType:Boot
\x20    /Architecture:{x86 | ia64 | x64}
\x20    [/Filename:<File name>]

For install images:

Copy Code
WDSUTIL [Options] /Remove-MulticastTransmission /Image:<Image name>
        [/Server:<Server name>]
        /ImageType:Install
        [/ImageGroup:<Image Group
        [/Filename:<File name>]

Parameters

Parameter | Description
/Image:<Image name> | Specifies the name of the image.
[/Server:<Server name>] | Specifies the name of the server. This can be the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server is used.
/ImageType:{Install|Boot} | Specifies the image type. Note that this option must be set to Install for Windows Server 2008.
/Architecture:{x86 | ia64 | x64} | Specifies the architecture of the boot image that is associated with the transmission to start. Because it is possible to have the same image name for boot images in different architectures, you should specify the architecture to ensure that the correct transmission is used.
[/ImageGroup:<Image group name>] | Specifies the image group that contains the image. If no image group name is specified and only one image group exists on the server, that image group is used. If more than one image group exists on the server, you must use this option to specify the image group name.
[/Filename:<File name>] | Specifies the file name. If the source image cannot be uniquely identified by name, you must use this option to specify the file name.
[/Force] | Removes the transmission and terminates all clients. Unless you specify a value for the /Force option, existing clients can complete the image transfer but new clients are not able to join.

Examples

To stop a namespace (current clients will complete the transmission, but new clients will not be able to join), type:

Copy Code
WDSUTIL /Remove-MulticastTransmission /Image:"Vista with Office"
/ImageType:Install
Copy Code
WDSUTIL /Remove-MulticastTransmission /Image:"x64 Boot Image"
/ImageType:Boot /Architecture:x64

To force termination of all clients, type:

Copy Code
WDSUTIL /Remove-MulticastTransmission /Server:MyWDSServer
/Image:"Vista with Office" /ImageType:Install /ImageGroup:ImageGroup1
/Filename:install.wim /Force

Additional references

Command-Line Syntax Key

/get-AllMulticastTransmissions

/get-MulticastTransmission

/new-MulticastTransmission

/start-MulticastTransmission


/replace-Image

Applies To: Windows Server 2008 R2,Windows Server 2008

Replaces an existing image with a new version of that image.

Syntax

For boot images:

Copy Code
WDSUTIL [Options] /Replace-Image /Image:<Image name> [/Server:<Server name>]
     /ImageType:Boot
     /Architecture:{x86 | ia64 | x64}
     [/Filename:<File name>]
     /ReplacementImage
         /ImageFile:<wim file path>
         [/Name:<Image name>]
         [/Description:<Image description>]

For install images:

Copy Code
WDSUTIL [Options] /Replace-Image /Image:<Image name> [/Server:<Server name>]
     /ImageType:Install
     [/ImageGroup:<Image group name>]
     [/Filename:<File name>]
     /ReplacementImage
         /ImageFile:<wim file path>
         [/SourceImage:<Source image name>]
         [/Name:<Image name>]
         [/Description:<Image description>]

Parameters

Parameter Description

/Image:<Image name>

Specifies the name of the image to be replaced.

[/Server:<Server name>]

Specifies the name of the server. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server will be used.

/ImageType:{Boot | Install}

Specifies the type of image to be replaced.

/Architecture:{x86 | ia64 | x64}

Specifies the architecture of the image to be replaced. Because it is possible to have the same image name for different boot images in different architectures, specifying the architecture ensures that the correct image is replaced.

[/Filename:<File name>]

If the image cannot be uniquely identified by name, you must use this option to specify the file name.

/ReplacementImage

Specifies the settings for the replacement image. You set these settings using the following options:

  • /ImageFile: <file path> - Specifies the name and location (full path) of the new .wim file.

  • [/SourceImage: <image name>] - Specifies the image to be used if the .wim file contains multiple images. This option applies only to install images.

  • [/Name:<Image name>] – Sets the display name of the image.

  • [/Description:<Image description>] - Sets the description of the image.

Examples

To replace a boot image, type one of the following:

Copy Code
WDSUTIL /Replace-Image /Image:"WinPE Boot Image" /ImageType:Boot /Architecture:x86 /ReplacementImage /ImageFile:"C:\MyFolder\Boot.wim"
WDSUTIL /Verbose /Progress /Replace-Image /Image:"WinPE Boot Image" /Server:MyWDSServer /ImageType:Boot /Architecture:x64 /Filename:boot.wim
/ReplacementImage /ImageFile:\\MyServer\Share\Boot.wim /Name:"My WinPE Image" /Description:"WinPE Image with drivers"

To replace an install image, type one of the following:

Copy Code
WDSUTIL /Replace-Image /Image:"Windows Vista Home" /ImageType:Install /ReplacementImage /ImageFile:"C:\MyFolder\Install.wim"
WDSUTIL /Verbose /Progress /Replace-Image /Image:"Windows Vista Pro" /Server:MyWDSServer /ImageType:Install /ImageGroup:ImageGroup1
/Filename:Install.wim /ReplacementImage /ImageFile:\\MyServer\Share \Install.wim /SourceImage:"Windows Vista Ultimate" /Name:"Windows Vista Desktop" /Description:"Windows Vista Ultimate with standard business applications."

Additional references

Command-Line Syntax Key

/add-Image

/copy-Image

/export-Image

/get-Image

/replace-Image

/set-Image


/set

Applies To: Windows Server 2008,Windows Server 2008 R2

Sets properties and attributes for Windows Deployment Services servers, prestaged computers, images, image groups, and Transport Servers.

Subcommands

Subcommand | Description
/set-Device | Changes the attributes of a prestaged computer. A prestaged computer is a computer that has been linked to a computer account object in Active Directory Domain Servers (AD DS). Prestaged clients are also called known computers.
/set-Image | Changes the attributes of an existing image.
/set-ImageGroup | Changes the attributes of an existing image group.
/set-Server | Configures the settings for a Windows Deployment Services server.
/set-TransportServer | Configures the settings for a Transport Server.
/set-DriverPackage | Renames and/or enable/disable a driver package on a server.
/set-DriverGroup | Sets the properties of an existing driver group on a server.
/Set-DriverGroupFilter | Adds or removes an existing driver group filter from a driver group.


/set-Device

Applies To: Windows Server 2008 R2,Windows Server 2008

Changes the attributes of a prestaged computer. A prestaged computer is a computer that has been linked to a computer account object in Active Directory Domain Servers (AD DS). Prestaged clients are also called known computers. You can configure properties on the computer account to control the installation for the client. For example, you can configure the network boot program and the unattend file that the client should receive, as well as the server from which the client should download the network boot program.

Syntax

Copy Code
WDSUTIL [Options] /Set-Device /Device:<Device name> [/ID:<UUID | MAC Address>] [/ReferralServer:<Server name>] [/BootProgram:<Relative path>]
[/WdsClientUnattend:<Relative path>] [/User:<Domain\User | User@Domain>] [/JoinRights:{JoinOnly | Full}] [/JoinDomain:{Yes | No}] [/BootImagePath:<Relative path>] [/Domain:<Domain>] [/ResetAccount]

Parameters

Parameter Description

/Device:<computer name>

Specifies the name of the computer (SAM-Account-Name).

[/ID:<UUID | MAC address>]

Specifies either the GUID/UUID or the MAC address of the computer. This value must be in one of the following three formats:

  • Binary string: /ID:ACEFA3E81F20694E953EB2DAA1E8B1B6

  • GUID/UUID string: /ID:E8A3EFAC-201F-4E69-953E-B2DAA1E8B1B6

  • MAC address: 00B056882FDC (no dashes) or 00-B0-56-88-2F-DC (with dashes)

[/ReferralServer:<Server name>]

Specifies the name of the server to be contacted to download the network boot program and boot image using Trivial File Transfer Protocol (TFTP).

[/BootProgram:<Relative path>]

Specifies the relative path from the RemoteInstall folder to the network boot program that the specified computer will receive. For example: boot\x86\pxeboot.com

[/WdsClientUnattend:<Relative path>]

Specifies the relative path from the RemoteInstall folder to the unattend file that automates the installation screens for the Windows Deployment Services client.

[/User:<Domain\User | User@Domain>]

Sets permissions on the computer account object to give the specified user the necessary rights to join the computer to the domain.

[/JoinRights:{JoinOnly | Full}]

Specifies the type of rights to be assigned to the user.

  • JoinOnly requires the administrator to reset the computer account before the user can join the computer to the domain.

  • Full gives full access to the user, including the right to join the computer to the domain.

[/JoinDomain:{Yes | No}]

Specifies whether or not the computer should be joined to the domain as this computer account during a Windows Deployment Services installation. The default setting is Yes.

[/BootImagePath:<Relative path>]

Specifies the relative path from the RemoteInstall folder to the boot image that the computer will use.

[/Domain:<Domain>]

Specifies the domain to be searched for the prestaged computer. The default value is the local domain.

[/ResetAccount]

Resets the permissions on the specified computer so that anyone with the appropriate permissions can join the domain by using this account.

Examples

To set the network boot program and referral server for a computer, type:

Copy Code
WDSUTIL /Set-Device /Device:Computer1 /ReferralServer:MyWDSServer
/BootProgram:boot\x86\pxeboot.n12

To set various settings for a computer, type:

Copy Code
WDSUTIL /Verbose /Set-Device /Device:Computer2 /ID:00-B0-56-88-2F-DC /WdsClientUnattend:WDSClientUnattend\unattend.xml
/User:Domain\user /JoinRights:JoinOnly /JoinDomain:No /BootImagePath:boot\x86\images\boot.wim /Domain:NorthAmerica /ResetAccount

Additional references

Command-Line Syntax Key

/add-Device

/get-AllDevices

/get-Device


/set-Image

Applies To: Windows Server 2008,Windows Server 2008 R2

Changes the attributes of an image.

Syntax

For boot images:

Copy Code
WDSUTIL /Set-Image /Image:<Image name> [/Server:<Server name>] /ImageType:Boot /Architecture:{x86 | ia64 | x64} [/Filename:<File name>] [/Name:<Name>]
[/Description:<Description>] [/Enabled:{Yes | No}]

For install images:

Copy Code
WDSUTIL /Set-Image /Image:<Image name> [/Server:<Server name>]
     /ImageType:Install [/ImageGroup:<Image group name>]
     [/Filename:<File name>]
     [/Name:<Name>]
     [/Description:<Description>]
     [/UserFilter:<SDDL>]
     [/Enabled:{Yes | No}]
     [/UnattendFile:<Unattend file path>]
         [/OverwriteUnattend:{Yes | No}]

Parameters

Parameter | Description
/Image:<Image name> | Specifies the name of the image.
[/Server:<Server name>] | Specifies the name of the server. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server will be used.
/ImageType:{Boot | Install} | Specifies the type of image.
/Architecture:{x86 | ia64 | x64} | Specifies the architecture of the image. Because you can have the same image name for different boot images in different architectures, specifying the architecture ensures that the correct image is modified.
[/Filename:<File name>] | If the image cannot be uniquely identified by name, you must use this option to specify the file name.
[/Name] | Specifies the name of the image.
[/Description:<Description>] | Sets the description of the image.
[/Enabled:{Yes | No}] | Enables or disables the image.
[/ImageGroup:<Image group name>] | Specifies the image group that contains the image. If no image group name is specified and only one image group exists on the server, that image group will be used. If more than one image group exists on the server, you must use this option to specify the image group.
[/UserFilter:<SDDL>] | Sets the user filter on the image. The filter string must be in Security Descriptor Definition Language (SDDL) format. Note that, unlike the /Security option for image groups, this option only restricts who can see the image definition, and not the actual image file resources. To restrict access to the file resources, and therefore access to all images within an image group, you will need to set security for the image group itself.
[/UnattendFile:<Unattend file path>] | Sets the full path to the unattend file to be associated with the image. For example: D:\Files\Unattend\Img1Unattend.xml
[/OverwriteUnattend:{Yes | No}] | You can specify /Overwrite to overwrite the unattend file if there is already an unattend file associated with the image. Note that the default setting is No.

Examples

To set values for a boot image, type one of the following:

Copy Code
WDSUTIL /Set-Image /Image:"WinPE boot image" /ImageType:Boot /Architecture:x86 /Description:"New description"

WDSUTIL /Verbose /Set-Image /Image:"WinPE boot image" /Server:MyWDSServer /ImageType:Boot /Architecture:x86 /Filename:boot.wim
/Name:"New Name" /Description:"New Description" /Enabled:Yes

To set values for an install image, type one of the following:

Copy Code
WDSUTIL /Set-Image /Image:"Windows Vista with Office" /ImageType:Install /Description:"New description"

WDSUTIL /Verbose /Set-Image /Image:"Windows Vista with Office" /Server:MyWDSServer /ImageType:Install /ImageGroup:ImageGroup1
/Filename:install.wim /Name:"New name" /Description:"New description" /UserFilter:"O:BAG:DUD:AI(A;ID;FA;;;SY)(A;ID;FA;;;BA)(A;ID;0x1200a9;;;AU)" /Enabled:Yes /UnattendFile:\\server\share\unattend.xml /OverwriteUnattend:Yes

Additional references

Command-Line Syntax Key

/add-Image

/copy-Image

/export-Image

/get-Image

/remove-Image

/replace-Image


/set-ImageGroup

Applies To: Windows Server 2008 R2,Windows Server 2008

Changes the attributes of an image group.

Syntax

Copy Code
WDSUTIL [Options] /Set-ImageGroup /ImageGroup:<Image group name> [/Server:<Server name>] [/Name:<New image group name>] [/Security:<SDDL>]

Parameters

Parameter | Description
/ImageGroup:<Image group name> | Specifies the name of the image group.
[/Server:<Server name>] | Specifies the name of the server. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If not specified, the local server will be used.
[/Name:<New image group name>] | Specifies the new name of the image group.
[/Security:<SDDL>] | Specifies the new Security Descriptor of the image group, in security descriptor definition language (SDDL) format.

Examples

To set the name for an image group, type:

Copy Code
WDSUTIL /Set-ImageGroup /ImageGroup:ImageGroup1 /Name:"New Image Group Name"

To specify various settings for an image group, type:

Copy Code
WDSUTIL /Verbose /Set-ImageGroup /ImageGroup:ImageGroup1 /Server:MyWDSServer /Name:"New Image Group Name"
/Security:"O:BAG:S-1-5-21-2176941838-3499754553-4071289181-513 D:AI(A;ID;FA;;;SY)(A;OICIIOID;GA;;;SY)(A;ID;FA;;;BA)(A;OICIIOID;GA;;;BA) (A;ID;0x1200a9;;;AU)(A;OICIIOID;GXGR;;;AU)"

Additional references

Command-Line Syntax Key

/add-ImageGroup

/get-AllImageGroups

/get-ImageGroup

/remove-ImageGroup


/set-Server

Applies To: Windows Server 2008,Windows Server 2008 R2

Configures the settings for a Windows Deployment Services server.

Syntax

Copy Code
WDSUTIL [Options] /Set-Server [/Server:<Server name>]
    [/Authorize:{Yes | No}]
    [/RogueDetection:{Yes | No}]
    [/AnswerClients:{All | Known | None}]
    [/ResponseDelay:<Time in seconds>]
    [/AllowN12ForNewClients:{Yes | No}]
    [/ArchitectureDiscovery:{Yes | No}]
    [/ResetBootProgram:{Yes | No}]
    [/DefaultX86X64ImageType:{x86 | x64 | Both}]
    [/UseDhcpPorts:{Yes | No}]
    [/DhcpOption60:{Yes | No}]
    [/RpcPort:<Port number>]
    [/PxePromptPolicy
        [/Known:{OptIn | NoPrompt | OptOut}]
        [/New:{OptIn | NoPrompt | OptOut}]
    [/BootProgram:<Relative path>]
         /Architecture:{x86 | ia64 | x64}
    [/N12BootProgram:<Relative path>]
         /Architecture:{x86 | ia64 | x64}
    [/BootImage:<Relative path>]
         /Architecture:{x86 | ia64 | x64}
    [/PreferredDC:<DC Name>]
    [/PreferredGC:<GC Name>]
    [/PrestageUsingMAC:{Yes | No}]
    [/NewMachineNamingPolicy:<Policy>]
    [/NewMachineOU]
         [/Type:{ServerDomain | UserDomain | UserOU | Custom}]
         [/OU:<Domain name of OU>]
    [/DomainSearchOrder:{GCOnly | DCFirst}]
    [/NewMachineDomainJoin:{Yes | No}]
    [/OSCMenuName:<Name>]
    [/WdsClientLogging]
         [/Enabled:{Yes | No}]
         [/LoggingLevel:{None | Errors | Warnings | Info}]
    [/WdsUnattend]
         [/Policy:{Enabled | Disabled}]
         [/CommandlinePrecedence:{Yes | No}]
         [/File:<Path>]
             /Architecture:{x86 | ia64 | x64}
    [/AutoAddPolicy]
         [/Policy:{AdminApproval | Disabled}]
         [/PollInterval:{Time in seconds}]
         [/MaxRetry:{Retries}]
         [/Message:<Message>]
         [/RetentionPeriod]
             [/Approved:<Time in days>]
             [/Others:<Time in days>]
    [/AutoAddSettings]
         /Architecture:{x86 | ia64 | x64}
         [/BootProgram:<Relative path>]
         [/ReferralServer:<Server name>
         [/WdsClientUnattend:<Relative path>]
         [/BootImage:<Relative path>]
         [/User:<Owner>]
         [/JoinRights:{JoinOnly | Full}]
         [/JoinDomain:{Yes | No}]
    [/BindPolicy]
         [/Policy:{Include | Exclude}]
         [/Add]
              /Address:<IP or MAC address>
              /AddressType:{IP | MAC}
         [/Remove]
              /Address:<IP or MAC address>
              /AddressType:{IP | MAC}
    [/RefreshPeriod:<Time in seconds>]
    [/BannedGuidPolicy]
         [/Add]
              /Guid:<GUID>
         [/Remove]
             /Guid:<GUID>
    [/BcdRefreshPolicy]
         [/Enabled:{Yes | No}]
         [/RefreshPeriod:<Time in minutes>]

    [/Transport]
         [/ObtainIpv4From:{Dhcp | Range}]
             [/Start:<Start IP Address>]
             [/End:<End IP Address>]
         [/ObtainIpv6From:Range]
             [/Start:<Start IP Address>]
             [/End:<End IP Address>]
         [/StartPort:<Start Port>
             [/EndPort:<Start Port>
        [/Profile:{10Mbps | 100Mbps | 1Gbps | Custom}]
        [/MulticastSessionPolicy]
             [/Policy:{None | AutoDisconnect | Multistream}]
                 [/Threshold:<Speed in KBps>]
                 [/StreamCount:{2 | 3}]
                 [/Fallback:{Yes | No}]
        [/ForceNative]

Parameters

Parameter Description

[/Server:<Server name>]

Specifies the name of the server. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server will be used.

[/Authorize:{Yes | No}]

Specifies whether to authorize this server in Dynamic Host Control Protocol (DHCP).

[/RogueDetection:{Yes | No}]

Enables or disables DHCP rogue detection.

[/AnswerClients:{All | Known | None}]

Specifies which clients this server will answer. If you set this value to Known, a computer must be prestaged in Active Directory Domain Services (AD DS) before it will be answered by the Windows Deployment Services server.

[/ResponseDelay:<Time in seconds>]

The amount of time that the server will wait before answering a booting client. This setting does not apply to prestaged computers.

[/AllowN12ForNewClients:{Yes | No}]

For Windows Server 2008, specifies that unknown clients will not have to press the F12 key to initiate a network boot. Known clients will receive the boot program specified for the computer or, if not specified, the boot program specified for the architecture.

For Windows Server 2008 R2, this option has been replaced with the following command: WDSUTIL /Set-Server /PxePromptPolicy /New:NoPrompt

[/ArchitectureDiscovery:{Yes | No}]

Enables or disables architecture discovery. This facilitates the discovery of x64-based clients that do not broadcast their architecture correctly.

[/ResetBootProgram:{Yes | No}]

Determines whether the boot path will be erased for a client that has just booted without requiring an F12 key press.

[/DefaultX86X64ImageType: {x86 | x64 | Both}]

Controls which boot images will be shown to x64-based clients.

[/UseDhcpPorts:{Yes | No}]

Specifies whether or not the PXE server should attempt to bind to the DHCP port, TCP port 67. If DHCP and Windows Deployment Services are running on the same computer, you should set this option to No to enable the DHCP server to utilize the port, and set the /DhcpOption60 parameter to Yes. The default setting for this value is Yes.

[/DhcpOption60:{Yes | No}]

Specifies whether DHCP option 60 should be configured for PXE support. If DHCP and Windows Deployment Services are running on the same server, set this option to Yes and set the /UseDhcpPorts option to No. The default setting for this value is No.

[/RpcPort:<Port number>]

Specifies the TCP port number to be used to service client requests.

[/PxePromptPolicy]

Configures how known (prestaged) and new clients initiate a PXE boot. This option only applies to Windows Server 2008 R2. You set the settings using the following options:

  • [/Known:{OptIn|OptOut|NoPrompt}] - Sets the policy for prestaged clients.

  • [/New:{OptIn|OptOut|NoPrompt}] - Sets the policy for new clients.

OptIn means the client needs to press a key in order to PXE boot, otherwise it will fall back to the next boot device.

NoPrompt means the client will always PXE Boot.

OptOut means the client will PXE boot unless the Esc key is pressed.

[/BootProgram:<Relative path>] /Architecture:{x86 | ia64 | x64}

Specifies the relative path to the boot program in the RemoteInstall folder (for example, boot\x86\pxeboot.n12), and specifies the architecture of the boot program.

[/N12BootProgram:<Relative path>] /Architecture:{x86 | ia64 | x64}

Specifies the relative path to the boot program that does not require pressing the F12 key (for example, boot\x86\pxeboot.n12), and specifies the architecture of the boot program.

[/BootImage:<Relative path>] /Architecture:{x86 | ia64 | x64}

Specifies the relative path to the boot image that booting clients should receive, and specifies the architecture of the boot image. You can specify this for each architecture.

[/PreferredDC:<DC Name>]

Specifies the name of the domain controller that Windows Deployment Services should use. This can be either the NetBIOS name or the FQDN.

[/PreferredGC:<GC Name>]

Specifies the name of the global catalog server that Windows Deployment Services should use. This can be either the NetBIOS name or the FQDN.

[/PrestageUsingMAC:{Yes | No}]

Specifies whether Windows Deployment Services, when creating computer accounts in AD DS, should use the MAC address rather than the GUID/UUID to identify the computer.

[/NewMachineNamingPolicy:<Policy>]

Specifies the format to use when generating computer names for clients. For information about the format to use for <policy>, right-click the server in the MMC snap-in, click Properties, and view the Directory Services tab. For example, /NewMachineNamingPolicy: %61Username%#.

[/NewMachineOU]

Used to specify the location in AD DS where client computer accounts will be created. You specify the location using the following options.

  • [/Type: ServerDomain | UserDomain | UserOU | Custom ] – Specifies the type of location. ServerDomain creates accounts in the same domain as the Windows Deployment Services server. UserDomain creates accounts in the same domain as the user performing the installation. UserOU creates accounts in the organizational unit of the user performing the installation. Custom allows you to specify a custom location (you must also specify a value for /OU with this option).

  • [/OU:<Domain name of OU>] - If you specify Custom for the /Type option, this option specifies the organizational unit where computer accounts should be created.

[/DomainSearchOrder:{GCOnly | DCFirst}]

Specifies the policy for searching computer accounts in AD DS (global catalog or domain controller).

[/NewMachineDomainJoin:{Yes | No}]

Specifies whether or not a computer that is not already prestaged in AD DS should be joined to the domain during installation. The default setting is Yes.

[/WdsClientLogging]

Specifies the logging level for the server.

  • [/Enabled:{Yes | No}] - Enables or disables logging of Windows Deployment Services client actions.

  • [/LoggingLevel: {None | Errors | Warnings | Info} - Sets the logging level. None is equivalent to disabling logging. Errors is the lowest level of logging and indicates that only errors will be logged. Warnings includes both warnings and errors. Info is the highest level of logging and includes errors, warnings, and informational events.

[/WdsUnattend]

These settings control the unattended installation behavior of Windows Deployment Services client. You set the settings using the following options:

  • [/Policy:{Enabled | Disabled}] - Specifies whether or not unattended installation is used.

  • [/CommandlinePrecedence: {Yes | No}] - Specifies whether an Autounattend.xml file (if present on the client) or an unattended setup file that was passed directly to the Windows Deployment Services client with the /Unattend option will be used instead of an image unattend file during a client installation. The default setting is No.

  • [/File:<Relative path> /Architecture:{x86 | ia64 | x64}] - Specifies the file name, path, and architecture of the unattend file.

[/AutoAddPolicy]

These settings control the Auto-Add policy. You define the settings using the following options:

  • [/Policy: {AdminApproval | Disabled}] - AdminApprove causes all unknown computers to be added to a pending queue, where the administrator can then review the list of computers and approve or reject each request, as appropriate. Disabled indicates that no additional action is taken when an unknown computer attempts to boots to the server.

  • [/PollInterval:{Time in seconds}] - Specifies the interval (in seconds) at which the network boot program should poll the Windows Deployment Services server.

  • [/MaxRetry: <Number>] - Specifies the number of times the network boot program should poll the Windows Deployment Services server. This value, along with /PollInterval, dictates how long the network boot program will wait for an administrator to approve or reject the computer before timing out. For example, a MaxRetry value of 10 and a PollInterval value of 60 would indicate that the client should poll the server 10 times, waiting 60 seconds between tries. Therefore, the client would time out after 10 minutes (10 x 60 seconds = 10 minutes).

  • [/Message: <Message>] - Specifies the message that is displayed to the client on the network boot program dialog page.

  • [/RetentionPeriod] - Specifies the number of days a computer can be in a pending state before being automatically purged.

  • [/Approved: <Time in days>] - Specifies the retention period for approved computers. You must use this parameter with the /RetentionPeriod option.

  • [/Others: <Time in days>] - Specifies the retention period for unapproved computers (rejected or pending). You must use this parameter with the /RetentionPeriod option.

[/AutoAddSettings]

Specifies the default settings to be applied to each computer. You define the settings using the following options:

  • /Architecture: {x86 | ia64 | x64} - Specifies the architecture.

  • [/BootProgram: <Relative path>] - Specifies the boot program sent to the approved computer. If no boot program is specified, the default for the architecture of the computer (as specified on the server) will be used.

  • [/WdsClientUnattend: <Relative path>] - Sets the relative path to the unattend file that the approved client should receive.

  • [/ReferralServer: <Server name>] - Specifies the Windows Deployment Services server that the client will use to download images.

  • [/BootImage: <Relative path>] - Specifies the boot image that the approved client will receive.

  • [/User: <Domain\User | User@Domain>] - Sets permissions on the computer account object to give the specified user the necessary rights to join the computer to the domain.

  • [/JoinRights: {JoinOnly | Full}] - Specifies the type of rights to be assigned to the user. JoinOnly requires the administrator to reset the computer account before the user can join the computer to the domain. Full gives full access to the user, including the right to join the computer to the domain.

  • [/JoinDomain: {Yes | No}] - Specifies whether or not the computer should be joined to the domain as this computer account during a Windows Deployment Services installation. The default setting is Yes.

[/BindPolicy]

Configures the network interfaces for the PXE provider to listen on. You define the policy using the following options:

  • [/Policy: {Include | Exclude}] - Sets the interface bind policy to include or exclude the addresses on the interface list.

  • [/Add] - Adds an interface to the list. You must also specify /AddressType and /Address.

  • [/Remove] - Removes an interface from the list. You must also specify /AddressType and /Address.

  • /Address:<IP or MAC address> - Specifies the IP or MAC address of the interface to add or remove.

  • /AddressType: {IP | MAC} - Indicates the type of address specified in the /Address option.

[/RefreshPeriod: <seconds>]

Specifies how often (in seconds) the server will refreshes its settings.

[/BannedGuidPolicy]

Manages the list of banned GUIDs using the following options:

  • [/Add] /Guid:<GUID> - Adds the specified GUID to the list of banned GUIDs. Any client with this GUID will be identified by its MAC address instead.

  • [/Remove] /Guid:<GUID> - Removes the specified GUID from the list of banned GUIDs.

[/BcdRefreshPolicy]

Configures the settings for refreshing BCD files using the following options:

  • [/Enabled:{Yes | No}] - Specifies the BCD refreshing policy. When /Enabled is set to Yes, BCD files are refreshed at the specified time interval.

  • [/RefreshPeriod:<Time in minutes>] - Specifies the time interval at which BCD files are refreshed.

[/Transport]

Configures the following options:

  • [/ObtainIpv4From: {Dhcp | Range}] - Specifies the source of IPv4 addresses.

    • [/Start: <Starting Ipv4 address>] - Specifies the start of the IP address range. This option is required and valid only if /ObtainIpv4From is set to Range

    • [/End: <Ending Ipv4 address>] - Specifies the end of the IP address range. This option is required and valid only if /ObtainIpv4From is set to Range.

  • [/ObtainIpv6From:Range] [/Start:<Start IP Address>] [/End:<End IP Address>] –Specifies the source of IPv6 addresses. This option only applies to Windows Server 2008 R2 and the only supported value is Range.

  • [/StartPort: <Starting port>] - Specifies the start of the port range.

  • [/EndPort: <Ending port>] - Specifies the end of the port range.

  • [/Profile: {10Mbps | 100Mbps | 1Gbps | Custom}] - Specifies the network profile to be used. This option is only supported for servers running Windows Server 2008.

  • [/MulticastSessionPolicy]– Configures the transfer settings for multicast transmissions. This command is only available for Windows Server 2008 R2.

    • [/Policy:{None | AutoDisconnect | Multistream}] - Determines how to handle slow clients. None means to keep all clients in one session at the same speed. AutoDisconnect means that any clients that drop below the specified /Threshold will be disconnected. Multistream means clients will be separated into multiple sessions as specified by /StreamCount.

    • [/Threshold:<Speed in KBps>] - For /Policy:AutoDisconnect, this option sets the minimum transfer rate in KBps. Clients that drop below this rate will be disconnected from multicast transmissions.

    • [/StreamCount:{2 | 3}] [/Fallback:{Yes | No}] - For /Policy:Multistream, this option determines the number of sessions. 2 means two sessions (fast and slow) 3 means three sessions (slow, medium, fast).

    • [/Fallback:{Yes | No}] - Determines whether clients that are disconnected will continue the transfer using another method (if supported by the client). If you are using the WDS client, the computer will fallback to unicasting. Wdsmcast.exe does not support a fallback mechanism. This option also applies to clients that do not support Multistream. In that case, the computer will fall back to another method instead of moving to a slower transfer session.

Examples

To set the server to answer only known clients, with a response delay of 4 minutes, type:

Copy Code
WDSUTIL /Set-Server /AnswerClients:Known /ResponseDelay:4

To set the boot program and architecture for the server, type:

Copy Code
WDSUTIL /Set-Server /BootProgram:boot\x86\pxeboot.n12 /Architecture:x86

To enable logging on the server, type:

Copy Code
WDSUTIL /Set-Server /WdsClientLogging /Enabled:Yes /LoggingLevel:Warnings

To enable unattend on the server, as well as the architecture and the client unattend file, type:

Copy Code
WDSUTIL /Set-Server /WdsUnattend /Policy:Enabled /File:WDSClientUnattend \unattend.xml /Architecture:x86

To set the Pre-Boot Execution Environment (PXE) server to attempt to bind to TCP ports 67 and 60, type:

Copy Code
WDSUTIL /Set-server /UseDhcpPorts:No /DhcpOption60:Yes

Additional references

Command-Line Syntax Key

/disable-Server

/enable-Server

/get-Server

/initialize-Server

/start-Server

/stop-Server

/uninitialize-Server


/set-TransportServer

Applies To: Windows Server 2008 R2,Windows Server 2008

Sets configuration settings for a Transport Server.

Syntax

Copy Code
WDSUTIL [Options] /Set-TransportServer [/Server:<Server name>]
     [/ObtainIpv4From:{Dhcp | Range}]
        [/Start:<Starting IP address>]
        [/End:<Ending IP address>]
     [/ObtainIpv6From:Range]\n\
        [/Start:<Start IP Address>]\n\
        [/End:<End IP Address>]
     [/StartPort:<Starting port>
        [/EndPort:<Starting port>
     [/Profile:{10Mbps | 100Mbps | 1Gbps | Custom}]
     [/MulticastSessionPolicy]
             [/Policy:{None | AutoDisconnect | Multistream}]
                 [/Threshold:<Speed in KBps>]
                 [/StreamCount:{2 | 3}]
                 [/Fallback:{Yes | No}]

Parameters

Parameter Description

[/Server:<Server name>]

Specifies the name of the Transport Server. This can be the NetBIOS name or the fully qualified domain name (FQDN). If no Transport Server name is specified, the local server is used.

[/ObtainIpv4From:{Dhcp | Range}]

Sets the source of the IPv4 addresses as follows:

  • [/Start: <IP address>] Sets the start of the IP address range. This is required and valid only if this option is set to Range.

  • [/End: <IP address>] Sets the end of the IP address range. This is required and valid only if this option is set to Range.

  • [/StartPort: <port>] Sets the start of the port range.

  • [/EndPort: <port>] Sets the end of the port range.

[/ObtainIpv6From:Range]

Specifies the source of IPv6 addresses. This option only applies to Windows Server 2008 R2 and the only supported value is Range.

  • [/Start: <IP address>] Sets the start of the IP address range. This is required and valid only if this option is set to Range.

  • [/End: <IP address>] Sets the end of the IP address range. This is required and valid only if this option is set to Range.

  • [/StartPort: <port>] Sets the start of the port range.

  • [/EndPort: <port>] Sets the end of the port range.

[/Profile: {10Mbps | 100Mbps | 1Gbps | Custom}]

Specifies the network profile to be used. This option is only available for servers running Windows Server 2008 or Windows Server 2003.

[/MulticastSessionPolicy]

Configures the transfer settings for multicast transmissions. This command is only available for Windows Server 2008 R2.

  • [/Policy:{None | AutoDisconnect | Multistream}] Determines how to handle slow clients. None means to keep all clients in one session at the same speed. AutoDisconnect means that any clients that drop below the specified /Threshold are disconnected. Multistream means clients will be separated into multiple sessions as specified by /StreamCount.

  • [/Threshold:<Speed in KBps>] Sets the minimum transfer rate in KBps for /Policy:AutoDisconnect. Clients that drop below this rate are disconnected from multicast transmissions.

  • [/StreamCount:{2 | 3}] [/Fallback:{Yes | No}] Determines the number of sessions for /Policy:Multistream. 2 means two sessions (fast and slow), and 3 means three sessions (slow, medium, fast).

  • [/Fallback:{Yes | No}] Determines whether clients that are disconnected will continue the transfer by using another method (if supported by the client). If you are using the WDS client, the computer will fall back to unicasting. Wdsmcast.exe does not support a fallback mechanism. This option also applies to clients that do not support Multistream. In that case, the computer will fall back to another method instead of moving to a slower transfer session.

Examples

To set the IPv4 address range for the server, type:

Copy Code
WDSUTIL /Set-TransportServer /ObtainIpv4From:Range /Start:239.0.0.1 /End:239.0.0.100

To set the IPv4 address range, port range, and profile for the server, type:

Copy Code
WDSUTIL /Set-TransportServer /Server:MyWDSServer /ObtainIpv4From:Range /Start:239.0.0.1 /End:239.0.0.100 /StartPort:12000 /EndPort:50000 /Profile:10mbps

Additional references

Command-Line Syntax Key

/disable-TransportServer

/enable-TransportServer

/get-TransportServer

/start-TransportServer

/stop-TransportServer


/start

Applies To: Windows Server 2008,Windows Server 2008 R2

Starts the multicast transmission, namespace, Transport Server or all services on the Windows Deployment Services server.

Subcommands

Subcommand | Description
/start-MulticastTransmission | Starts a transmission.
/start-Namespace | Starts a namespace.
/start-Server | Starts all services on a Windows Deployment Services server.
/start-TransportServer | Starts all services on a Transport Server.


/start-MulticastTransmission

Applies To: Windows Server 2008 R2,Windows Server 2008

Starts a Scheduled-Cast transmission of an image.

Syntax

Windows Server 2008

Copy Code
WDSUTIL /Start-MulticastTransmission /Image:<Image name> [/Server:<Server name>]/ImageType:Install [/ImageGroup:<Image group name>] [/Filename:<File name>]

Windows Server 2008 R2

For boot images:

Copy Code
WDSUTIL [Options] /Start-MulticastTransmission /Image:<Image name>
        [/Server:<Server name>]
        /ImageType:Boot
        /Architecture:{x86 | ia64 | x64}
        [/Filename:<File name>]

For install images:

Copy Code
WDSUTIL [Options] /Start-MulticastTransmission /Image:<Image name>
        [/Server:<Server name>]
        /ImageType:Install
        [/ImageGroup:<Image Group>]
        [/Filename:<File name>]

Parameters

Parameter | Description
/Image:<Image name> | Specifies the name of the image.
[/Server:<Server name>] | Specifies the name of the server. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server will be used.
/ImageType:{Install|Boot} | Specifies the image type. Note that this option must be set to Install for Windows Server 2008.
/Architecture:{x86 | ia64 | x64} | The architecture of the boot image that is associated with the transmission to start. Since it is possible to have the same image name for boot images in different architectures, you should specify the architecture to ensure that the correct transmission is used.
[/ImageGroup:<Image group name>] | Specifies the image group of the image. If no image group name is specified and only one image group exists on the server, that image group will be used. If more than one image group exists on the server, you must use this option to specify the image group name.
[/Filename:<File name>] | Specifies the name of the file that contains the image. If the image cannot be uniquely identified by name, you must use this option to specify the file name.

Examples

To start a multicast transmission, type one of the following:

Copy Code
WDSUTIL /Start-MulticastTransmission /Image:"Vista with Office"
/ImageType:Install
WDSUTIL /Start-MulticastTransmission /Server:MyWDSServer /Image:"Vista with Office" /ImageType:Install /ImageGroup:ImageGroup1 /Filename:install.wim

To start a boot image multicast transmission for Windows Server 2008 R2, type:

Copy Code
WDSUTIL /Start-MulticastTransmission /Server:MyWDSServer /Image:"X64 Boot Image" /ImageType:Boot /Architecture:x64
/Filename:boot.wim\n\

Additional references

Command-Line Syntax Key

/get-AllMulticastTransmissions

/get-MulticastTransmission

/new-MulticastTransmission

/remove-MulticastTransmission


/start-Namespace

Applies To: Windows Server 2008,Windows Server 2008 R2

Starts a Scheduled-Cast namespace.

Syntax

Copy Code
WDSUTIL /Start-Namespace /Namespace:<Namespace name> [/Server:<Server name>]

Parameters

Parameter Description

/Namespace:<Namespace name>

Specifies the name of the namespace. Note that this is not the friendly name, and it must be unique.

  • Deployment Server: The syntax for namespace name is /Namspace:WDS:<Image group>/<Image name>/<Index>. For example: WDS:ImageGroup1/install.wim/1

  • Transport Server: This name must match the name given to the namespace when it was created on the server.

[/Server:<Server name>]

Specifies the name of the server. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server will be used.

Examples

To start a namespace, type one of the following:

Copy Code
WDSUTIL /Start-Namespace /Namespace:"Custom Auto 1"
WDSUTIL /Start-Namespace /Server:MyWDSServer /Namespace:"Custom Auto 1"

Additional references

Command-Line Syntax Key

/get-AllNamespaces

/new-Namespace

/remove-Namespace


/start-Server

Applies To: Windows Server 2008 R2,Windows Server 2008

Starts all services for a Windows Deployment Services server.

Syntax

Copy Code
WDSUTIL [Options] /Start-Server [/Server:<Server name>]

Parameters

Parameter | Description
[/Server:<Server name>] | Specifies the name of the server to be started. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server will be used.

Examples

To start the server, type one of the following:

Copy Code
WDSUTIL /Start-Server
WDSUTIL /Verbose /Start-Server /Server:MyWDSServer

Additional references

Command-Line Syntax Key

/disable-Server

/enable-Server

/get-Server

/initialize-Server

/set-Server

/stop-Server

/uninitialize-Server


/start-TransportServer

Applies To: Windows Server 2008,Windows Server 2008 R2

Starts all services for a Transport Server.

Syntax

Copy Code
WDSUTIL [Options] /Start-TransportServer [/Server:<Server name>]

Parameters

Parameter | Description
[/Server:<Server name>] | Specifies the name of the Transport Server. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server will be used.

Examples

To start the server, type one of the following:

Copy Code
WDSUTIL /Start-TransportServer
WDSUTIL /Verbose /Start-TransportServer /Server:MyWDSServer

Additional references

Command-Line Syntax Key

/disable-TransportServer

/enable-TransportServer

/get-TransportServer

/set-TransportServer

/stop-TransportServer


/stop

Applies To: Windows Server 2008 R2,Windows Server 2008

Stops services for Windows Deployment Services.

Subcommands

Subcommand | Description
/stop-Server | Stops all services on a Windows Deployment Services server (Deployment Server).
/stop-TransportServer | Stops all services on a Transport Server.


/stop-Server

Applies To: Windows Server 2008,Windows Server 2008 R2

Stops all services on a Windows Deployment Services server.

Syntax

Copy Code
WDSUTIL [Options] /Stop-Server [/Server:<Server name>]

Parameters

Parameter | Description
[/Server:<Server name>] | Specifies the name of the server. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server will be used.

Examples

To stop the services, type one of the following:

Copy Code
WDSUTIL /Stop-Server
WDSUTIL /Verbose /Stop-Server /Server:MyWDSServer

Additional references

Command-Line Syntax Key

/disable-Server

/enable-Server

/get-Server

/initialize-Server

/set-Server

/start-Server

/uninitialize-Server


/stop-TransportServer

Applies To: Windows Server 2008 R2,Windows Server 2008

Stops all services on a Transport Server.

Syntax

Copy Code
WDSUTIL [Options] /Stop-TransportServer [/Server:<Server name>]

Parameters

Parameter | Description
[/Server:<Server name>] | Specifies the name of the Transport Server. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If no Transport Server is specified, the local server will be used.

Examples

To stop the services, type one of the following:

Copy Code
WDSUTIL /Stop-TransportServer
WDSUTIL /Verbose /Stop-TransportServer /Server:MyWDSServer

Additional references

Command-Line Syntax Key

/disable-TransportServer

/enable-TransportServer

/get-TransportServer

/set-TransportServer

/start-TransportServer


/uninitialize-Server

Applies To: Windows Server 2008,Windows Server 2008 R2

Reverts changes made to the server during the initial server configuration. This includes changes made by either the /initialize-server option or the Windows Deployment Services MMC snap-in. Note that this command resets the server to an unconfigured state. This command does not modify the contents of the RemoteInstall shared folder. Rather, it resets the server's state so that you can reinitialize the server.

Syntax

Copy Code
WDSUTIL [Options] /Uninitialize-Server [/Server:<Server name>]

Parameters

Parameter | Description
[/Server:<Server name>] | Specifies the name of the server. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server will be used.

Examples

To reinitialize the server, type one of the following:

Copy Code
WDSUTIL /Uninitialize-Server
WDSUTIL /Verbose /Uninitialize-Server /Server:MyWDSServer

Additional references

Command-Line Syntax Key

/disable-Server

/enable-Server

/get-Server

/initialize-Server

/set-Server

/start-Server

/stop-Server


/update-ServerFiles

Applies To: Windows Server 2008 R2,Windows Server 2008

Updates files in the REMINST shared folder by using the latest files that are stored in the server's %Windir%\System32\RemInst folder. To ensure the validity of your Windows Deployment Services installation, you should run this command once after each server upgrade, service pack installation, or update to Windows Deployment Services files.

Syntax

Copy Code
WDSUTIL [Options] /Update-ServerFiles [/Server:<Server name>]

Parameters

Parameter | Description
[/Server:<Server name>] | Specifies the name of the server. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If no server name is specified, the local server will be used.

Examples

To update the files, type one of the following:

Copy Code
WDSUTIL /Update-ServerFiles
WDSUTIL /Verbose /Progress /Update-ServerFiles /Server:MyWDSServer

Additional references

Command-Line Syntax Key


/verbose

Applies To: Windows Server 2008,Windows Server 2008 R2

Displays verbose output for a specified command. You can use /verbose with any other WDSUTIL commands that you run. Note that you must specify /verbose and /progress directly after WDSUTIL.

Syntax

Copy Code
WDSUTIL /verbose <commands>

Examples

To delete approved computers from the Auto-Add database and show verbose output, type:

Copy Code
WDSUTIL /Verbose /progress /Delete-AutoAddDevices /Server:MyWDSServer /DeviceType:ApprovedDevices


/progress

Applies To: Windows Server 2008,Windows Server 2008 R2

Displays progress while a command is being executed. You can use /progress with any other WDSUTIL commands that you run. Note that you must specify /verbose and /progress directly after WDSUTIL.

Syntax

Copy Code
WDSUTIL /progress <commands>

Examples

To initialize the server and display progress, type:

Copy Code
WDSUTIL /Verbose /Progress /Initialize-Server /Server:MyWDSServer /RemInst:"C:\RemoteInstall"


Wecutil

Applies To: Windows Server 2008

Enables you to create and manage subscriptions to events that are forwarded from remote computers, which support WS-Management protocol. For examples of how to use this command, see Examples.

Syntax

Copy Code
wecutil  [{es | enum-subscription}]
[{gs | get-subscription} <Subid> [/f:<Format>] [/uni:<Unicode>]]
[{gr | get-subscriptionruntimestatus} <Subid> [<Eventsource> …]]
[{ss | set-subscription} [<Subid> [/e:[<Subenabled>]] [/esa:<Address>] [/ese:[<Srcenabled>]] [/aes] [/res] [/un:<Username>] [/up:<Password>] [/d:<Desc>] [/uri:<Uri>] [/cm:<Configmode>] [/ex:<Expires>] [/q:<Query>] [/dia:<Dialect>] [/tn:<Transportname>] [/tp:<Transportport>] [/dm:<Deliverymode>] [/dmi:<Deliverymax>] [/dmlt:<Deliverytime>] [/hi:<Heartbeat>] [/cf:<Content>] [/l:<Locale>] [/ree:[<Readexist>]] [/lf:<Logfile>] [/pn:<Publishername>] [/essp:<Enableport>] [/hn:<Hostname>] [/ct:<Type>]] [/c:<Configfile> [/cun:<Username> /cup:<Password>]]]
[{cs | create-subscription} <Configfile> [/cun:<Username> /cup:<Password>]]
[{ds | delete-subscription} <Subid>]
[{rs | retry-subscription} <Subid> [<Eventsource>…]]
[{qc | quick-config} [/q:[<Quiet>]]].

Parameters

Parameter Description

{es | enum-subscription}

Displays the names of all remote event subscriptions that exist.

{gs | get-subscription} <Subid> [/f:<Format>] [/uni:<Unicode>]

Displays remote subscription configuration information. <Subid> is a string that uniquely identifies a subscription. <Subid> is the same as the string that was specified in the <SubscriptionId> tag of the XML configuration file, which was used to create the subscription.

{gr | get-subscriptionruntimestatus} <Subid> [<Eventsource> …]

Displays the runtime status of a subscription. <Subid> is a string that uniquely identifies a subscription. <Subid> is the same as the string that was specified in the <SubscriptionId> tag of the XML configuration file, which was used to create the subscription. <Eventsource> is a string that identifies a computer that serves as a source of events. <Eventsource> should be a fully-qualified domain name, a NetBIOS name, or an IP address.

{ss | set-subscription} <Subid> [/e:[<Subenabled>]] [/esa:<Address>] [/ese:[<Srcenabled>]] [/aes] [/res] [/un:<Username>] [/up:<Password>] [/d:<Desc>] [/uri:<Uri>] [/cm:<Configmode>] [/ex:<Expires>] [/q:<Query>] [/dia:<Dialect>] [/tn:<Transportname>] [/tp:<Transportport>] [/dm:<Deliverymode>] [/dmi:<Deliverymax>] [/dmlt:<Deliverytime>] [/hi:<Heartbeat>] [/cf:<Content>] [/l:<Locale>] [/ree:[<Readexist>]] [/lf:<Logfile>] [/pn:<Publishername>] [/essp:<Enableport>] [/hn:<Hostname>] [/ct:<Type>]

or

{ss | set-subscription /c:<Configfile> [/cun:<Comusername> /cup:<Compassword>]

Changes the subscription configuration. You can specify the subscription ID and the appropriate options to change subscription parameters, or you can specify an XML configuration file to change subscription parameters.

{cs | create-subscription} <Configfile> [/cun:<Username> /cup:<Password>]

Creates a remote subscription. <Configfile> specifies the path to the XML file that contains the subscription configuration. The path can be absolute or relative to the current directory.

{ds | delete-subscription} <Subid>

Deletes a subscription and unsubscribes from all event sources that deliver events into the event log for the subscription. Any events already received and logged are not deleted. <Subid> is a string that uniquely identifies a subscription. <Subid> is the same as the string that was specified in the <SubscriptionId> tag of the XML configuration file, which was used to create the subscription.

{rs | retry-subscription} <Subid> [<Eventsource>…]

Retries to establish a connection and send a remote subscription request to an inactive subscription. Attempts to reactivate all event sources or specified event sources. Disabled sources are not retried. <Subid> is a string that uniquely identifies a subscription. <Subid> is the same as the string that was specified in the <SubscriptionId> tag of the XML configuration file, which was used to create the subscription. <Eventsource> is a string that identifies a computer that serves as a source of events. <Eventsource> should be a fully-qualified domain name, a NetBIOS name, or an IP address.

{qc | quick-config} [/q:[<Quiet>]]

Configures the Windows Event Collector service to ensure a subscription can be created and sustained through reboots. This includes the following steps:

  1. Enable the ForwardedEvents channel if it is disabled.

  2. Set the Windows Event Collector service to delay start.

  3. Start the Windows Event Collector service if it is not running.

Options

Option | Description
/f:<Format> | Specifies the format of the information that is displayed. <Format> can be XML or Terse. If <Format> is XML, the output is displayed in XML format. If <Format> is Terse, the output is displayed in name-value pairs. The default is Terse.
/c:<Configfile> | Specifies the path to the XML file that contains a subscription configuration. The path can be absolute or relative to the current directory. This option can only be used with the /cun and /cup options and is mutually exclusive with all other options.
/e:[<Subenabled>] | Enables or disables a subscription. <Subenabled> can be true or false. The default value of this option is true.
/esa:<Address> | Specifies the address of an event source. <Address> is a string that contains a fully-qualified domain name, a NetBIOS name, or an IP address, which identifies a computer that serves as a source of events. This option should be used with the /ese, /aes, /res, or /un and /up options.
/ese:[<Srcenabled>] | Enables or disables an event source. <Srcenabled> can be true or false. This option is allowed only if the /esa option is specified. The default value of this option is true.
/aes | Adds the event source that is specified by the /esa option if it is not already a part of the subscription. If the address specified by the /esa option is already a part of the subscription, an error is reported. This option is only allowed if the /esa option is specified.
/res | Removes the event source that is specified by the /esa option if it is already a part of the subscription. If the address specified by the /esa option is not a part of the subscription, an error is reported. This option is only allowed if /esa option is specified.
/un:<Username> | Specifies the user credential to use with the event source specified by the /esa option. This option is only allowed if the /esa option is specified.
/up:<Password> | Specifies the password that corresponds to the user credential. This option is only allowed if the /un option is specified.
/d:<Desc> | Provides a description for the subscription.
/uri:<Uri> | Specifies the type of the events that are consumed by the subscription. <Uri> contains a URI string that is combined with the address of the event source computer to uniquely identify the source of the events. The URI string is used for all event source addresses in the subscription.
/cm:<Configmode> | Sets the configuration mode. <Configmode> can be one of the following strings: Normal, Custom, MinLatency or MinBandwidth. The Normal, MinLatency, and MinBandwidth modes set delivery mode, delivery max items, heartbeat interval, and delivery max latency time. The /dm, /dmi, /hi or /dmlt options may only be specified if the configuration mode is set to Custom.
/ex:<Expires> | Sets the time when the subscription expires. <Expires> should be defined in standard XML or ISO8601 date-time format: yyyy-MM-ddThh:mm:ss[.sss][Z], where T is the time separator and Z indicates UTC time.
/q:<Query> | Specifies the query string for the subscription. The format of <Query> may be different for different URI values and applies to all sources in the subscription.
/dia:<Dialect> | Defines the dialect that the query string will use.
/tn:<Transportname> | Specifies the name of the transport that is used to connect to a remote event source.
/tp:<Transportport> | Sets the port number that is used by the transport when connecting to a remote event source.
/dm:<Deliverymode> | Specifies the delivery mode. <Deliverymode> can be either pull or push. This option is only valid if the /cm option is set to Custom.
/dmi:<Deliverymax> | Sets the maximum number of items for batched delivery. This option is only valid if /cm is set to Custom.
/dmlt:<Deliverytime> | Sets the maximum latency in delivering a batch of events. <Deliverytime> is the number of milliseconds. This option is only valid if /cm is set to Custom.
/hi:<Heartbeat> | Defines the heartbeat interval. <Heartbeat> is the number of milliseconds. This option is only valid if /cm is set to Custom.
/cf:<Content> | Specifies the format of the events that are returned. <Content> can be Events or RenderedText. When the value is RenderedText, the events are returned with the localized strings (such as event description) attached to the event. The default value is RenderedText.
/l:<Locale> | Specifies the locale for delivery of the localized strings in RenderedText format. <Locale> is a language and country/region identifier, for example, "EN-us". This option is only valid if the /cf option is set to RenderedText.
/ree:[<Readexist>] | Identifies the events that will be delivered for the subscription. <Readexist> can true or false. When the <Readexist> is true, all existing events are read from the subscription event sources. When the <Readexist> is false, only future (arriving) events are delivered. The default value is true for a /ree option without a value. If no /ree option is specified, the default value is false.
/lf:<Logfile> | Specifies the local event log that is used to store events received from the event sources.
/pn:<Publishername> | Specifies the publisher name. It must be a publisher that owns or imports the log specified by the /lf option.
/essp:<Enableport> | Specifies that the port number must be appended to the service principal name of the remote service. <Enableport> can be true or false. The port number is appended when <Enableport> is true. When the port number is appended, some configuration may be required to prevent the access to event sources from being denied.
/hn:<Hostname> | Specifies the DNS name of the local computer. This name is used by remote event source to push back events and must be used only for a push subscription.
/ct:<Type> | Sets the credential type for the remote source access. <Type> should be one of the following values: default, negotiate, digest, basic or localmachine. The default value is default.
/cun:<Comusername> | Sets the shared user credential to be used for event sources that do not have their own user credentials. If this option is specified with the /c option, UserName and UserPassword settings for individual event sources from the configuration file are ignored. If you want to use a different credential for a specific event source, you should override this value by specifying the /un and /up options for a specific event source on the command line of another ss command.
/cup:<Compassword> | Sets the user password for the shared user credential. When <Compassword> is set to * (asterisk), the password is read from the console. This option is only valid when the /cun option is specified.
/q:[<Quiet>] | Specifies whether the configuration procedure will prompt for confirmation. <Quiet> can be true or false. If <Quiet> is true, the configuration procedure will not prompt for confirmation. The default value of this option is false.

Remarks

Important
If you receive the message, “The RPC server is unavailable” when you try to run wecutil, you need to start the Windows Event Collector service (wecsvc). To start wecsvc, at an elevated command prompt type net start wecsvc.

  • The following example shows the contents of a configuration file:

    Copy Code
    <Subscription xmlns="http://schemas.microsoft.com/2006/03/windows/events/subscription">
<Uri>http://schemas.microsoft.com/wbem/wsman/1/windows/EventLog</Uri>
<!-- Use Normal (default), Custom, MinLatency, MinBandwidth -->
<ConfigurationMode>Normal</ConfigurationMode>
<Description>Forward Sample Subscription</Description>
<SubscriptionId>SampleSubscription</SubscriptionId>
<Query><![CDATA[
<QueryList>
<Query Path="Application">
<Select>*</Select>
</Query>
</QueryList>
]]></Query>
<EventSources>
<EventSource Enabled="true">
<Address>mySource.myDomain.com</Address>
<UserName>myUserName</UserName>
<Password>*</Password>
</EventSource>
</EventSources>
<CredentialsType>Default</CredentialsType>
<Locale Language="EN-US"></Locale>
</Subscription>

Examples

Output configuration information for a subscription named sub1:

Copy Code
wecutil gs sub1

Example output:

Copy Code
EventSource[0]:
Address: localhost
Enabled: true
Description: Subscription 1
Uri: wsman:microsoft/logrecord/sel
DeliveryMode: pull
DeliveryMaxSize: 16000
DeliveryMaxItems: 15
DeliveryMaxLatencyTime: 1000
HeartbeatInterval: 10000
Locale:
ContentFormat: renderedtext
LogFile: HardwareEvents

Display the runtime status of a subscription named sub1:

Copy Code
wecutil gr sub1

Update the subscription configuration named sub1 from a new XML file called WsSelRg2.xml:

Copy Code
wecutil ss sub1 /c:%Windir%\system32\WsSelRg2.xml

Update the subscription configuration named sub2 with multiple parameters:

Copy Code
wecutil ss sub2 /esa:myComputer /ese /un:uname /up:* /cm:Normal

Create a subscription to forward events from a Windows Vista Application event log of a remote computer at mySource.myDomain.com to the ForwardedEvents log (see Remarks for an example of a configuration file):

Copy Code
wecutil cs subscription.xml

Delete a subscription named sub1:

Copy Code
wecutil ds sub1

Additional references

Command-Line Syntax Key


Wevtutil

Applies To: Windows Server 2008 R2,Windows Server 2008

Enables you to retrieve information about event logs and publishers. You can also use this command to install and uninstall event manifests, to run queries, and to export, archive, and clear logs. For examples of how to use this command, see Examples.

Syntax

Copy Code
wevtutil [{el | enum-logs}] [{gl | get-log} <Logname> [/f:<Format>]]
[{sl | set-log} <Logname> [/e:<Enabled>] [/i:<Isolation>] [/lfn:<Logpath>] [/rt:<Retention>] [/ab:<Auto>] [/ms:<Size>] [/l:<Level>] [/k:<Keywords>] [/ca:<Channel>] [/c:<Config>]]
[{ep | enum-publishers}]
[{gp | get-publisher} <Publishername> [/ge:<Metadata>] [/gm:<Message>] [/f:<Format>]] [{im | install-manifest} <Manifest>]
[{um | uninstall-manifest} <Manifest>] [{qe | query-events} <Path> [/lf:<Logfile>] [/sq:<Structquery>] [/q:<Query>] [/bm:<Bookmark>] [/sbm:<Savebm>] [/rd:<Direction>] [/f:<Format>] [/l:<Locale>] [/c:<Count>] [/e:<Element>]]
[{gli | get-loginfo} <Logname> [/lf:<Logfile>]]
[{epl | export-log} <Path> <Exportfile> [/lf:<Logfile>] [/sq:<Structquery>] [/q:<Query>] [/ow:<Overwrite>]]
[{al | archive-log} <Logpath> [/l:<Locale>]]
[{cl | clear-log} <Logname> [/bu:<Backup>]] [/r:<Remote>] [/u:<Username>] [/p:<Password>] [/a:<Auth>] [/uni:<Unicode>]

Parameters

Parameter | Description
{el | enum-logs} | Displays the names of all logs.
{gl | get-log} <Logname> [/f:<Format>] | Displays configuration information for the specified log, which includes whether the log is enabled or not, the current maximum size limit of the log, and the path to the file where the log is stored.
{sl | set-log} <Logname> [/e:<Enabled>] [/i:<Isolation>] [/lfn:<Logpath>] [/rt:<Retention>] [/ab:<Auto>] [/ms:<Size>] [/l:<Level>] [/k:<Keywords>] [/ca:<Channel>] [/c:<Config>] | Modifies the configuration of the specified log.
{ep | enum-publishers} | Displays the event publishers on the local computer.
{gp | get-publisher} <Publishername> [/ge:<Metadata>] [/gm:<Message>] [/f:<Format>]] | Displays the configuration information for the specified event publisher.
{im | install-manifest} <Manifest> | Installs event publishers and logs from a manifest. For more information about event manifests and using this parameter, see the Windows Event Log SDK at the Microsoft Developers Network (MSDN) Web site (http://msdn.microsoft.com).
{um | uninstall-manifest} <Manifest> | Uninstalls all publishers and logs from a manifest. For more information about event manifests and using this parameter, see the Windows Event Log SDK at the Microsoft Developers Network (MSDN) Web site (http://msdn.microsoft.com).
{qe | query-events} <Path> [/lf:<Logfile>] [/sq:<Structquery>] [/q:<Query>] [/bm:<Bookmark>] [/sbm:<Savebm>] [/rd:<Direction>] [/f:<Format>] [/l:<Locale>] [/c:<Count>] [/e:<Element>] | Reads events from an event log, from a log file, or using a structured query. By default, you provide a log name for <Path>. However, if you use the /lf option, then <Path> must be a path to a log file. If you use the /sq parameter, <Path> must be a path to a file that contains a structured query.
{gli | get-loginfo} <Logname> [/lf:<Logfile>] | Displays status information about an event log or log file. If the /lf option is used, <Logname> is a path to a log file. You can run wevtutil el to obtain a list of log names.
{epl | export-log} <Path> <Exportfile> [/lf:<Logfile>] [/sq:<Structquery>] [/q:<Query>] [/ow:<Overwrite>] | Exports events from an event log, from a log file, or using a structured query to the specified file. By default, you provide a log name for <Path>. However, if you use the /lf option, then <Path> must be a path to a log file. If you use the /sq option, <Path> must be a path to a file that contains a structured query. <Exportfile> is a path to the file where the exported events will be stored.
{al | archive-log} <Logpath> [/l:<Locale>] | Archives the specified log file in a self-contained format. A subdirectory with the name of the locale is created and all locale-specific information is saved in that subdirectory. After the directory and log file are created by running wevtutil al, events in the file can be read whether the publisher is installed or not.
{cl | clear-log} <Logname> [/bu:<Backup>] | Clears events from the specified event log. The /bu option can be used to back up the cleared events.

Options

Option | Description
/f:<Format> | Specifies that the output should be either XML or text format. If <Format> is XML, the output is displayed in XML format. If <Format> is Text, the output is displayed without XML tags. The default is Text.
/e:<Enabled> | Enables or disables a log. <Enabled> can be true or false.
/i:<Isolation> | Sets the log isolation mode. <Isolation> can be system, application or custom. The isolation mode of a log determines whether a log shares a session with other logs in the same isolation class. If you specify system isolation, the target log will share at least write permissions with the System log. If you specify application isolation, the target log will share at least write permissions with the Application log. If you specify custom isolation, you must also provide a security descriptor by using the /ca option.
/lfn:<Logpath> | Defines the log file name. <Logpath> is a full path to the file where the Event Log service stores events for this log.
/rt:<Retention> | Sets the log retention mode. <Retention> can be true or false. The log retention mode determines the behavior of the Event Log service when a log reaches its maximum size. If an event log reaches its maximum size and the log retention mode is true, existing events are retained and incoming events are discarded. If the log retention mode is false, incoming events overwrite the oldest events in the log.
/ab:<Auto> | Specifies the log auto-backup policy. <Auto> can be true or false. If this value is true, the log will be backed up automatically when it reaches the maximum size. If this value is true, the retention (specified with the /rt option) must also be set to true.
/ms:<Size> | Sets the maximum size of the log in bytes. The minimum log size is 1048576 bytes (1024KB) and log files are always multiples of 64KB, so the value you enter will be rounded off accordingly.
/l:<Level> | Defines the level filter of the log. <Level> can be any valid level value. This option is only applicable to logs with a dedicated session. You can remove a level filter by setting <Level> to 0.
/k:<Keywords> | Specifies the keywords filter of the log. <Keywords> can be any valid 64 bit keyword mask. This option is only applicable to logs with a dedicated session.
/ca:<Channel> | Sets the access permission for an event log. <Channel> is a security descriptor that uses the Security Descriptor Definition Language (SDDL). For more information about SDDL format, see the Microsoft Developers Network (MSDN) Web site (http://msdn.microsoft.com).
/c:<Config> | Specifies the path to a configuration file. This option will cause log properties to be read from the configuration file defined in <Config>. If you use this option, you must not specify a <Logname> parameter. The log name will be read from the configuration file.
/ge:<Metadata> | Gets metadata information for events that can be raised by this publisher. <Metadata> can be true or false.
/gm:<Message> | Displays the actual message instead of the numeric message ID. <Message> can be true or false.
/lf:<Logfile> | Specifies that the events should be read from a log or from a log file. <Logfile> can be true or false. If true, the parameter to the command is the path to a log file.
/sq:<Structquery> | Specifies that events should be obtained with a structured query. <Structquery> can be true or false. If true, <Path> is the path to a file that contains a structured query.
/q:<Query> | Defines the XPath query to filter the events that are read or exported. If this option is not specified, all events will be returned or exported. This option is not available when /sq is true.
/bm:<Bookmark> | Specifies the path to a file that contains a bookmark from a previous query.
/sbm:<Savebm> | Specifies the path to a file that is used to save a bookmark of this query. The file name extension should be .xml.
/rd:<Direction> | Specifies the direction in which events are read. <Direction> can be true or false. If true, the most recent events are returned first.
/l:<Locale> | Defines a locale string that is used to print event text in a specific locale. Only available when printing events in text format using the /f option.
/c:<Count> | Sets the maximum number of events to read.
/e:<Element> | Includes a root element when displaying events in XML. <Element> is the string that you want within the root element. For example, /e:root would result in XML that contains the root element pair <root></root>.
/ow:<Overwrite> | Specifies that the export file should be overwritten. <Overwrite> can be true or false. If true, and the export file specified in <Exportfile> already exists, it will be overwritten without confirmation.
/bu:<Backup> | Specifies the path to a file where the cleared events will be stored. Include the .evtx extension in the name of the backup file.
/r:<Remote> | Runs the command on a remote computer. <Remote> is the name of the remote computer. The im and um parameters do not support remote operation.
/u:<Username> | Specifies a different user to log on to a remote computer. <Username> is a user name in the form domain\user or user. This option is only applicable when the /r option is specified.
/p:<Password> | Specifies the password for the user. If the /u option is used and this option is not specified or <Password> is "*", the user will be prompted to enter a password. This option is only applicable when the /u option is specified.
/a:<Auth> | Defines the authentication type for connecting to a remote computer. <Auth> can be Default, Negotiate, Kerberos or NTLM. The default is Negotiate.
/uni:<Unicode> | Displays the output in Unicode. <Unicode> can be true or false. If <Unicode> is true then the output is in Unicode.

Remarks

  • Using a configuration file with the sl parameter

    The configuration file is an XML file with the same format as the output of wevtutil gl <Logname> /f:xml. The following example shows the format of a configuration file that enables retention, enables autobackup, and sets the maximum log size on the Application log:

    Copy Code
    <?xml version="1.0" encoding="UTF-8"?>
<channel name="Application" isolation="Application"
xmlns="http://schemas.microsoft.com/win/2004/08/events">
<logging>
<retention>true</retention>
<autoBackup>true</autoBackup>
<maxSize>9000000</maxSize>
</logging>
<publishing>
</publishing>
</channel>

Examples

List the names of all logs:

Copy Code
wevtutil el

Display configuration information about the System log on the local computer in XML format:

Copy Code
wevtutil gl System /f:xml

Use a configuration file to set event log attributes (see Remarks for an example of a configuration file):

Copy Code
wevtutil sl /c:config.xml

Display information about the Microsoft-Windows-Eventlog event publisher, including metadata about the events that the publisher can raise:

Copy Code
wevtutil gp Microsoft-Windows-Eventlog /ge:true

Install publishers and logs from the myManifest.xml manifest file:

Copy Code
wevtutil im myManifest.xml

Uninstall publishers and logs from the myManifest.xml manifest file:

Copy Code
wevtutil um myManifest.xml

Display the three most recent events from the Application log in textual format:

Copy Code
wevtutil qe Application /c:3 /rd:true /f:text

Display the status of the Application log:

Copy Code
wevtutil gli Application

Export events from System log to C:\backup\system0506.evtx:

Copy Code
wevtutil epl System C:\backup\system0506.evtx

Clear all of the events from the Application log after saving them to C:\admin\backups\a10306.evtx:

Copy Code
wevtutil cl Application /bu:C:\admin\backups\a10306.evtx

Additional References

Command-Line Syntax Key


Where

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows XP,Windows Vista,Windows Server 2003,Windows Server 2000,Windows Server 2003 R2,Windows 7

Displays the location of files that match the given search pattern.

For examples of how to use this command, see Examples.

Syntax

Copy Code
where [/r <Dir>] [/q] [/f] [/t] [$<ENV>:|<Path>:]<Pattern>[ ...]

Parameters

Parameter | Description
/r <Dir> | Indicates a recursive search, starting with the specified directory.
/q | Returns an exit code (0 for success, 1 for failure) without displaying the list of matched files.
/f | Displays the results of the where command in quotation marks.
/t | Displays the file size and the last modified date and time of each matched file.
[$<ENV>:|<Path>:]<Pattern>[ ...] | Specifies the search pattern for the files to match. At least one pattern is required, and the pattern can include wildcard characters (* and ?). By default, where searches the current directory and the paths that are specified in the PATH environment variable. You can specify a different path to search by using the format $ENV:Pattern (where ENV is an existing environment variable containing one or more paths) or by using the format Path:Pattern (where Path is the directory path you want to search). These optional formats should not be used with the /r command-line option.
/? | Displays help at the command prompt.

Remarks

  • If you do not specify a file name extension, the extensions listed in the PATHEXT environment variable are appended to the pattern by default.

  • Where can run recursive searches, display file information such as date or size, and accept environment variables in place of paths on local computers.

Examples

To find all files named Test in drive C of the current computer and its subdirectories, type:

Copy Code
where /r c:\ test

To list all files in the Public directory, type:

Copy Code
where $public:*.*

To find all files named Notepad in drive C of the remote computer, Computer1, and its subdirectories, type:

Copy Code
where /r \\computer1\c notepad.*

Additional references

Command-Line Syntax Key


Whoami

Applies To: Windows 7,Windows Server 2003 R2,Windows Server 2000,Windows Server 2003,Windows Vista,Windows XP,Windows Server 2008 R2,Windows Server 2008

Displays user, group and privileges information for the user who is currently logged on to the local system. If used without parameters, whoami displays the current domain and user name.

For examples of how to use this command, see Examples.

Syntax

Copy Code
whoami [/upn | /fqdn | /logonid]
whoami {[/user] [/groups] [/priv]} [/fo <Format>] [/nh]
whoami /all [/fo <Format>] [/nh]

Parameters

Parameter | Description
/upn | Displays the user name in user principal name (UPN) format.
/fqdn | Displays the user name in fully qualified domain name (FQDN) format.
/logonid | Displays the logon ID of the current user.
/user | Displays the current domain and user name and the security identifier (SID).
/groups | Displays the user groups to which the current user belongs.
/priv | Displays the security privileges of the current user.
/fo <Format> | Specifies the output format. Valid values include: table Displays output in a table. This is the default value. list Displays output in a list. csv Displays output in comma-separated value (CSV) format.
/all | Displays all information in the current access token, including the current user name, security identifiers (SID), privileges, and groups that the current user belongs to.
/nh | Specifies that the column header should not be displayed in the output. This is valid only for table and CSV formats.
/? | Displays help at the command prompt.

Examples

To display the domain and user name of the person who is currently logged on to this computer, type:

Copy Code
whoami

Output similar to the following appears:

Copy Code
DOMAIN1\administrator

To display all of the information in the current access token, type:

Copy Code
whoami /all

Additional references

Command-Line Syntax Key


Winnt

Applies To: Windows XP,Windows Server 2003 with SP1,Windows Server 2003,Windows Server 2000,Windows Server 2003 with SP2,Windows Server 2003 R2

Winnt is deprecated, and is not guaranteed to be supported in future releases of Windows.

This tool is included in Windows Server 2003. For more information see Winnt.


Winpop

Applies To: Windows Server 2003 R2,Windows Server 2003 with SP2,Windows Server 2003,Windows Server 2003 with SP1

Winpop is deprecated, and is not guaranteed to be supported in future releases of Windows.

This tool is included in Windows Server 2003. For more information see winpop.


Winsat

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

winsat assesses various features, capabilities, and attributes of a computer running Windows Vista®.

Syntax

Copy Code
winsat <assessment name> <assessment parameters>

Assessments

Assessment | Description
winsat dwm | Assesses the ability of a system to display the Aero desktop effects.
winsat d3d | Assesses the ability of a system to run Direct 3D applications, such as games.
winsat mem | Assesses system memory bandwidth by simulating large memory to memory buffer copies.
winsat disk | Assesses the performance of disk drives.
winsat cpu | Assesses the performance of the CPU(s).
winsat media | Assesses the performance of video encoding and decoding (playback) using the Direct Show framework.
winsat mfmedia | Assesses the performance of video decoding (playback) using the Media Foundation framework.
winsat features | Enumerates relevant system information.
winsat formal | Runs a set of pre-defined assessments and saves the data in an XML file in %systemroot%\performance\winsat\datastore.

Remarks

  • Please review the parameters for an assessment before running it. Assessment parameters are required for accurate testing.

    Caution
    Running an assessment without parameters may result in system performance problems or system instability.

  • Membership in the local Administrators group, or equivalent, is the minimum required to use winsat. The command must be executed from an elevated command prompt window.

  • To open an elevated command prompt window, click Start, click All Programs, click Accessories, right-click Command Prompt, and click Run as administrator.

Additional references

Command-Line Syntax Key


winsat dwm

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Simulates the composition operations of the Desktop Window Manager and produces a graphics memory throughput (bandwidth) metric that correlates with the performance of desktop composition.

For examples of how to use this command, see Examples.

Syntax

Copy Code
winsat dwm
winsat dwm <parameters> [options]

Parameters

Parameters | Description
-normalw <n> | Specify the number of textures used to represent normal windows in the simulation. Required when any other parameters are specified.
-glassw <n> | Specify the number of textures used to represent glass windows in the simulation.
-time <n> | Specify in seconds how long the assessment will run. Required when any other parameters are specified.
-winwidth <n> | Specify the window width in pixels. The default is 500.
-winheight <n> | Specify the window height in pixels. The default is 500.
-noupdate | Call lock and unlock on every window, but skip the CPU update of every pixel.
-nodisp | Specify that the assessment draws to an off-screen surface, so that the assessment is not visible while running.
-nolock | Skip locking and unlocking for all windows. This means that there is no window animation and the assessment is all fill-bound.
-width <n> | Specify the desktop (screen) width in pixels for the assessment. The default is 1024.
-height <n> | Specify the desktop (screen) height in pixels for the assessment. The default is 768.
-fullscreen | Specify that the D3D device should be created in full screen mode. By default, the D3D device is created in windowed mode.
-v | Send verbose output to STDOUT, including status and progress information. Any errors will also be written to the command window.
-xml <file name> | Save the output of the assessment as the specified XML file. If the specified file exists, it will be overwritten.
-idiskinfo | Save information about physical volumes and logical disks as part of the <SystemConfig> section in the XML output.
-iguid | Create a globally unique identifier (GUID) in the XML output file.
-note "note text" | Add the note text to the <note> section in the XML output file.
-icn | Include the local computer name in the XML output file.
-eef | Enumerate extra system information in the XML output file.

Examples

  • The following example runs the formal DWM assessment, saves the performance data needed by the Desktop Window Manager to the registry, and restarts the Desktop Window Manager:

    Copy Code
    winsat dwm
    Note
    This command is useful after upgrading to a driver that supports WDDM in order to ensure the Desktop Window Manager immediately takes advantage of the extended functionality.

  • The following example runs the DWM assessment with 10 normal windows and 4 glass windows for 10 seconds, writing verbose output and running in full screen mode.

    Copy Code
    winsat dwm -normalw 10 -glassw 4 -time 10 -v -fullscreen

Remarks

  • Membership in the local Administrators group, or equivalent, is the minimum required to use winsat. The command must be executed from an elevated command prompt window.

  • To open an elevated command prompt window, click Start, click Accessories, right-click Command Prompt, and click Run as administrator.

Additional references

Winsat


winsat d3d

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Assesses a system's ability to run D3D based applications such as games.

For examples of how to use this command, see Examples.

Syntax

Copy Code
winsat d3d <parameters>

Parameters

Parameter | Description
-objs | The primitives used in the assessment are spheres. The parameter specifies the theta and phi quantization. Increasing this number causes more shader processing to occur. Range: [2, 180/batch size]
-sradius | Specifies the radius of the spheres. A smaller radius will reduce the number of pixels drawn for that sphere while keeping the overhead of that sphere constant. Range: [0.01, 8]
-totalobj | Total number of spheres in the scene. A large number of objects, combined with a small object size, results is an assessment that is batch limited. Range: [0, 8]
-texw -texh | Width and height of the textures created by the assessment as a power of 2. Range: [1, 12]
-totaltex | The total number of textures that WinSAT will create. If the number of textures is less than the total number of objects that require a texture, then WinSAT will re-use the textures in the scene. If there are more textures that are required in the scene then WinSAT will iterate over the list using as many as is needed for this frame. This means that all textures will be used eventually. Range: [0, 8]
-texpobj | This is the number of textures each sphere requires to render. Range: [0, 16]
-batchcnt | Having large batches reduces driver time and tends to make the application fill rate limited. Conversely, having many small batches causes more driver overhead. Range: [1, TotalObjs]
-time | Number of seconds to run the assessment. Range: [5, 8]
-out | Specifies a path to a file to save the results along with the arguments to WinSAT. Range: string
-width -height | Width and Height of the window the app is running in. On XP, this is the screen resolution, on Vista it will be similar, but will not run in exclusive mode. Range: [256, 8] for windowed and card supported screen resolutions for full screen mode.
-vs <profile> | Forces the use of a particular vertex shader profile. The assessment is not guaranteed to run correctly when forced into using a particular shader model.
-ps <profile> | Forces the user of a particular pixel shader profile. The assessment is not guaranteed to run correctly when forced to use a particular shader model.
-fps <n> | In full screen mode, limits the refresh rate (frames per second) to the nearest rate supported by the card.
-rendertotex <n> | Render to texture float <n>. Simulate multiple-stage off-screen texture rendering. WinSAT will cycle through the specified number of rendertargets.
-rtdelta <n> | When rendering with render targets, the delta defines how far back in the render target circular buffer the assessment will go to set a previous render target as a texture. The default is 1.
-fullscreen | Specifies that the D3D device should be created in full screen mode.
-noalpha | Turns off back buffer alpha blending.
-NoDisp | Sets the window to "not visible" so that the assessment draws to an off-screen surface.
-texshader | Use the texture shader that samples up to 16 textures and adds them together instead of the default simple shader.
-alushader | Use the alu shader that loads up to two textures and computes an intensive lighting formula instead of the default simple shader.
-fixedseed | Seeds rand with a fixed number in order to run the exact same assessment multiple times.
-nozwarming | Disables the z-buffer warming used to make the results consistent for non-alpha assessments.
-ref | Forces software rasterization of the assessment. This option can decrease the speed of the assessment.
-noetw | Disables ETW tracing. Use this option if you intend to do your own ETW logging and do not want the log stopped when the assessment runs.
-noclear | Disables the call to clear in the OnFrameRender function.
-v | Send verbose output to STDOUT, including status and progress information. Any errors will also be written to the command window.
-xml <file name> | Save the output of the assessment as the specified XML file. If the specified file exists, it will be overwritten.
-idiskinfo | Save information about physical volumes and logical disks as part of the <SystemConfig> section in the XML output.
-iguid | Create a globally unique identifier (GUID) in the XML output file.
-note "note text" | Add the note text to the <note> section in the XML output file.
-icn | Include the local computer name in the XML output file.
-eef | Enumerate extra system information in the XML output file.

Examples

  • The following example assesses performance with 20 total spheres and 10 rendered textures using the alu shader, without back buffer alpha blending and in full screen mode, for 10 seconds, sending verbose output to stdout.

    Copy Code
    winsat d3d -totalobj 20 -objs C(20) -totaltex 10 -texpobj C(1) -alushader -noalpha -fullscreen -v -time 10

Remarks

  • Membership in the local Administrators group, or equivalent, is the minimum required to use winsat. The command must be executed from an elevated command prompt window.

  • To open an elevated command prompt window, click Start, click Accessories, right-click Command Prompt, and click Run as administrator.

Additional references

Winsat


winsat mem

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Tests system memory bandwidth in a manner reflective of large memory to memory buffer copies, as are used in multimedia processing.

For examples of how to use this command, see Examples.

Syntax

Copy Code
winsat mem <parameters>

Parameters

Parameter Description

-up

Force memory testing with only one thread. The default is to run one thread per physical CPU or core.

-rn

Specify that the assessment’s threads should run at normal priority. The default is to run at priority 15.

-nc

Specify that the assessment should allocate memory and flag it as un-cached. This means that the processor’s caches will be bypassed for copy operations. The default is to run in cached space.

-do <n>

Specify the distance, in bytes, between the end of the source buffer and the beginning of the destination buffer. The default is 64 bytes. The maximum allowable destination offset is 16MB. Specifying an invalid destination offset will result in an error.

Note
Zero is a valid value for <n>, but negative numbers are not.

-mint <n>

Specify the minimum run time in seconds for the assessment. The default is 2.0. The minimum value is 1.0. The maximum value is 30.0.

Note
Specifying a -mint value greater than the -maxt value when the two parameters are used in combination will result in an error.

-maxt <n>

Specify the maximum run time in seconds for the assessment. The default is 5.0. The minimum value is 1.0. The maximum value is 30.0. If used in combination with the -mint parameter, the assessment will begin to do periodic statistical checks of its results after the period of time specified in -mint. If the statistical checks pass, then the assessment will finish before the period of time specified in -maxt has elapsed. If the assessment runs for the period of time specified in -maxt without satisfying the statistical checks, then the assessment will finish at that time and return the results it has collected.

-buffersize <n>

Specify the buffer size that the memory copy test should use. Twice this amount will be allocated per CPU, which determines the amount of data copied from one buffer to another. The default is 16MB. This value is rounded to the nearest 4KB boundary. The maximum value is 32MB. The minimum value is 4KB. Specifying an invalid buffer size will result in an error.

-v

Send verbose output to STDOUT, including status and progress information. Any errors will also be written to the command window.

-xml <file name>

Save the output of the assessment as the specified XML file. If the specified file exists, it will be overwritten.

-idiskinfo

Save information about physical volumes and logical disks as part of the <SystemConfig> section in the XML output.

-iguid

Create a globally unique identifier (GUID) in the XML output file.

-note "note text"

Add the note text to the <note> section in the XML output file.

-icn

Include the local computer name in the XML output file.

-eef

Enumerate extra system information in the XML output file.

Examples

  • The following example runs the assessment for a minimum of 4 seconds and no longer than 12 seconds, using a 32MB buffer size and saving the results in XML format to the file memtest.xml.

    Copy Code
    winsat mem -mint 4.0 -maxt 12.0 -buffersize 32MB -xml memtest.xml

Remarks

  • Membership in the local Administrators group, or equivalent, is the minimum required to use winsat. The command must be executed from an elevated command prompt window.

  • To open an elevated command prompt window, click Start, click Accessories, right-click Command Prompt, and click Run as administrator.

Additional references

Winsat


winsat disk

Applies To: Windows 7,Windows Vista,Windows Server 2008,Windows Server 2008 R2

Measures the performance of a storage device using one of three assessment types:

  • A sequential or random read assessment.

  • A sequential or random write assessment.

  • A write flush policy test.

For examples of how to use this command, see Examples.

Syntax

Copy Code
winsat disk <-seq|-ran> <-read|-write> <-n <disk identification number>|-drive <drive letter>> <optional parameters>
winsat disk flush <-n <disk identification number>|-drive <drive letter>>

Parameters

Important
See the required parameter descriptions for the combination of required parameters that can be used during a single assessment.

Required Parameter Description

-flush

Assess disk performance in write policy flush mode. Cannot be used in combination with -seq, -ran, -write, or -read.

-seq

Assess sequential IO performance. Cannot be used in combination with -ran or -flush.

-ran

Assess random IO performance. Cannot be used in combination with -seq or -flush.

-read

Assess read performance. Cannot be used in combination with -write or -flush.

-write

Assess write performance. Cannot be used in combination with -read or -flush.

-n <disk identification number>

Identify by physical disk identification number which disk should be assessed. Cannot be used in combination with -drive.

-drive <drive letter>

Identify by drive letter which disk should be assessed. Cannot be used in combination with -n.

Note
Do not add a colon to the drive letter. -drive c is valid, but -drive c: is not.

Optional Parameter | Description
-count <1-50> | Specify the number of iterations to perform. The default is 1.
-iocount <256-5000> | Specify the number of IO operations that will be issued for the assessment. The default is 256.
-seqsize <65536-1048576> | Specify the size of the IOs that will be issued for a sequential IO assessment in bytes. The default is 65536. Values greater than 1 MB will use 1 MB. Values that are not sector aligned will be rounded down to be sector aligned unless the value is smaller than a sector, in which case it will be rounded up to the sector size.
-ransize <16384-1048576> | Specify the size of the IOs that will be issued for a random IO assessment in bytes. The default is 16384. Values greater than 1 MB will use 1 MB. Values that are not sector aligned will be rounded down to be sector aligned unless the value is smaller than a sector, in which case it will be rounded up to the sector size.
-v | Send verbose output to STDOUT, including status and progress information. Any errors will also be written to the command window.
-xml <file name> | Save the output of the assessment as the specified XML file. If the specified file exists, it will be overwritten.
-idiskinfo | Save information about physical volumes and logical disks as part of the <SystemConfig> section in the XML output.
-iguid | Create a globally unique identifier (GUID) in the XML output file.
-note "note text" | Add the note text to the <note> section in the XML output file.
-icn | Include the local computer name in the XML output file.
-eef | Enumerate extra system information in the XML output file.

Examples

  • The following example assesses the sequential I/O read performance of drive C:

    Copy Code
    winsat disk -seq -read -drive c
  • The following example assesses the random I/O write performance of drive number 2:

    Copy Code
    winsat disk -ran -write -n 2
  • The following example assesses the flush performance of drive C:

    Copy Code
    winsat disk -flush -drive c

Remarks

  • Membership in the local Administrators group, or equivalent, is the minimum required to use winsat. The command must be executed from an elevated command prompt window.

  • To open an elevated command prompt window, click Start, click Accessories, right-click Command Prompt, and click Run as administrator.

Additional references

Winsat


winsat cpu

Applies To: Windows 7,Windows Vista,Windows Server 2008,Windows Server 2008 R2

Assesses the performance of the processor(s) using encryption and decryption or compression and decompression.

For examples of how to use this command, see Examples.

Syntax

Copy Code
winsat cpu <[encryption|encryption2]|[compression|compression2]> [optional parameters]

Parameters

Important
Only one of the four required parameters is required to run the assessment.

Required Parameter | Description
-encryption | Run the encryption and decryption sub-assessment using 256-bit AES cryptographic algorithms.
-encryption2 | Run the encryption and decryption sub-assessment computing a SHA1 hash.
-compression | Run the compression and decompression sub-assessment using a Lempel-Zev algorithm.
-compression2 | Run the compression and decompression sub-assessment using an internal Microsoft compression algorithm. This is the same algorithm used to compress the hibernation file and with ReadyBoost and ReadyDrive technologies.

Optional Parameter | Description
-buffersize <n> | Define the buffer size for the assessment. The minimum is 4K. The maximum is 2MB. The default is 16KB.
-data <file name> | Specify a file to be loaded into the buffer for use in the assessment. The default file used if none is specified is %SystemRoot%\system32\shell32.dll.
-nbr <n> | Specify the number of buffer regions used in the assessment. The default is 16 regions.
-brs <n> | Specify the size of buffer regions used in the assessment.
-v | Send verbose output to STDOUT, including status and progress information. Any errors will also be written to the command window.
-xml <file name> | Save the output of the assessment as the specified XML file. If the specified file exists, it will be overwritten.
-idiskinfo | Save information about physical volumes and logical disks as part of the <SystemConfig> section in the XML output.
-iguid | Create a globally unique identifier (GUID) in the XML output file.
-note "note text" | Add the note text to the <note> section in the XML output file.
-icn | Include the local computer name in the XML output file.
-eef | Enumerate extra system information in the XML output file.
Note
A combination of -buffersize, -nbr, and -brs can be specified, but only two can be used simultaneously.

  • When -buffersize and -nbr are used together, the region size is determined by dividing the number of regions into the buffer sizes.

  • When -buffersize and -brs are used together, the number of regions is determined by dividing the region size into the buffer sizes.

  • When -nbr and -brs are used together, the buffer size is determined by multiplying the values for -nbr and -brs together.

Additional considerations

The -buffersize value defaults to bytes unless a suffix is used with the number supplied. The following suffixes can be used to specify other magnitudes:

  • B or BYTES for bytes (assessments that do not permit values this small will default to the smallest allowed value)

  • K or KB for kilobytes

  • M or MB for megabytes

  • G or GB for gigabytes (assessments that do not permit values this large will default to the largest allowed value)

Examples:

  • -buffersize 1K

  • -buffersize 256BYTES

Examples

  • The following example assesses CPU performance using 256-bit AES cryptographic algorithms:

    Copy Code
    winsat cpu -encryption
  • The following example assesses CPU performance using the same compression algorithms that Windows Vista uses internally:

    Copy Code
    winsat cpu -compression2

Remarks

  • Membership in the local Administrators group, or equivalent, is the minimum required to use winsat. The command must be executed from an elevated command prompt window.

  • To open an elevated command prompt window, click Start, click All Programs, click Accessories, right-click Command Prompt, and click Run as administrator.

Additional references

Winsat


winsat media

Applies To: Windows 7,Windows Vista,Windows Server 2008,Windows Server 2008 R2

Analyzes performance during video playback and encoding using DirectShow media handling components.

For examples of how to use this command, see Examples.

Syntax

Copy Code
winsat media <-input <file name>> <parameters>

Parameters

Parameters Description

-input <file name>

Required: Specify the file containing the video clip to be played or encoded. The file can be in any format that can be rendered by DirectShow.

-dumpgraph

Specify that the filter graph should be saved to a GraphEdit-compatible file before the assessment starts.

-ns

Specify that the filter graph should run at the normal playback speed of the input file. By default, the filter graph runs as fast as possible, ignoring presentation times.

-show

Run the assessment in decode mode and show the contents of the file specified in -input in a window. By default, the assessment does not display any visible windows.

-play

Run the assessment in decode mode and play any supplied audio content in the file specified in -input using the default DirectSound device. By default, audio playback is disabled.

-encode <PRX profile file name>

Re-encode the decoded content from the file specified in -input using the Windows Media codec. PRX profile file name is the name of a file containing the PRX profile that configures the encoder. This profile is created using the Windows Media Profile Editor application in the Windows Media Encoder tool set.

Note
The assessment will return an error if -show or -play is present in the same command as -encode.

-saveas <output file name>

Save the results of the -encode operation to the specified output file name.

Note
The assessment will return an error if -saveas is present but -encode is not.

-v

Send verbose output to STDOUT, including status and progress information. Any errors will also be written to the command window.

-xml <file name>

Save the output of the assessment as the specified XML file. If the specified file exists, it will be overwritten.

-idiskinfo

Save information about physical volumes and logical disks as part of the <SystemConfig> section in the XML output.

-iguid

Create a globally unique identifier (GUID) in the XML output file.

-note "note text"

Add the note text to the <note> section in the XML output file.

-icn

Include the local computer name in the XML output file.

-eef

Enumerate extra system information in the XML output file.

Examples

  • The following example assesses performance when decoding the sample video file included with WinSAT and saves the results in XML format in the file media.xml:

    Copy Code
    winsat media -input c:\windows\performance\winsat\winsat.wmv -xml media.xml
  • The following example assesses performance when decoding the sample video file included with WinSAT and re-encoding the video stream using the sample profile included with WinSAT:

    Copy Code
    winsat media -input c:\windows\performance\winsat\winsat.wmv -encode c:\windows\performance\winsat\winsat.prx

Remarks

  • Membership in the local Administrators group, or equivalent, is the minimum required to use winsat. The command must be executed from an elevated command prompt window.

  • To open an elevated command prompt window, click Start, click Accessories, right-click Command Prompt, and click Run as administrator.

Additional references

Winsat


winsat mfmedia

Applies To: Windows 7,Windows Vista,Windows Server 2008,Windows Server 2008 R2

Measures the performance of video decoding (playback) using the Media Foundation framework.

For examples of how to use this command, see Examples.

Syntax

Copy Code
winsat mfmedia <parameters>

Parameters

Parameters Description

-input <file name>

Required: Specify the file containing the video clip to be played or encoded. The file can be in any format that can be rendered by Media Foundation.

-dumpgraph

Specify that the filter graph should be saved to a GraphEdit-compatible file before the assessment starts.

-ns

Specify that the filter graph should run at the normal playback speed of the input file. By default, the filter graph runs as fast as possible, ignoring presentation times.

-play

Run the assessment in decode mode and play any supplied audio content in the file specified in -input using the default DirectSound device. By default, audio playback is disabled.

-nopmp

Do not make use of the Media Foundation Protected Media Pipeline (MFPMP) process during the assessment.

-pmp

Always make use of the MFPMP process during the assessment.

Note
If -pmp or -nopmp is not specified, MFPMP will be used only when necessary.

-v

Send verbose output to STDOUT, including status and progress information. Any errors will also be written to the command window.

-xml <file name>

Save the output of the assessment as the specified XML file. If the specified file exists, it will be overwritten.

-idiskinfo

Save information about physical volumes and logical disks as part of the <SystemConfig> section in the XML output.

-iguid

Create a globally unique identifier (GUID) in the XML output file.

-note "note text"

Add the note text to the <note> section in the XML output file.

-icn

Include the local computer name in the XML output file.

-eef

Enumerate extra system information in the XML output file.

Examples

  • The following example runs the assessment with the input file that is used during a winsat formal assessment, without employing the Media Foundation Protected Media Pipeline (MFPMP), on a computer where c:\windows is the location of the Windows folder.

    Copy Code
    winsat mfmedia -input c:\windows\performance\winsat\winsat.wmv -nopmp

Remarks

  • Membership in the local Administrators group, or equivalent, is the minimum required to use winsat. The command must be executed from an elevated command prompt window.

  • To open an elevated command prompt window, click Start, click Accessories, right-click Command Prompt, and click Run as administrator.

Additional references

Winsat

winsat formal


winsat features

Applies To: Windows 7,Windows Vista,Windows Server 2008,Windows Server 2008 R2

Enumerates relevant system information. This assessment is run once for each invocation of WinSAT and the data is saved in the XML output.

Syntax

Copy Code
winsat features [options]

Parameters

Option | Description
-v | Send verbose output to STDOUT, including status and progress information. Any errors will also be written to the command window.
-xml <file name> | Save the output of the assessment as the specified XML file. If the specified file exists, it will be overwritten.
-idiskinfo | Save information about physical volumes and logical disks as part of the <SystemConfig> section in the XML output.
-iguid | Create a globally unique identifier (GUID) in the XML output file.
-note "note text" | Add the note text to the <note> section in the XML output file.
-icn | Include the local computer name in the XML output file.
-eef | Enumerate extra system information in the XML output file.

Remarks

  • Membership in the local Administrators group, or equivalent, is the minimum required to use winsat. The command must be executed from an elevated command prompt window.

  • To open an elevated command prompt window, click Start, click Accessories, right-click Command Prompt, and click Run as administrator.

Additional references

Winsat


winsat formal

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Runs a pre-defined set of assessments and saves the data to an XML file in %systemroot%\performance\winsat\datastore. There are no command line parameters available for use with the formal assessment.

Syntax

Copy Code
winsat formal

Remarks

  • Membership in the local Administrators group, or equivalent, is the minimum required to use winsat. The command must be executed from an elevated command prompt window.

  • To open an elevated command prompt window, click Start, click Accessories, right-click Command Prompt, and click Run as administrator.

Additional references

Winsat


Wmic

Applies To: Windows Server 2008 R2,Windows Server 2008,Windows Vista,Windows 7

Displays WMI information inside an interactive command shell.

For examples of how to use this command, see Examples.

Syntax

Copy Code
command </parameter>

Sub-commands

The following sub-commands are available at all times:

Sub-command | Description
class | Escapes from the default alias mode of WMIC to access classes in the WMI schema directly.
path | Escapes from the default alias mode of WMIC to access instances in the WMI schema directly.
context | Displays the current values of all global switches.
[quit | exit] | Exits the WMIC command shell.

Parameters

Parameter | Description
</parameter> | <Concise description, starts with a verb.>
</param2> | <Another concise description, starts with a verb.>

Remarks

Scripting

Examples

To display the current values of all global switches, type:

Copy Code
wmic context

Output similar to the following displays:

Copy Code
  NAMESPACE    : root\cimv2
  ROLE         : root\cli
  NODE(S)      : BOBENTERPRISE
  IMPLEVEL     : IMPERSONATE
  [AUTHORITY   : N/A]
  AUTHLEVEL    : PKTPRIVACY
  LOCALE       : ms_409
  PRIVILEGES   : ENABLE
  TRACE        : OFF
  RECORD       : N/A
  INTERACTIVE  : OFF
  FAILFAST     : OFF
  OUTPUT       : STDOUT
  APPEND       : STDOUT
  USER         : N/A
  AGGREGATE    : ON

To change the language ID used by the command line to English (locale ID 409), type:

Copy Code
wmic /locale:ms_409

Additional references

Command-Line Syntax Key


Xcopy

Applies To: Windows Server 2008,Windows Server 2008 R2,Windows Server 2003 R2,Windows 7,Windows Vista,Windows Server 2003,Windows Server 2000

Copies files and directories, including subdirectories

For examples of how to use this command, see Examples

Syntax

Copy Code
Xcopy <Source> [<Destination>] [/w] [/p] [/c] [/v] [/q] [/f] [/l] [/g] [/d [:MM-DD-YYYY]] [/u] [/i] [/s [/e]] [/t] [/k] [/r] [/h] [{/a | /m}] [/n] [/o] [/x] [/exclude:FileName1[+[FileName2]][+[FileName3]] [{/y | /-y}] [/z] [/b] [/j]

Parameters

Parameter Description

<Source>

Required. Specifies the location and names of the files you want to copy. This parameter must include either a drive or a path.

[<Destination>]

Specifies the destination of the files you want to copy. This parameter can include a drive letter and colon, a directory name, a file name, or a combination of these.

/w

Displays the following message and waits for your response before starting to copy files:

Press any key to begin copying file(s)

/p

Prompts you to confirm whether you want to create each destination file.

/c

Ignores errors.

/v

Verifies each file as it is written to the destination file to make sure that the destination files are identical to the source files.

/q

Suppresses the display of xcopy messages.

/f

Displays source and destination file names while copying.

/l

Displays a list of files that are to be copied.

/g

Creates decrypted Destination files when the destination does not support encryption.

/d [:MM-DD-YYYY]

Copies source files changed on or after the specified date only. If you do not include a MM-DD-YYYY value, xcopy copies all Source files that are newer than existing Destination files. This command-line option allows you to update files that have changed.

/u

Copies files from Source that exist on Destination only.

/i

If Source is a directory or contains wildcards and Destination does not exist, xcopy assumes Destination specifies a directory name and creates a new directory. Then, xcopy copies all specified files into the new directory. By default, xcopy prompts you to specify whether Destination is a file or a directory.

/s

Copies directories and subdirectories, unless they are empty. If you omit /s, xcopy works within a single directory.

/e

Copies all subdirectories, even if they are empty. Use /e with the /s and /t command-line options. /t

/t

Copies the subdirectory structure (that is, the tree) only, not files. To copy empty directories, you must include the /e command-line option.

/k

Copies files and retains the read-only attribute on Destination files if present on the Source files. By default, xcopy removes the read-only attribute.

/r

Copies read-only files.

/h

Copies files with hidden and system file attributes. By default, xcopy does not copy hidden or system files

/a

Copies only Source files that have their archive file attributes set. /a does not modify the archive file attribute of the source file. For information about how to set the archive file attribute by using attrib, see Additional references.

/m

Copies Source files that have their archive file attributes set. Unlike /a, /m turns off archive file attributes in the files that are specified in the source. For information about how to set the archive file attribute by using attrib, see Additional references.

/n

Creates copies by using the NTFS short file or directory names. /n is required when you copy files or directories from an NTFS volume to a FAT volume or when the FAT file system naming convention (that is, 8.3 characters) is required on the Destination file system. The Destination file system can be FAT or NTFS.

/o

Copies file ownership and discretionary access control list (DACL) information.

/x

Copies file audit settings and system access control list (SACL) information (implies /o).

/exclude:FileName1[+[FileName2][+[FileName3](…)]

Specifies a list of files. At least one file must be specified. Each file will contain search strings with each string on a separate line in the file.

When any of the strings match any part of the absolute path of the file to be copied, that file will be excuded from being copied. For example, specifying the string, \obj\ or .obj will exclude all files underneath the directory obj or all files with the .obj extension.

/y

Suppresses prompting to confirm that you want to overwrite an existing destination file.

/-y

Prompts to confirm that you want to overwrite an existing destination file.

/z

Copies over a network in restartable mode.

/b

Copies the symbolic link instead of the files. This parameter was introduced in Windows Vista®.

/j

Copies files without buffering. Recommended for very large files. This parameter was added introduced in Windows Server® 2008 R2.

/?

Displays help at the command prompt.

Remarks

  • Using /v

    Windows XP and the Windows Server 2003 family of products do not use this command. It is included only to preserve compatibility with existing MS-DOS files, but it has no effect at the command line because the functionality is automatic.

  • Using /z

    If you lose your connection during the copy phase (for example, if the server going offline severs the connection), it resumes after you reestablish the connection. /z also displays the percentage of the copy operation completed for each file.

  • Using /y in the COPYCMD environment variable.

    You can use /y in the COPYCMD environment variable. You can override this command by using /-y on the command line. By default, you are prompted to overwrite, unless you run xcopy from within a batch script.

  • Copying encrypted files

    Copying encrypted files to a volume that does not support EFS results in an error. Decrypt the files first or copy the files to a volume that does support EFS.

  • Appending files

    To append files, specify a single file for destination, but multiple files for source (that is, by using wildcards or file1+file2+file3 format).

  • Default value for Destination

    If you omit Destination, the xcopy command copies the files to the current directory.

  • Specifying whether Destination is a file or directory

    If Destination does not contain an existing directory and does not end with a backslash (\), the following message appears:

    Copy Code
    Does <Destination> specify a file name or directory name on the target(F = file, D = directory)?
    Press F if you want the file or files to be copied to a file. Press D if you want the file or files to be copied to a directory.

    You can suppress this message by using the /i command-line option, which causes xcopy to assume that the destination is a directory if the source is more than one file or a directory.

  • Using the xcopy command to set archive attribute for Destination files

    The xcopy command creates files with the archive attribute set, whether or not this attribute was set in the source file. For more information about file attributes and attrib, see Additional references.

  • Comparing xcopy and diskcopy

    If you have a disk that contains files in subdirectories and you want to copy it to a disk that has a different format, use the xcopy command instead of diskcopy. Because the diskcopy command copies disks track by track, your source and destination disks must have the same format. The xcopy command does not have this requirement. Use xcopy unless you need a complete disk image copy.

  • Exit codes for xcopy

    To process exit codes returned by xcopy, use the ErrorLevel parameter on the if command line in a batch program. For an example of a batch program that processes exit codes using if, see Additional references. The following table lists each exit code and a description.

    Exit code Description

    0

    Files were copied without error.

    1

    No files were found to copy.

    2

    The user pressed CTRL+C to terminate xcopy.

    4

    Initialization error occurred. There is not enough memory or disk space, or you entered an invalid drive name or invalid syntax on the command line.

    5

    Disk write error occurred.

Examples

To copy all the files and subdirectories (including any empty subdirectories) from drive A to drive B, type:

Copy Code
xcopy a: b: /s /e

To include any system or hidden files in the previous example, add the/h command-line option as follows:

Copy Code
xcopy a: b: /s /e /h

To update files in the \Reports directory with the files in the \Rawdata directory that have changed since December 29, 1993, type:

Copy Code
xcopy \rawdata \reports /d:12-29-1993

To update all the files that exist in \Reports in the previous example, regardless of date, type:

Copy Code
xcopy \rawdata \reports /u

To obtain a list of the files to be copied by the previous command (that is, without actually copying the files), type:

Copy Code
xcopy \rawdata \reports /d:12-29-1993 /l > xcopy.out

The file xcopy.out lists every file that is to be copied.

To copy the \Customer directory and all subdirectories to the directory \\Public\Address on network drive H:, retain the read-only attribute, and be prompted when a new file is created on H:, type:

Copy Code
xcopy \customer h:\public\address /s /e /k /p

To issue the previous command, ensure that xcopy creates the \Address directory if it does not exist, and suppress the message that appears when you create a new directory, add the /i command-line option as follows:

Copy Code
xcopy \customer h:\public\address /s /e /k /p /i

You can create a batch program to perform xcopy operations and use the batch if command to process the exit code if an error occurs. For example, the following batch program uses replaceable parameters for the xcopy source and destination parameters:

Copy Code
@echo offrem COPYIT.BAT transfers all files in all subdirectories ofrem the source drive or directory (%1) to the destinationrem drive or directory (%2)xcopy %1 %2 /s /eif errorlevel 4 goto lowmemoryif errorlevel 2 goto abortif errorlevel 0 goto exit:lowmemoryecho Insufficient memory to copy files orecho invalid drive or command-line syntax.goto exit:abortecho You pressed CTRL+C to end the copy operation.goto exit:exit

To use this batch program to copy all files in the C:\Prgmcode directory and its subdirectories to drive B, type:

Copy Code
copyit c:\prgmcode b:

The command interpreter substitutes C:\Prgmcode for %1 and B: for %2, then uses xcopy with the /e and /s command-line options. If xcopyencounters an error, the batch program reads the exit code and goes to the label indicated in the appropriate IF ERRORLEVEL statement, then displays the appropriate message and exits from the batch program.

Additional references

  • Copy

  • Move

  • Dir

  • Attrib

  • Diskcopy

  • If

  • Command-Line Syntax Key


Command-Line Syntax Key

Applies To: Windows Vista,Windows 7,Windows Server 2008,Windows Server 2008 R2

The following table describes the notation used to indicate command-line syntax.

Notation | Description
Text without brackets or braces | Items you must type as shown
<Text inside angle brackets> | Placeholder for which you must supply a value
[Text inside square brackets] | Optional items
{Text inside braces} | Set of required items; choose one
Vertical bar (|) | Separator for mutually exclusive items; choose one
Ellipsis (…) | Items that can be repeated


Commands by Server Role

Applies To: Windows Server 2008

A server role describes the primary function of the server. Administrators can choose to dedicate an entire server to one role, or install multiple server roles and sub roles on a single computer. Each role may include additional command-line tools, installed as part of the role. The following topics provide a list of commands associated with each server role.

  • Active Directory Certificate Services Command Reference

  • Active Directory Domain Services Command Reference

  • Print Command Reference

  • Services for Network File System Command Reference

  • Terminal Services Command Reference

  • Windows Server Backup Command Reference


Active Directory Certificate Services Command Reference

Applies To: Windows Server 2008

Active Directory Certificate Services (AD CS) provides customizable services for issuing and managing public key certificates used in software security systems that employ public key technologies. The following commands allow you to issue and manage public key certificates used in software security systems that employ public key technologies.

Command Description

Certreq

Certreq can be used to:

  1. Request certificates from a certification authority (CA).

  2. Retrieve a response to a previous request from a CA.

  3. Create a new request from an .inf file.

  4. Accept and install a response to a request.

  5. Construct a cross-certification or qualified subordination request from an existing CA certificate or request.

  6. Sign a cross-certification or qualified subordination request.

Certutil

Displays certification configuration information, and configures Certificate Services.


Active Directory Domain Services Command Reference

Applies To: Windows Server 2008

Active Directory Domain Services (AD DS) command-line tools are built into Windows Server 2008. They are available if you have the AD DS or Active Directory Lightweight Directory Services (AD LDS) server role installed. To use these tools, you must run them from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

Command | Description
Adprep | Extends the Active Directory schema and updates permissions as necessary to prepare a forest and domain for a domain controller that runs the Windows Server 2008 operating system.
Csvde | Imports and exports data from Active Directory using files that store data in the comma-separated value (CSV) format. You can also support batch operations based on the CSV file format standard.
Dcdiag | Analyzes the state of domain controllers in a forest or enterprise and reports any problems to help in troubleshooting.
Dcpromo | Installs and removes Active Directory Domain Services (AD DS).
Dsacls | Displays and changes permissions (access control entries) in the access control list (ACL) of objects in AD DS.
Dsadd | Adds specific types of objects to the directory.
Dsamain | Exposes Active Directory data that is stored in a snapshot or backup as a Lightweight Directory Access Protocol (LDAP) server.
Dsdbutil | Provides database utilities for Active Directory Lightweight Directory Services (AD LDS).
Dsget | Displays the selected properties of a specific object in the directory.
Dsmgmt | Provides management facilities for Active Directory Lightweight Directory Services (AD LDS).
Dsmod | Modifies an existing object of a specific type in the directory.
Dsmove | Moves a single object in a domain from its current location in the directory to a new location or renames a single object without moving it in the directory tree.
Dsquery | Queries AD DS according to specified criteria.
Dsrm | Deletes an object of a specific type or any general object from the directory.
Ldifde | Creates, modifies, and deletes directory objects on computers running Windows Server 2003 or Windows XP Professional operating systems.
Ldp | Makes it possible for users to perform operations against an LDAP-compatible directory, such as AD DS. These operations include connect, bind, search, modify, add, and delete.
Netdom | Makes it possible for administrators to manage Windows Server 2003 and Windows 2000 domains and trust relationships from a command prompt.
Net computer | Adds or deletes a computer from a domain database.
Net group | Adds, displays, or modifies global groups in domains.
Net user | Adds or modifies user accounts, or displays user account information.
Nltest | Performs network administrative tasks.
Ntdsutil | Provides management facilities for AD DS.
Redircmp | Redirects the default container for newly created computers to a specified target organizational unit (OU) so that newly created computer objects are created in the specific target OU instead of in CN=Computers.
Redirusr | Redirects the default container for newly created users to a specified target OU so that newly created user objects are created in the specific target OU instead of in CN=Users.
Repadmin | Makes it possible for administrators to diagnose Active Directory replication problems between domain controllers running Windows operating systems.
Setspn | Makes it possible for administrators to read, modify, and delete the Service Principal Names (SPN) directory property for an Active Directory service account.


Print Command Reference

Applies To: Windows Server 2008,Windows Vista

The following is a list of Print command-line tools.

Command | Description
Lpq | Displays the status of a print queue on a computer running Line Printer Daemon (LPD).
Lpr | Sends a file to a computer or printer sharing device running the Line Printer Daemon (LPD) service in preparation for printing.
Net print | Displays information about a specified printer queue, displays information about a specified print job, or controls a specified print job.
Print | Sends a text file to a printer.
Prncnfg.vbs | Configures or displays configuration information about a printer.
Prndrvr.vbs | Adds, deletes, and lists printer drivers.
Prnjobs.vbs | Pauses, resumes, cancels, and lists print jobs.
Prnmngr.vbs | Adds, deletes, and lists printers or printer connections, in addition to setting and displaying the default printer.
Prnport.vbs | Creates, deletes, and lists standard TCP/IP printer ports, in addition to displaying and changing port configuration.
Prnqctl.vbs | Prints a test page, pauses or resumes a printer, and clears a printer queue.
Pubprn.vbs | Publishes a printer to the Active Directory directory service.
Rundll32 printui.dll,PrintUIEntry | Enables you to automate the installation and configuration of printers using scripts or the command prompt.


Services for Network File System Command Reference

Applies To: Windows Server 2008,Windows Vista

Services for Network File System (NFS) provides a file sharing solution that enables you to transfer files between computers running Windows Server 2008 and UNIX operating systems using the NFS protocol.

The following is a list of NFS command-line tools.

Command |  | Description
mapadmin | Manage User Name Mapping for Microsoft Services for Network File System.
Mount | Mount Network File System (NFS) network shares.
Nfsadmin | Manage Server for NFS and Client for NFS.
Nfsshare | Control Network File System (NFS) shares.
Nfsstat | Display or reset counts of calls made to Server for NFS.
Rpcinfo | List programs on remote computers.
Showmount | Display mounted directories.
Umount | Remove Network File System (NFS)–mounted drives.


Terminal Services Command Reference

Applies To: Windows Vista,Windows Server 2008

The following is a list of Terminal Services command-line tools.

Command | Description
Change | Changes terminal server settings for logons, COM port mappings, and install mode.
Change logon | Enables or disables logons from client sessions on a terminal server, or displays current logon status.
Change port | Lists or changes the COM port mappings to be compatible with MS-DOS applications.
Change user | Changes the install mode for the terminal server.
Chglogon | Enables or disables logons from client sessions on a terminal server, or displays current logon status.
Chgport | Lists or changes the COM port mappings to be compatible with MS-DOS applications.
Chgusr | Changes the install mode for the terminal server.
Flattemp | Enables or disables flat temporary folders.
Logoff | Logs off a user from a session on a terminal server and deletes the session from the server.
Msg | Sends a message to a user on a terminal server.
Mstsc | Creates connections to terminal servers or other remote computers.
Qappsrv | Displays a list of all terminal servers on the network.
Qprocess | Displays information about processes that are running on a terminal server.
Query | Displays information about processes, sessions, and terminal servers.
Query process | Displays information about processes that are running on a terminal server.
Query session | Displays information about sessions on a terminal server.
Query termserver | Displays a list of all terminal servers on the network.
Query user | Displays information about user sessions on a terminal server.
Quser | Displays information about user sessions on a terminal server.
Qwinsta | Displays information about sessions on a terminal server.
Rdpsign | Enables you to digitally sign a Remote Desktop Protocol (.rdp) file.
Reset session | Enables you to reset (delete) a session on a terminal server.
Rwinsta | Enables you to reset (delete) a session on a terminal server.
Shadow | Enables you to remotely control an active session of another user on a terminal server.
Tscon | Connects to another session on a terminal server.
Tsdiscon | Disconnects a session from a terminal server.
Tskill | Ends a process running in a session on a terminal server.
Tsprof | Copies the Terminal Services user configuration information from one user to another.


Windows Server Backup Command Reference

Applies To: Windows Vista,Windows Server 2008

The following subcommands for wbadmin provide backup and recovery functionality from a command prompt.

To configure a backup schedule, you must be a member of the Administrators group. To perform all other tasks with this command, you must be a member of the Backup Operators or the Administrators group, or you must have been delegated the appropriate permissions.

You must run wbadmin from an elevated command prompt. (To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.)

Subcommand | Description
Wbadmin enable backup | Configures and enables a daily backup schedule. This subcommand applies only to Windows Server 2008.
Wbadmin disable backup | Disables your daily backups. This subcommand applies only to Windows Server 2008.
Wbadmin start backup | Runs a one-time backup. If used with no parameters, uses the settings from the daily backup schedule.
Wbadmin stop job | Stops the currently running backup or recovery operation.
Wbadmin get versions | Lists details of backups recoverable from the local computer or, if another location is specified, from another computer.
Wbadmin get items | Lists the items included in a specific backup.
Wbadmin start recovery | Runs a recovery of the volumes, applications, files, or folders specified. This subcommand applies only to Windows Server 2008.
Wbadmin get status | Shows the status of the currently running backup or recovery operation.
Wbadmin get disks | Lists disks that are currently online. This subcommand applies only to Windows Server 2008.
Wbadmin start systemstaterecovery | Runs a system state recovery. This subcommand applies only to Windows Server 2008.
Wbadmin start systemstatebackup | Runs a system state backup. This subcommand applies only to Windows Server 2008.
Wbadmin delete systemstatebackup | Deletes one or more system state backups. This subcommand applies only to Windows Server 2008.
Wbadmin start sysrecovery | Runs a recovery of the full system (at least all the volumes that contain the operating system's state). This subcommand applies only to Windows Server 2008, and it is only available if you are using the Windows Recovery Environment.
Wbadmin restore catalog | Recovers a backup catalog from a specified storage location in the case where the backup catalog on the local computer has been corrupted. This subcommand applies only to Windows Server 2008.
Wbadmin delete catalog | Deletes the backup catalog on the local computer. Use this command only if the backup catalog on this computer is corrupted and you have no backups stored at another location that you can use to restore the catalog. This subcommand applies only to Windows Server 2008.