Useful Run Commands
Useful Run Commands
With the introduction of Windows Server 2003 came some new command line utilities designed
to make server and network administration easier. Plus most of the Windows 2000 commands
are there as well. Here is a listing of many of the commands and what they do.
cipher.exe
Cipher.exe is a command-line tool that you can use to manage encrypted data by using the
Encrypting File System (EFS).
cmdkey.exe
cmdkey.exe enables you to manage Stored Usernames and Passwords from the command
prompt. It displays, creates, and deletes stored usernames and passwords.
defrag.exe
defrag.exe is the command prompt equivalent of Disk Defragmenter. defrag.exe does
everything that Disk Defragmenter does and in addition, it supports scripting. You can use
defrag.exe in a script to schedule analysis and defragmentation of your servers. Scripting is the
primary reason to use defrag.exe instead of Disk Defragmenter. sfc.exe
devcon.exe
The Device Console Utility is a command-line utility that can be used as an alternative to Device
Manager. It provides a level of detail that is not available in Device Manager.
dsadd.exe
dsadd.exe adds objects to Active Directory. dsadd.exe can add computer, contact, group,
organization unit, or user objects.
dsmod.exe
dsmod.exe modifies attributes of objects in Active Directory. dsmod.exe can modify computers,
contacts, groups, servers, organization units, users, quotas, and partitions.
dsget.exe
dsget.exe is used to see the properties of objects in Active Directory. It shows selected
attributes of computers, contacts, groups, organizational units, servers, or users. You input
objects into dsget.exe and it outputs a list of properties for those objects.
dsmove.exe
dsmove.exe moves a single object to a new location in the same domain. However, it will also
rename a single object without moving it.
dsquery.exe
dsquery.exe enables you to query Active Directory for objects that match a specified criterion.
This is useful if you need to search all of AD for objects that have similar characteristics.
diskpart.exe
diskpart.exe enables you to manage disks, partitions, or volumes from the command prompt.
You can type the commands directly at the command prompt via interactive mode or you can
configure diskpart.exe to use a script for its input.
eventcreate.exe
The eventcreate.exe utility creates an event in a specified event file. The valid event files are
Application and System logs. You cannot enter events in the Security log with this utility. You
must have administrator access to use this utility to enter entries into the application and system
logs. The Application log is the default log file for this utility.
eventtriggers.exe
eventtriggers.exe is a tool used to configure and manage triggers on event logs. A trigger is a
mechanism that initiates a new process or action when a threshold is met.
fsutil.exe
You can use fsutil.exe to manage FAT and NTFS file systems from the command prompt. Some
of the actions you can perform with this utility include the following:
gpresult.exe
gpresult.exe displays the Resultant Set of Policy (RSoP) information for a target user and
computer. RSoP is a tool that can show the effective policy applied to a user or computer or
what the policy would be, for planning purposes.
logman.exe
The logman.exe command-line utility manages and schedules performance counters. You can
also use it to manage and schedule trace logs. You can use this utility on a remote computer
provided you have the proper administrator credentials.
relog.exe
You can use relog.exe to extract data from performance counter logs and convert it to tab
separated value (.TSV), Comma-Separated Value (.CSV), binary log file (.BLG), or SQL
formats. This tool is commonly used to extract logs to Excel spreadsheets and to resample logs
and create new ones that are based on a particular time period, sampling interval, or specified
counters. It can also be used to create source data files for database manipulation tools.
rendom.exe
The Domain Rename tool allows you to rename any of your domains, as long as all domain
controllers in the forest are running Windows Server 2003. It allows you to restructure domains
within a tree and create new trees. However, it does not allow you to change which domain is
the forest root. In addition, you cannot add and remove domains from the forest; you can only
rename them and you can’t reuse names.
rss.exe
rss.exe manages Remote Storage from the command prompt. You can use Remote Storage to
extend your server’s disk space by moving data off your hard disks and onto magnetic tapes or
magneto-optical (MO) disks, with file data cached locally for quick access.
sfc.exe
The System File Checker (sfc.exe) is a command-line tool that can be used for initiating on-
demand and boot-time scans, as well as managing the contents of the Windows File Protection
cache folder.
sigverif.exe
File Signature Verification Tool is a wizard-driven tool, which scans the system for the presence
of unsigned drivers and critical system files. It also creates a report that lists all the files scanned
along with relevant version and digital signature information. The report is stored in your
Windows directory and is called sigverif.txt.
sc.exe
The Service Control utility is used to communicate with both services and with device drivers.
The functionality provided is only a subset of the Device Console utility focused on device
drivers themselves; however, unlike the Device Control Utility, the Service Control Utility is
installed with Windows Server 2003.
schtasks.exe
You use schtasks.exe to set programs to run at scheduled intervals, delete or change existing
scheduled tasks, and stop or run a scheduled task immediately.
setx.exe
You use setx.exe to configure environment variables for either the user (the variables apply only
to a specific user) or the system environment (variables apply to all users).You can set variables
explicitly by specifying their value or using the value of a registry key or the contents of a file.
setx is the only way to permanently (i.e., remembered between reboots) set a variable name via
the command line.
shutdown.exe
Use the shutdown.exe command to shut down or restart local or remote computers. You can
also use it for shutting down several computers at once using the /i option. With this option, a
new window appears where you add the names of the computers that you want to shut down or
restart.
tasklist.exe
tasklist.exe shows all the tasks that are running on the local or remote computer.
typeperf.exe
typeperf.exe is similar to relog.exe; this utility enables you to write performance log file data onto
a command window or a file. This functionality distinguishes this tool from relog.exe.
taskkill.exe
Use taskkill.exe to terminate processes on the local or a remote computer. You need to use
tasklist first to identify the process that needs to be terminated. Taskkill has many options and if
used without care you could end up ending more processes than you expected.
takeown.exe
Another command-line tool useful for managing files is takeown.exe. As you might guess, this
tool enables the user to change the ownership of a file or files specified on the command line.
Takeown can set the new owner of a file as a specific user or as the administrators group,
depending on the command-line parameters used. By default, takeown assigns the user of a file
to be the user who ran the tool.
tracerpt.exe
The tracerpt.exe command-line utility generates a report for the event traces.
whoami.exe
whoami.exe displays usernames and group membership information about the currently logged-
on user. It can display the security identifier (SID) and all privileges assigned to that SID.
Notes: The /r means 'keep on looking'. Observe the space between /r and e:\
and also the space between e:\ and *.log. Where is flexible, and will search
for any file pattern that you can think of, for example, *.ini or W*.inf.
From the command line, you can shut down or reboot any Windows Server 2003 computer (or even
Windows XP or Vista machines) with the Shutdown.exe command. (Note: The exe file extension is
optional for the Shutdown command.) Shutdown.exe contains a number of switches that allow you to
specify different actions for the server when the Shutdown command executes. The Shutdown.exe
switches are as follows:
/i Displays the graphical user interface (GUI); it must be the first option
/l Logs off the current user; it cannot be used with the /d or /m options
/g Shuts down and restarts the computer and then restarts any registered applications
When you enter a Shutdown with no arguments, the Help listing will display. The Help listing also
includes the reason codes available for use with the /d switch. The reason codes are shown below:
U 0 0 Other(Unplanned)
E 0 0 Other(Unplanned)
EP 0 0 Other(Planned)
E 1 1 Hardware: Maintenance(Unplanned)
EP 1 1 Hardware: Maintenance(Planned)
E 1 2 Hardware: Installation(Unplanned)
EP 1 2 Hardware: Installation(Planned)
2 Operating System:
E 4
Reconfiguration (Unplanned)
Operating System:
EP 2 4
Reconfiguration(Planned)
Operating System:
P 2 16
Service Pack (Planned)
Operating System:
U 2 17
Hotfix (Unplanned)
Operating System:
P 2 17
Hotfix(Planned)
Operating System:
U 2 18
Security Fix(Unplanned)
Operating System:
P 2 18
Security Fix(Planned)
E 4 1 Application: Maintenance(Unplanned)
EP 4 1 Application: Maintenance(Planned)
EP 4 2 Application: Installation(Planned)
E 4 5 Application: Unresponsive
E 4 6 Application: Unstable
E 5 19 Security Issue
U 5 19 Security Issue
EP 5 19 Security Issue
You can use many of these switches in conjunction with one another when issuing the Shutdown
command. A usage example for the Shutdown command follows:
All Run commands
RUN Commands
Useful RUN Commands – I
System File Checker Utility (Scan Once At Next Boot) – sfc /scanonce
Anonymous 9/28/06 System File Checker Utility (Set Cache Size to size x) -
sfc /cachesize=x
Wordpad – write