Hi,
Just so there is clarity in the post. I make the backup with the Backup-GPO command, and restore it the same way as in @Limitless Technology script which is when this problem happens, I'm automating this so I'm using powershell for this, but it does not work as expected.
There is no error when restoring with Powershell.
$gpoPath = Join-Path -Path $PSScriptRoot -ChildPath "HLABGPO"
Import-Module GroupPolicy
New-GPO -Name "HLAB"
Import-GPO -BackupGpoName "HLAB" -TargetName "HLAB" -Path $gpoPath
Get-GPO -Name "HLAB" | New-GPLink -Target "dc=hlab,dc=lab" -LinkEnabled Yes - Enforced Yes
gpupdate /force