> For the complete documentation index, see [llms.txt](https://osconfig.osdeploy.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://osconfig.osdeploy.com/docs/untitled-1/localpolicy/import-gpo.ps1.md).

# Import-GPO.ps1

This script is the key to importing Group Policy. The script imports all GPO's in the ImportGPO directory. Pay attention to the naming standards. If you need a GPO in this directory applied to Windows 10 and not any other Operating System, make sure Win10 is in the name of the GPO. The same pattern applies to Win7 and Windows Server (Windows Server filtering was added to this script in version 18.9.2)

![](https://blobscdn.gitbook.com/v0/b/gitbook-28427.appspot.com/o/assets%2F-LDKRxGiKLYjW1gana2O%2F-LLNqOh84SnQf0aMTGZD%2F-LLNryHay5Dio2SLD0If%2F2018-09-02_1-01-15.png?alt=media\&token=2f3a39ac-e9a2-4647-b586-19fd44bebefa)

## Import Registry Preferences <a href="#import-registry-preferences" id="import-registry-preferences"></a>

The same filtering is used in finding GPO Registry.xml files (Windows Server filtering was added to this script in version 18.9.2).

![](https://blobscdn.gitbook.com/v0/b/gitbook-28427.appspot.com/o/assets%2F-LDKRxGiKLYjW1gana2O%2F-LLNqOh84SnQf0aMTGZD%2F-LLNsNL7tEIM1oCYTMk0%2F2018-09-02_1-01-15b.png?alt=media\&token=18b97d14-45a0-428d-8cf9-dca2b13c00c3)

The next step is to mount the Default User and Administrator Registry Hives

![](https://blobscdn.gitbook.com/v0/b/gitbook-28427.appspot.com/o/assets%2F-LDKRxGiKLYjW1gana2O%2F-LLNqOh84SnQf0aMTGZD%2F-LLNt5k34lscARhmYIj-%2F2018-09-02_1-05-51.png?alt=media\&token=642b2773-9772-423d-b1a7-7ff53d3f4a27)

And then to go through all the XML nodes

![](https://blobscdn.gitbook.com/v0/b/gitbook-28427.appspot.com/o/assets%2F-LDKRxGiKLYjW1gana2O%2F-LLNqOh84SnQf0aMTGZD%2F-LLNtJRT2f2Xm6kMcGVs%2F2018-09-02_1-05-51b.png?alt=media\&token=33fcecac-180c-45a9-89d6-a5732d126f58)

And write the Registry Values into the Registry (hives will be dismounted when complete)

![](https://blobscdn.gitbook.com/v0/b/gitbook-28427.appspot.com/o/assets%2F-LDKRxGiKLYjW1gana2O%2F-LLSiEpxc9rNGOVOfeBR%2F-LLSiz-ESpmBxC4yITc_%2F2018-09-02_23-40-15.png?alt=media\&token=bb3c607a-adca-4249-8c06-29d8678c5e1e)

During execution of the script, the console output will look like this

![](https://blobscdn.gitbook.com/v0/b/gitbook-28427.appspot.com/o/assets%2F-LDKRxGiKLYjW1gana2O%2F-LLSiEpxc9rNGOVOfeBR%2F-LLSiIhePlr0lT7E9Pck%2F2018-09-02_23-37-17.png?alt=media\&token=ed6e0a8b-bd4d-4b2b-9366-ace06ec00970)

​
