Uninstall-WindowsFeature
Uninstall-WindowsFeature
Uninstalls and removes specified Windows Server roles, role services, and features from a computer.
Aliases
The following abbreviations are aliases for this cmdlet:
- Remove-WindowsFeature
Syntax
Parameter Set: RunningComputer
Uninstall-WindowsFeature [-Name] <Feature[]> [-ComputerName <String> ] [-Credential <PSCredential> ] [-Force] [-IncludeManagementTools] [-LogPath <String> ] [-Remove] [-Restart] [-Confirm] [-WhatIf] [ <CommonParameters>]
Parameter Set: VhdPath
Uninstall-WindowsFeature [-Name] <Feature[]> [-ComputerName <String> ] [-Credential <PSCredential> ] [-Force] [-IncludeManagementTools] [-LogPath <String> ] [-Remove] [-Vhd <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]
Detailed Description
The Uninstall-WindowsFeature cmdlet uninstalls and removes specified roles, role services, and features from a computer that is running Windows Server® “8” Beta or an offline virtual hard disk (VHD) that has Windows Server “8” Beta installed on it. The cmdlet provides an alias Remove-WindowsFeature for backward compatibility.
Parameters
-ComputerName<String>
Uninstalls and optionally removes the list of available role, role services and features from the specified remote computer. Accepts only one computer name. The default is the local computer.
The NetBIOS name, an IP address, or a fully qualified domain name of a remote computer can be specified. Note: The target computer should be running Windows Server “8” Beta.
To use an IP address in the value of this parameter, the cmdlet must include the Credential parameter. The computer must also be configured for HTTPS transport or the IP address of the remote computer must be included in the WinRM TrustedHosts list on the local computer. For instructions for adding a computer name to the WinRM TrustedHosts list, see How to Add a Computer to the Trusted Host List in about_Remote_Troubleshooting.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Credential<PSCredential>
Specifies a user account to perform the action. The default is the current user.
Enter a user name in one of the following formats surrounded by quotes:
● "UserName"
● "Domain\User"
● "User@Domain.com"
● A Credential object returned by the Get-Credential cmdlet.
If a user name is typed, then a prompt for a password with be displayed.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Force
"This parameter is deprecated."
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-IncludeManagementTools
Specifies the uninstallation of all applicable management tools along with the roles, role services, or features named in the Name parameter.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-LogPath<String>
Specifies a name and location for a log file. Add this parameter if the results of this cmdlet must be stored in a log.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Name<Feature[]>
Specifies a list of features to install. This parameter does not support wildcard characters. If this parameter is specified, then the ConfigurationFilePath parameter cannot be used.
Aliases |
none |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
True (ByValue) |
Accept Wildcard Characters? |
false |
-Remove
Uninstalls and then deletes the specified features from the side-by-side store, located at %SystemDrive%:\Windows\WinSxS
.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Restart
Specifies that the target computer restarts if required at the end of the uninstallation. This parameter cannot be used with the Vhd parameter.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Vhd<String>
Specifies the path to an offline VHD. The path can point to a VHD file or to a location on which the VHD is already mounted using Deployment Image Servicing and Management (DISM) tools.
The VHD can be present on a local hard disk attached to the target computer or on a network share.
If the VHD is present on a network share, then specify the UNC path to the VHD. In this case, the computer account in which the VHD is mounted must have read and write permissions on the network share, otherwise the VHD cannot be accessed. Local loopback UNC paths are not supported. Use the following format for the computer account: DOMAIN\SERVERNAME$
Use the ComputerName parameter to specify the target computer to be used for mounting the VHD. If the ComputerName parameter is not specified, then the local computer is used. The computer on which the VHD is mounted must be running Windows Server “8” Beta. Any local path, such as D:\myFolder
, specified with this parameter is always relative to the target computer.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Confirm
Prompts you for confirmation before running the cmdlet.
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
<CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
- System.String[]
- Microsoft.Windows.ServerManager.Commands.Feature
Outputs
The output type is the type of the objects that the cmdlet emits.
- Microsoft.Windows.ServerManager.Commands.FeatureOperationResult
Examples
EXAMPLE 1
This example uninstalls any roles or features that are currently installed on the target server.
PS C:\> Get-WindowsFeature | Where-Object -FilterScript { $_.Installed -Eq $TRUE } | Uninstall-WindowsFeature
EXAMPLE 2
This example removes the Web Server role on Server1, including all role services.
PS C:\> Uninstall-WindowsFeature -Name Web-Server -ComputerName Server1 -Credential contoso\johnj99
EXAMPLE 3
This example removes any roles or features that are currently not installed on the target server.
PS C:\> Get-WindowsFeature | Where-Object -FilterScript { $_.Installed -Eq $TRUE } | Uninstall-WindowsFeature -Remove