Pages

Search This Blog

Wednesday, September 12, 2012

Windows Server roles and features duplication on multiple servers using PowerShell

In the process of servers preparation you may have multiple servers which will play the same role and thus require installation of the same Windows Server role(s) , role service(s) and feature(s) .

Most of admins do it the hardest way , by installing the role(s) , role service(s) and feature(s) names(s) for each server using Server Manager Sad smile.

An alternative way to be used is to install all required role(s) , role service(s) and feature(s) on a single server , export it to .XML file and then use the exported file to automate installation of the remaining servers .

Here is how to do :

  • Source Server Preparation : Install the required role(s) , role service(s) and feature(s) normally on one server using the traditional way ( Server Manager )
  • Once installation is completed , start an elevated Windows PowerShell Modules

image

  • At the elevated Windows PowerShell Modules window export list of installed role(s) , role service(s) and feature(s) by executing the following command , replacing the UNC path in bold with valid path for your servers ( UNC or local paths can be used , but UNC is preferred to be enhance accessibility )

Get-WindowsFeature | ? { $_.Installed -AND $_.SubFeatures.Count -eq 0 } | Export-Clixml \\server\share\features.xml

image

  • Here it proceeds with data collecting , then generates the XML file

image

image

  • As soon as you got your .XML file , go to one of the target servers , start an elevated Windows PowerShell Modules windows and execute the following commands

$Features = Import-Clixml \\server\share\features.xml

$Features | Add-WindowsFeature

image

image

  • Once completed , you can restart the server by executing Restart-Computer and you are done !
  • No comments:

    Post a Comment