This shows how to install Windows Features with a Template XML instead of defining each feature. You may check list of WindowsFeatures installed on a Server.
Table of Contents
Create a Template XML using Server Manager
Log on to a Server that can be used to create a Template.
At Server Manger -> select ‘Add Roles and Features’ -> click desired roles and features
At the Confirmation window, select “Export configuration settings”
Save as an XML file, such as DeploymentConfigTemplate.xml
Install the selected Roles and Features with the template XML on Target Server
With the XML, run simple lines to apply the selected Roles and Features.
import-module servermanager Install-WindowsFeature -ConfigurationFilePath C:\Temp\DeploymentConfigTemplate.xml
Run:
Wait until the installation is completed.
PS output shows success/failure, and also reports if a Reboot is needed or not.
Install with optional Source path
If selected Server Features require additional sources such as for NET 3.5, the above command may not be enough. If the command line asks -Source, specify -Source as an optional parameter. For .NET 3.5, \sources\sxs folder from Windows Server OS ISO can be used.
import-module servermanager $sourceDir = 'C:/sources/sxs/' Install-WindowsFeature -ConfigurationFilePath C:\Temp\DeploymentConfigTemplate.xml –Source $sourceDir
Check if the desired Roles and Features installed
You may check list of Windows Features correctly installed on a Server.
Get-WindowsFeature | where{$_.InstallState -eq "Installed"}