Duplicate Windows Roles, Role Services and Features on a another server

By using Windows Powershell and importing the Server Module this can allow for existing roles, role services and features to be duplicated on a destination server. By following the below steps:

1) In order to get the information regarding the installed roles, role services and features we will first need to import the ‘Server Manager’ module into the current powershell session on the source server which contains the roles, role services and features we wish to duplicate to a destination server;

Import-Module ServerManger

2) We will want to retrieve the information regarding the installed  roles, role services and features. We will want to duplicate the role services on the destination sever we will include a filter to retrieve all the installed features and then provide a second filter to only contain those with role services installed. The information will be exported to an XML object which in the below example is a UNC path.

Get-WindowsFeature | Where-Object {$_.Installed  -eq “True”} | Where-Object {$_.SubFeatures.Count -eq 0} | Export-Clixml \\Servername\share\features.xml

3) We will now connect to the destination server we wish to duplicate the roles, role services and features and as in Step 1 import the ‘Server Manager’ module into the current powershell session.

Import-Module ServerManager 

4) We will now need to import the roles, role services and features retrieved from the source server into variable by importing the XML object created in Step 2.

$Features= Import-Clixml \\Servername\Share\Features.xml

5) The variable can be used to pipe all the role, role services and features retrieved from the source server to the Add-WindowsFeature cmdlet to install;

$Features = Add-WindowsFeature

6) Restart the computer if required following the installation of the roles, roles services and features.


2 thoughts on “Duplicate Windows Roles, Role Services and Features on a another server

  1. What if the server names between the exported XML file and the destination server are different? Like in export it is SERVER-1234 but destionation server is SERVER-5678?

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s