Installing a windows feature using the application model

July 16, 2015 at 6:18 pm in CM12, CM12 R2, ConfigMgr, SCCM by Kurt Depre

Hi All,

Recently I had the requirement to install IIS + some features on Windows 7 machines using the application model. After some searching this was fairly easy to accomplish using Dism and a script detection method. Let’s do this step by step.

1. Create a new Application and select “Manually specify the application information”

clip_image002

2. Fill out the application information and application catalog metadata pages and click next to go to the Deployment types page.

clip_image004

clip_image006

3. Click Add on the deployment type page to create a new DT.

clip_image008

4. Select “Script Installer” and “Manually specify the deployment type Information” and click next

clip_image010

5. Give your Deployment type a name and click next.

clip_image012

6. Leave content location empty and set the following as installation program (depends on the feature you want to install, to find a list with windows features you can use the following command: Dism.exe /Online /Get-features):

DISM.exe /Online /Enable-Feature /FeatureName: <NameOftheFeatureToEnable>

In my example it will be the following:

DISM.exe /Online /Enable-Feature /FeatureName:IIS-ASP /FeatureName:IIS-ASPNET /FeatureName:IIS-BasicAuthentication /FeatureName:IIS-WindowsAuthentication /FeatureName:IIS-NetFxExtensibility /FeatureName:IIS-ISAPIExtensions /FeatureName:IIS-ISAPIFilter /FeatureName:IIS-RequestFiltering /FeatureName:IIS-StaticContent /FeatureName:IIS-ManagementConsole /FeatureName:IIS-WebServer /FeatureName:IIS-WebServerRole /FeatureName:IIS-CommonHttpFeatures /FeatureName:IIS-DefaultDocument /FeatureName:IIS-DirectoryBrowsing /FeatureName:IIS-HttpErrors /FeatureName:IIS-HttpLogging /FeatureName:IIS-HttpRedirect

clip_image014

7. On the detection method page select “Use a custom script to detect the presence of this deployment type” and click edit to add the script

clip_image016

8. Select PowerShell and paste a script similar to mine (change or remove feature names to detect to match your scenario).

You can download the example script here : FeatureDetection.zip

clip_image018

9. Configure the User Experience, Requirements (maybe limit the OS here) and Dependency settings to match you scenario.

10. Click next a few time to confirm the creation of the Deployment type and the application

11. Deploy and test.

Till next time

Kurt

PS: If anyone has a better script to perform the detection feel free to share it