Windows Server 2012 introduced a new feature that makes it very easy to build like servers. Although the use of templates in VMware is also useful for this purpose, the ability to clone features and roles between servers is useful during experimentation and preparation for building a template.

Once you have a server configured and built with all of the features and roles installed that you’d like to use, run the following command from an elevated Powershell:

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

To duplicate the installed features and roles onto another server, after the OS install, open an elevated Powershell and run the following commands:

$ServerFeatures = Import-Clixml \\server\share\ServerFeatures.xml
foreach ($feature in $ServerFeatures) {Install-WindowsFeature -Name $}

If you have some features or roles to install that require a different source location, such as .NET Framework 3.5, you can do something like this instead (where E:\ represents a still-mounted installation ISO):

foreach ($feature in $ServerFeatures) {if ($feature.displayname.Contains("3.5")) {Install-WindowsFeature -Name $ -Source E:\sources\sxs\} else {Install-WindowsFeature -Name $}}

You should then see a screen like the one shown below as the process loops through all of the features and roles and installs them onto the server.

Screen Shot 2013-10-08 at 2.35.45 PM