4

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.

John Smith
  • 41
  • 1
  • 3
  • What do you mean by "role/feature *configuration*"? What about "additional changes and settings"? Are you just looking for a list of the installed Windows Features? Or are you trying to get each feature's specific settings? Also you tagged 2008 and 2012 -- do you need something that will work on all three of 2008, 2008R2 and 2012? – jscott Mar 29 '13 at 11:37
  • Im trying to get each feature's specific settings. The exported settings/script only have to work on that OS, where it comes from. Taken as a whole im looking for a list of all installed roles/features, that contains all feature's specific settings. If possible as a powershellscript! – John Smith Mar 29 '13 at 11:47
  • *Which* specific settings? Could you please elaborate with an edit to your question? The more detail your provide about what exactly you're trying to accomplish may help us give you useful input. – jscott Mar 29 '13 at 11:50
  • 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? – John Smith Mar 29 '13 at 12:04
  • Much better info! Please add that to your question so it's clear to others as well. Thanks. – jscott Mar 29 '13 at 12:05
  • Will do. Just need to find the right words. – John Smith Mar 29 '13 at 12:10

3 Answers3

1

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).

HopelessN00b
  • 53,795
  • 33
  • 135
  • 209
  • 1
    And this will help me exporting all my feature settings? I'll have a look. I have WSMT installed now. Can you maybe post an example cmdlet which exports fx. AD, DNS or DHCP? – John Smith Mar 29 '13 at 13:19
1

There's isn't a simple way to do this across all roles and features.

For your DHCP example there is an Export-DhcpServer cmdlet for server 2012. In 2008 you can use

NetSH.exe export [Path]FileName {all | ScopeList}

and

NetSH.exe import [Path]FileName {all | ScopeList}

to export the configuration to a file. (Ed Wilson made a set of DHCP management scriptlets that utilize netsh that you can use for 2008, you can get them [here])

For DNS you can export zones with the Export-DnsServerZone cmdlet.

Most of the different features and roles can be exported, they just have their own specific cmdlets.

Snowburnt
  • 775
  • 2
  • 5
  • 18
0

Windows Server 2012 R2 added a new functionality called Desired State Configuration (DSC) which uses powershell to execute scripts and set machines a certain way. It's not exactly the export/import solution you're working, but it can work with most of the roles/features.

You can read and Introduction here or dig deeper into it here.

If your DHCP setup is somewhat simple, you can use this post and create simple script.

Stoinov
  • 618
  • 2
  • 10
  • 15