Install Windows Roles and Features Using a Template Server

Install Windows Roles and Features Using a "Template" Server

If you've ever found yourself referencing an existing server build's installed windows features to deploy a new system with the same or similar build, then this will be a time saver for you.

The following PowerShell code can be run on the local system. It will need WinRM access to the source machine.

PS> $SourceMachine = "MyComputer"
PS> Get-WindowsFeature -ComputerName $SourceMachine | Where {$_.Installed -eq "Installed"} | Install-WindowsFeature

Now that you have this morsel, you can play with it to help automate your build process further. For example, the Install-WindowsFeature cmdlet also supports the -ComputerName parameter, and accepts arrays, so you could, for example, deploy the identical set of Windows Features to all 4, 8 or 16+ cluster nodes simply by suppliing the comma separated list of computer names, such as:

PS> Install-WindowsFeature {FEATURE} -Computer "targetA","targetB"

How did you use this script? Post a comment and let us know.

No comments :

Post a Comment