Powershell – Export Windows Server configuration to powershell script

powershellwindows-command-promptwindows-server-2008windows-server-2012

I'm looking for a way to export role/feature configuration to a scriptfile, like powershell.

Lets say you've installed the DHCP-Role. You configure the scopes, reservations and all that stuff you need. AFter the configuration is completed, I want all this exported into a scriptfile, so I could run this script and it will automaticly do all that configuration if I run it the next time. (Install-role + scopes + reservations + all other settings you have set..).. Is that possible? If yes, can this be done for all role/features that are installed on the server?

I know you have this option if you add a new Role/Feature, but can this also be done afterwards, with all additional changes and settings as well?

This could be a help setting up a new (clean) server.

Best Answer

The tool you're looking for (in the general case) is called Windows Server Migration Tools, and yeah, it's essentially just a Powershell module, supplied by Microsoft. (In Server 2008 R2, you install it by adding it as a feature.)

If you have any roles are features that aren't supported wit the Windows Server Migration Tools, there's usually a third-party script or binary to be found (at least, I've never been unable to find one for any role or feature I wanted migrated).