Powershell – Install or Uninstall Windows Server 2012 R2 feature

Check existing features

Check available and installed features with the following cmdlet:


To check it in a remote computer, type:

Get-WindowsFeature –ComputerName MYSERVERNAME

Windows Server 2012 R2 features available
These are the available features (different releases may vary output)
Powershell - Install Windows Server 2012 Feature_s001
Install feature
To install .NET Framework 3.5 feature type:

Install-WindowsFeature NET-Framework-Core

To install .NET Framework 3.5 feature defining the corresponding source type:

Install-WindowsFeature NET-Framework-Core –Source D:\sources\sxs\

Doing it on a remote server installing all depending features:

Install-WindowsFeature NET-Framework-Core –ComputerName MYSERVERNAME -IncludeAllSubFeature

If the feature to install requires restart you can specify to do it automatically with the –Restart parameter:

Install-WindowsFeature NET-Framework-Core –ComputerName MYSERVERNAME –IncludeAllSubFeature -Restart

Note: Install-WindowsFeature alias is Add-WindowsFeature
Remote installation on multiple servers
To install a component on more than one server, ejecute:

$multiservers = (‘server01’,’server02’,’server03’)
ForEach ($server in $multiservers) {
Install-WindowsFeature NET-Framework-Core –ComputerName $server –IncludeAllSubFeature –Restart

Uninstall feature
To uninstall a feature on a remote computer and doing a restart if needed, type:

Uninstall-WindowsFeature –Name NET-Framework-Core –ComputerName MYSERVERNAME -Restart

Remove-Item alias:\show
Note: Uninstall-WindowsFeature alias is Remove-WindowsFeature

In Depth

Tested With
PowerShell 4.0

Categories: Powershell | Leave a comment

Post navigation

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Blog at WordPress.com.

%d bloggers like this: