Any suggestions? Export (0) Print
Expand All

Example: Creating an XML Format File from a Production Environment

Updated: March 28, 2003

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

Assume that your production domain is called, and you want to export Group Policy and related information to create a new staging domain for GPO testing. In this example, assume that you want to capture GPOs from the entire domain and include user accounts as well as groups. To export the information you need, complete the following tasks:

  1. Ensure that you have sufficient permissions on the production domain to extract the necessary data. You must have the rights to read all objects that you are capturing, including GPOs, OUs, users, and groups (and their memberships).

  2. Create a folder to store the XML format file that describes the information collected by the script.

  3. Create a folder to store backups of the GPOs that are extracted by the script.

  4. Run the script CreateXMLFromEnvironment.wsf from the Scripts folder in the GPMC installation folder. You must precede the script name with the command cscript if cscript.exe is not your default WSH engine. For this example, type the following from the command line:

    Cscript "%programfiles%\gpmc\scripts\CreateXmlFromEnvironment.wsf".\production.xml / /DC:contoso-dc1 /TemplatePath:.\GPObackups /IncludeUsers
    This command creates the XML format file Production.xml in the folder where the script is run. The backed-up GPOs are created in a sub-folder of the current folder called GPObackups. Placing a backslash (\) in front of the production.xml and GPObackups paths causes the script to use a relative path, and create the XML file and backup GPO folders in the current directory from which the script is run. Using a relative path makes it easier to copy the XML and backups to different locations from which they can be restored.

    The script starts its capture at the domain level, You can also run the script at an OU level, in which case you would use the /StartingOU option in addition to the /Domain option. If you exclude the /Domain option, the current domain is assumed. The /DC option tells the script to use the domain controller contoso-dc1, and the /TemplatePath option specifies that the backups of all of the GPOs that are captured are stored in the folder GPOBackups. Finally, the /IncludeUsers option ensures that user accounts are captured by the script as well.


    • You can open and edit the XML format files produced by the script CreateXMLFromEnvironment.wsf in a text editor or any XML editor. Be aware, however, that XML-formatted files must adhere to a specific syntax. If you change that syntax, you might affect the ability of the script CreateEnvironmentFromXML.wsf to read the input file.

Once you have captured the production environment by running the script CreateXMLFromEnvironment.wsf, you need to run the script CreateEnvironmentFromXML.wsf, using the .XML format file output by CreateXMLFromEnvironment.wsf as input. You must run the script CreateEnvironmentFromXML.wsf, from within the staging domain, or you can run this script from a computer that is not in the staging domain if you already have trusts to the staging domain in place.

Community Additions

© 2016 Microsoft