Hi SysAdmins
Did you ever wonder how SCCM 2012 install a DP remotely from the CM console?
DISM.exe (Deployment Image Servicing and Management tool) is a command line tool that you can use to enable or disable Windows features.
In this case we use it to install all the necessary IIS features for a SCCM 2012 DP.
Command line to install IIS on DPs:
[label type=”label” style=”default” title=”Code:”]
dism.exe /online /norestart /enable-feature /ignorecheck /featurename:”IIS-WebServerRole” /featurename:”IIS-WebServer” /featurename:”IIS-CommonHttpFeatures” /featurename:”IIS-StaticContent” /featurename:”IIS-DefaultDocument” /featurename:”IIS-DirectoryBrowsing” /featurename:”IIS-HttpErrors” /featurename:”IIS-HttpRedirect” /featurename:”IIS-WebServerManagementTools” /featurename:”IIS-IIS6ManagementCompatibility” /featurename:”IIS-Metabase” /featurename:”IIS-WindowsAuthentication” /featurename:”IIS-WMICompatibility” /featurename:”IIS-ISAPIExtensions” /featurename:”IIS-ManagementScriptingTools” /featurename:”MSRDC-Infrastructure”
If you prefer using Powershell, use the following cmdlets instead:
[label type=”label” style=”default” title=”Code:”]
Import-Module servermanager
Add-WindowsFeature “IIS-WebServerRole”, “IIS-WebServer” ,”IIS-CommonHttpFeatures” ,”IIS-StaticContent” ,”IIS-DefaultDocument” ,”IIS-DirectoryBrowsing” ,”IIS-HttpErrors” ,”IIS-HttpRedirect” ,”IIS-WebServerManagementTools” ,”IIS-IIS6ManagementCompatibility” ,”IIS-Metabase” ,”IIS-WindowsAuthentication” ,”IIS-WMICompatibility” ,”IIS-ISAPIExtensions” ,”IIS-ManagementScriptingTools” ,”MSRDC-Infrastructure”
Both of the above methods work from the command line or Powershell console window. It is preferred to save and run the code as a batch or .ps1 script.
I hope this has been helpful for you.
In Server 2012, the command line does not work unless you remove the quotation marks around each featurename.