Compartilhar via


Server Manager Command-line Tools

Applies To: Windows Server 2008 R2

Server Manager offers both a set of Windows PowerShell cmdlets and a command-line tool—ServerManagerCmd.exe—to automate the deployment of roles and features on computers that are running Windows Server® 2008 R2.

You can use either Windows PowerShell cmdlets or ServerManagerCmd.exe to install and remove roles, role services, and features. Both Server Manager cmdlets and ServerManagerCmd.exe can display a list of all roles, role services, and features both installed and available for installation on the computer.

Note

Servermanagercmd.exe is deprecated, and is not guaranteed to be supported in future releases of Windows. We recommend that you use the Windows PowerShell cmdlets that are available for Server Manager.

Windows PowerShell and Server Manager

Cmdlets (pronounced command-lets) are built-in command-line tools that are included with Windows PowerShell 2.0, installed by default as part of Windows Server 2008 R2. For more information about Windows PowerShell and how cmdlets work, see the Getting Started guide for Windows PowerShell. To open Getting Started, click Start, click All Programs, click Accessories, click Windows PowerShell 2.0, click Documents, open the folder for your locale, and then double-click GettingStarted.rtf.

To run any Server Manager-related Windows PowerShell cmdlets, you must be running Windows PowerShell with elevated user rights. To do this, click Start, click All Programs, click Accessories, click Windows PowerShell, right-click the Windows PowerShell shortcut, and then click Run as administrator. You must also load the Server Manager module into each new Windows PowerShell session before working with Server Manager cmdlets. To do this, in a Windows PowerShell session opened with elevated user rights, type Import-Module Servermanager, and then press Enter.

Note

For more information about how to start a Windows PowerShell session with all installed modules and snap-ins loaded automatically, see Starting Windows PowerShell with All Modules Loaded.

The following three cmdlets allow you to install, remove, or view information about available roles by using Windows PowerShell. For more information about how to use any of these cmdlets, in a Windows PowerShell session, enter Get-Helpcmdlet_name-full, in which cmdlet_name represents one of the following values.

  • Add-WindowsFeature

  • Get-WindowsFeature

  • Remove-WindowsFeature

In this section

This section contains the following topics.

Overview of Server Manager Commands

Creating an Answer File for Server Manager Commands

Interpreting Output from Server Manager Commands

Starting Windows PowerShell with All Modules Loaded