top of page

PowerShell | Backup Group Policies

<#
Summary:  
          Get list of Policies from File
          Loop through items in file

          Create folder with policy name

          Export Group Policy to unique directory 

Author:   Scott Head
Date:     05/09/2022
Version:  1.0 
#>

​

$GroupPolicyName = Get-Content "C:\GroupPolicies\All-Group-Policies.txt"

Foreach($Policy in $GroupPolicyName){

    New-Item C:\GroupPolicies\$Policy -ItemType Directory 

    Backup-GPO -Name $Policy -Path C:\GroupPolicies\Policy\$Policy -Comment "$Policy"

}

bottom of page