With the introduction of Windows Server 2003 came some new command line utilities designed to make server and network administration easier. These commands are used to configure and repair the operating system and its components and many times the only way to perform a certain task is with a command line. Many people tend to be afraid of the command line but once you get used to it, it’s not too bad at all and you will find it’s a powerful tool that you will use all the time. These availability of these commands might vary depending on what version of Windows you are using. Here is a listing of many of the commands and what they do.
Cipher.exe is a command-line tool that you can use to manage encrypted data by using the Encrypting File System (EFS).
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 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
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 adds objects to Active Directory. dsadd.exe can add computer, contact, group, organization unit, or user objects.
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 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 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 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 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.
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 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.
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:
- Managing sparse files
- Managing reparse points
- Mounting and dismounting volumes
- Viewing the amount of free space on a volume
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.
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.
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.
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 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.
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.
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.
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.
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.
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.
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 shows all the tasks that are running on the local or remote computer.
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.
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.
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.
The tracerpt.exe command-line utility generates a report for the event traces.
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.