Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<#
.SYNOPSIS
This script will set up a central GPO store in your lab
.NOTES
You need a Windows Server 2012 R2 for this script to work.
This script is part of a series to automate your lab on www.dominikbritz.com
#>
#Requires -Version 3
#Requires -RunAsAdministrator
###
### Script
###
Try
{
New-Item -Path "\\$env:userdnsdomain\SYSVOL\$env:userdnsdomain\policies\PolicyDefinitions" -ItemType Directory -Force -ErrorAction Stop
Copy-Item -Path "$env:LOGONSERVER\c$\Windows\PolicyDefinitions\*" -Destination "\\$env:userdnsdomain\SYSVOL\$env:userdnsdomain\policies\PolicyDefinitions" -Recurse -ErrorAction Stop
}
Catch
{
Throw $_
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.