Skip navigation
Command-line Tools in Windows Server 2008

Command-line Tools in Windows Server 2008

Manage servers, make backups, and customize your system with these great tools

 

Executive Summary:

Windows Server 2008 provides command-line tools for managing your Microsoft Windows systems. You can use Icacls to update and back up access control lists (ACLs), Wbadmin or Robocopy for system backups, and WinRS to open a secure command window with a remote host. Oclist and Ocsetup are tools that work only with Server Core installations. ServerManagerCmd, a command-line version of Windows Server 2008's Server Manager, lets you script Server Manager actions.

Like every release of the Windows Server OS before it, Windows Server 2008 includes a set of new command-line tools, some of which come from previous resource kits or support tools and others are new. Although Server 2008 includes Windows PowerShell, none of these new commands are PowerShell commands. For a complete list of commands in Server 2008, you can download the Windows Command Reference from Microsoft’s website. Here are my favorite new commands in Server 2008. (See also, RSAT: Windows Server 2008 Remote Server Admin Tools" and "Windows 7 and Server 2008 R2 Tool Records Symptoms.")

10. Oclist—Microsoft added the command-oriented Server Core as an installation option for Server 2008, and it has its own commands. Oclist queries the installed roles on your Server Core system. To list the status of all Server Core roles, you can run the command

oclist

9. Ocsetup—The Ocsetup command is used to install and remove roles and features from a Server Core system. The following example shows how to add the DHCP Server role:

start /w ocsetup DHCPServerCore

8. Bcdedit—Like Windows Vista, Server 2008 uses a new boot process that saves the system boot configuration in the Boot Configuration Data (BCD) store. The primary tool for editing Server 2008’s BCD store is the Bcdedit command, which supports many command-line options. To list the contents of the store, run

bcdedit /enum

7. Icacls—The Icacls command replaces the older Cacls and Xacls commands. Icacls lets you list, update, and back up the ACLs for files and directories. The following example shows how you can save the ACLs for the C:\temp directory:

icacls c:\temp /save tempacl

6. Mklink—The Mklink command creates a symbolic link in the file system that redirects all requests to a location you specify. Symbolic links are transparent to users, appearing as normal files or directories. The following example shows how to create a symbolic link named alsotemp for the C:\temp directory:

mklink /d alsotemp c:\temp

5. Robocopy—A staple in the Windows Resource Kit for years, Robocopy is more capable than the standard Windows Copy and Xcopy commands, and it’s able to resume after network outages as well as correctly copy file attributes, alternate streams, and security information. The following example shows how to use Robocopy to create a mirrored copy of the MyData directory and all its subfolders on the share named Backups on MyServer:

robocopy "C:\MyData" "\\MyServer\Backups" /MIR /R:2 /NP

4. Wbadmin—Wbadmin is used for Server 2008 backup and restore operations. The following example shows how to use Wbadmin to perform a full system backup to the share named Backups on MyServer: wbadmin start backup -backuptarget \\MyServer\Backups

-allCritical -vssFull

3. WinRS—The WinRS command lets you open a secure command window with a remote host. All communications between the client and the host are encrypted using Kerberos or NT LAN Manager (NTLM) keys. The following example connects to the server named MyServer and displays the command shell:

winrs -r:MyServer cmd

2. Appcmd—Appcmd.exe is a new command-line tool that can be found in the \%WinDir%\System32\InetSrv directory. Appcmd is used to query, create, and configure Microsoft IIS 7.0 server properties, Web sites, and application pools. To list all sites on the system, you can use the following command:

appcmd list sites

1. ServerManagerCmd—Without a doubt, the coolest commandline tool in Server 2008 is ServerManagerCmd.exe, which is the command-line version of the new Server Manager. This command essentially lets you script all of the Server Manager actions. To list all the installed roles and features on a Server 2008 system, you can enter

servermanagercmd.exe -query

 

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish