1) Import/export the script?
2) Promote a new DC in production, ghost the server, de-promote it, and finally bring back the ghost and apply the domain rename procedure?
There is no single "right" answer to the question of how to clone your AD environment in a test environment. A good place to start is with the CreateXMLFromEnvironment.wsf and CreateEnvironmentFromXML.wsf scripts that come pre-installed with the Group Policy Management Console, which will capture information about organizational units, GPOs, GPO links and security on GPOs. An alternative would be to use a System State backup from a production DC to create a test DC (in connectivity isolation) and refresh the information on it through regularly-scheduled additional restores.
This was first published in February 2006