'How to execute Set-GPPermissions command without confirmation prompt

Set-GPPermissions -Guid <Guid> -TargetName "Authenticated Users" -PermissionLevel None -TargetType Group -Replace -Confirm:$false

Used to work fine, but when KB3163622 patch was installed it now asks me confirmation prompt:

"Group Policy requires each computer account to have permission to read GPO data from a domain controller in order for User Group Policy settings to be successfully applied. Removing the Authenticated Users group may prevent processing of User Group Policies. For more information, please see https://support.microsoft.com/en-us/kb/3163622 Do you want to continue ?"

I execute this command from Powershell and C#.

There is any way to skip this confirmation prompt?



Solution 1:[1]

Instead of Set-GPPermission, you can use the built-in tool dsacls, that does not prompt for confirmation:

dsacls "cn={$($gpo.id)},cn=policies,$((Get-ADDomain).SystemsContainer)" /R "Authenticated Users"

Solution 2:[2]

Since it worked on a different machine, check the PowerShell version. If they are not the same, get the non-working machine on the same version. If that doesn't work, I'd recommend uninstalling and reinstalling the patch. Finally, if you're still having issues, take an inventory of both machines to see what is different on them. Software, .NET version, etc.

If that still doesn't work, it would seem that something is corrupt or misconfigured on the bad machine. If you can figure out what it is, then fix it. Otherwise, just use the other one if you can, or re-image the non-working machine.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 stackprotector
Solution 2 Nick