I Need to re-create or clone the Group Policy using other names with the below script:
$GPOName = 'Default Domain Policy'
$BackupPath = "$($env:USERPROFILE)\Desktop\BACKUP\$($GPOName)"
Backup-GPO -Name $GPOName -Path $BackupPath -Verbose
Restore-GPO -Name "$GPOName - (CLONE)" -Path $BackupPath -Verbose
Remove-Item -Path $BackupPath -Force -Recurse
However, it is failed with the below error:
Backup-GPO : The system cannot find the file specified. (Exception from HRESULT: 0x80070002) At line:5 char:1
- Backup-GPO -Name $GPOName -Path $BackupPath -Verbose
+ CategoryInfo : NotSpecified: (:) [Backup-GPO], FileNotFoundException + FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.GroupPolicy.Commands.BackupGpoCommand
User contributions licensed under CC BY-SA 3.0