Set-GPPermissions always prompting
Does anyone know how to bypass the Set-GPPermissions prompt? I have an automated script that removes 'Authenticated Users' from the security filtering and I couldn´t find a way to bypass it. Even if I put -Confirm:$false it still prompts... There is no -force option in this command..
Get-gpo $policy_name -Domain $domain | Set-GPPermissions -Replace -PermissionLevel None -TargetName 'Authenticated Users' -TargetType group
I know after kb3163622 all computers must have read access to user GPOs, and I will be using another security group to this GPO above, so just wanted to avoid that prompt confirmation.
I have already posted it here https://social.technet.microsoft.com/Forums/en-US/a9d12558-3dbe-4f29-9268-c682fcc48596/setgppermissions-always-prompting?forum=winserverpowershell and here
https://stackoverflow.com/questions/44390401/how-to-execute-set-gppermissions-command-without-confirmation-prompt but nobody can help
use "-replace" and "-permissionLevel GPOread"
it seems that you can lower Authenticated Users to read in order to remove GPOapply and you dont get the error. then you can add the followup command that targets specific group/user and set them GPOapply.
I agree that the Set-GPPermissions cmdlet should not have a prompt that cannot be bypassed. It should either output the warning and continue as normal, or have a prompt that can be bypassed by "-Confirm:$false" or "-Force".
As it stands today, that security hotfix added a prompt that completely disregards the point of PowerShell as an automation tool.