Monday, August 7, 2017

Can't Install-WindowsFeature on Windows Server using PowerShell

Scenario:

You can't Install-WindowsFeature (Add-WindowsFeature for 2008 R2) on Windows Server using PowerShell for various reasons.
Recently I had a problem with broken WMI where I couldn't manage Windows Server features of affected server. My wish was to make Full Server backup prior to any changes using built-in "Windows Server Backup" and I couldn't install this feature using PowerShell.

Solution:

Following DISM commands running from an Elevated Command Prompt (Admin) saved my ass:
Dism /online /enable-feature /featurename:WindowsServerBackup
 
Deployment Image Servicing and Management tool
Version: 6.3.9600.17031

Image Version: 6.3.9600.17031
 
Enabling feature(s)
[==========================100.0%==========================]
The operation completed successfully.
Dism /online /enable-feature /featurename:WindowsServerBackupSnapin
 
Deployment Image Servicing and Management tool
Version: 6.3.9600.17031
 
Image Version: 6.3.9600.17031
 
Enabling feature(s)
[==========================100.0%==========================]
The operation completed successfully.
You can install any Windows feature in similar way. Get list of all available features and their names on server:
Dism /online /get-features /format:table | more
References: