Hello World,
I’m back with Powershell scripting and Migration table. If you remember, in some previous posts, we have demonstrated how to generate a migration table using powershell. In this post, we have seen how easily it was to create a migration table by querying Active Directory domain to retrieve the gpo list. In this second post, we have modified a little bit the script in order to generate the migration table using the GPO backup files as source. We were assuming that the source domain was not accessible.
At this stage, you should be able to generate migration table. However, you still need to update this migration table in order to reflect the target infrastructure. You can decide to perform the change manually or again use powershell to help you a little bit with this task.
The Powershell Script
We provide here a possible script that can be used to update the migration table. We assume that you have already generate a migration table. If you open the migration table using notepad, you will see something like this
Click on picture for better resolution
In the migration table, you can notice that the destination field is formated as <DestinationSameAsSource />. In order to have a valid formated migration table (and to ease the update process), I’ve been cheating a little bit. In the script, we have first replaced the string <DestinationSameAsSource /> with <Destination></Destination>. this change will help us in assigning a value to the destination field.
Note : In this post, we provide only a extract of a larger script. In this extract, we had to provide some constants value such as path of the XML file, source domain names… In the “larger” script, this information is retrieved automatically. You can always modify the code to fits your needs.
The script will look like something like this
Click on the picture for better resolution
Final Notes
And voila ! With this quick and dirty script, you might be able to speed up a litte bit the gpo migration process between Active Directory domains. Note that the script does not changes the name of the servers (if used in the unc path). In our scenario, we were moving servers between domain (and thus using the same name). You might still perform some manual adjustements even after running the script in order to have a migration table that reflect exactly your needs
Till next time
See ya
Related links
- Migrate GPo’s between domains
- Using Powershell to generate Group Policies migration table
- Using Powershell to generate Group Policies migration table (from Backup Files)
OOH sorry your already published. Thank you again !!!