In Windows 2012 it’s possible to add a source path to the Add-WindowsFeature and Install-WindowsFeature cmdlet. This may be necessary when the source files needed to install a feature are not locally cached on your server. In the example below, I tried to install NET-Non-HTTP-Activ, required for my SQL/SCCM installation
PS C:\Users\Administrator> Install-windowsfeature NET-Non-HTTP-Activ
Install-windowsfeature : The request to add or remove features on the specified server failed.
Installation of one or more roles, role services, or features failed.
The source files could not be downloaded.
Use the “source” option to specify the location of the files that are required to restore the feature. For more
information on specifying a source location, see http://go.microsoft.com/fwlink/?LinkId=243077. Error: 0x800f0906
At line:1 char:1
+ Install-windowsfeature NET-Non-HTTP-Activ
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (@{Vhd=; Credent…Name=localhost}:PSObject) [Install-WindowsFeature],
Exception
+ FullyQualifiedErrorId : DISMAPI_Error__Cbs_Download_Failure,Microsoft.Windows.ServerManager.Commands.InstallWindowsF
eatureCommand
To resolve this issue, you should mount your Windows2012 image to your CD/DVD drive, or just insert the DVD 😉 and then add the source option to your cmdlet. The cmdlet will then look like:
Install-windowsfeature NET-Non-HTTP-Activ –Source D:\Sources\Sxs
You can also specify a WIM-File to look for source files. Then use
Install-windowsfeature NET-Non-HTTP-Activ -Source wim:<path>:<index>
i.e.
Install-windowsfeature NET-Non-HTTP-Activ -Source wim:C:\win2012.wim:1
Thanks Christian. Helped me today install some updates for a 2012 server which has GP set up with an internal update source.
Mounting the iso and specifying the sxs folder did the trick.
What if you are place multiple cmdlets like below?
Add-WindowsFeature NET-Framework-Features,RSAT-Clustering,Web-Mgmt-Console,WAS-Process-Model,Web-Basic-Auth,Web-Lgcy-Mgmt-Console,Web-Metabase,Web-Net-Ext,Web-Server,Web-Windows-Auth -Restart