Powershell – What’s the difference between Remove-WindowsFeature and Uninstall-WindowsFeature

powershell

What's the difference between Remove-WindowsFeature and Uninstall-WindowsFeature?

I've used Add- and Remove- on Windows 2008 R2 boxes, but there is now an Install- and Uninstall- which according to MSDN is only on Windows 2012 and 8

Best Answer

There's a subtle difference in behavior that the 2012 version "optionally removes" the feature, and that IncludeManagementTools must be included as a parameter to remove the management console as part of the uninstallation of the feature, and Remove must be included to remove the feature files from the computer that would allow the feature to be reinstalled.

All other differences are clear by their presence/omission in the documentation.

Remove-WindowsFeature (2008 R2 documentation):

The Remove-WindowsFeature cmdlet has been replaced in Windows Server 2012 and forward by the Uninstall-WindowsFeature cmdlet.

[...]

The Remove-WindowsFeature cmdlet allows you to remove specified roles, role services, and features from a computer that is running Windows Server 2008 R2. The Remove-WindowsFeature cmdlet functions similarly to the Remove Roles Wizard and Remove Features Wizard that you can start from the Server Manager UI. As in those wizards, you can remove more than one role, role service, or feature per session. You can find a list of command IDs for all roles, role services, and features in the topic Overview of Server Manager Commands in the Server Manager Help.

From: http://msdn.microsoft.com/en-us/library/ee662310.aspx

Uninstall-WindowsFeature (2012 Documentation):

By adding the Remove parameter, also deletes feature files, or payload, from a computer.

[...]

The Uninstall-WindowsFeature cmdlet uninstalls and optionally removes specified roles, role services, and features from a computer that is running Windows Server 2012 R2, or from an offline virtual hard disk (VHD) on which Windows Server 2012 R2 is installed. This cmdlet works similarly to the Remove Roles and Features Wizard in Server Manager, with an important exception: by default, management tools are not uninstalled when you run the Uninstall-WindowsFeature cmdlet; you must add the IncludeManagementTools parameter to uninstall associated management tools.

From: http://technet.microsoft.com/en-us/library/jj205471.aspx

Related Topic