Removing Server Roles and Features

Applies To: Windows Server 2008 R2

Tools in Windows Server® 2008 R2 let you remove server roles and features with ease. You can remove roles or features by using the Remove Roles or Remove Features wizards, Windows PowerShell, or a command line.

How to remove roles or features from the server

In Windows Server 2008 R2, you can remove roles or features from the server by using any of the following three procedures.

In the Roles Summary or Features Summary areas of the Server Manager main window, click either Remove Roles or Remove Features, depending on the software that you want to remove. Follow the instructions that are provided by the wizard as you progress through the removal.

To remove roles or features by using Windows PowerShell

Open a Windows PowerShell session 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.

Load the Server Manager module into the Windows PowerShell session before working with Server Manager cmdlets. Type the following, and then press Enter.

Import-Module Servermanager

Note

Windows PowerShell cmdlets are not case-sensitive.

If you do not know the command name of the role, role service, or feature that you want to remove, type the following, and then press Enter to return a list of all command names in the Name column. The command name is required for the next step.

Get-WindowsFeature

Type the following, in which name represents the command name of the role, role service, or feature that was obtained in the previous step, and then press Enter to remove a role or feature. The -restart parameter restarts the computer automatically after removal is complete, if a restart of the computer is required.

Remove-WindowsFeaturename-restart

You can remove multiple roles, role services, and features by using commas to separate the command names, as shown in the following example.

Remove-WindowsFeature Application-Server,Hyper-V,WAS

Note

For detailed information about other parameters that you can use with the Remove-WindowsFeature cmdlet, enter Get-Help Remove-WindowsFeature -full, or see Overview of Server Manager Commands.

To remove roles or features by using a command line

Open a Command Prompt window with elevated user rights. 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.

If you do not know the command name of the role, role service, or feature that you want to remove, type the following, and then press Enter to return a list of all roles, role services, and features that are available on the computer, together with their command names.

ServerManagerCmd.exe -query

Note

Windows Command Prompt commands are not case-sensitive.

Type the following, in which name represents the command name of the role, role service, or feature that you want to remove, and then press Enter. The -restart parameter restarts the computer automatically after removal is complete, if a restart of the computer is required.

ServerManagerCmd.exe -removename-restart

You can remove multiple roles, role services, and features by using spaces to separate the command names, as shown in the following example.

ServerManagerCmd.exe -install Application-Server Hyper-V WAS -restart

When removal is complete, verify that the roles, role services, and features were removed from the computer by typing the following, and then pressing Enter. Installed roles, role services, and features are highlighted in the query results.

ServerManagerCmd.exe -query

The Remove Roles Wizard

The Remove Roles Wizard simplifies the removal of roles from your server, and allows you to remove multiple roles at one time. You no longer have to open Add or Remove Windows Components multiple times to remove more than one role, role service, or feature installed on the server. A single session in the Remove Roles Wizard can complete the configuration of the server.

Before removing any roles, the Remove Roles Wizard verifies that no software components that are required by any of the remaining roles are removed accidentally. If it is necessary, the wizard prompts you to approve the removal of other roles, role services, or software programs that are required by roles that remain installed. The risk of removing software upon which other roles depend is almost eliminated.