根据 Microsoft cmdlet Set-GPPermissions接受选项“-replace”:
"This ensures that the existing permission level is replaced by the new permission level."
我从 PowerShell 导入 GPO。之后我想设置安全过滤器。导入后,在设置安全过滤器之前,GPO 的安全过滤器为“Authenticated Users”。现在我想删除该过滤器选项并将其替换为“myGroup”。为此,我使用以下命令:
Set-GPPermissions -Name "myGPO" -PermissionLevel GpoApply -TargetName "myGroup" -TargetType Group -replace
结果是添加了一个引用“myGroup”的新安全过滤器,但没有删除“Authenticated Users”组。 Powershell cmdlet 不是替换过滤器,而是添加它。
提示?
提前致谢!
最佳答案
正如您引用的页面上所记录的那样,该命令将替换已经存在的 permissions
组“myGroup”。它不会将“Authenticated Users”组的权限替换为“myGroup”组的权限。引自 Technet :
-Replace < SwitchParameter >
Specifies that the existing permission level for the group or user is removed before the new permission level is set.
您必须使用
Set-GPPermissions
向“myGroup”和 Set-GPPermissions -TargetName "Authenticated Users -PermissionLevel None
授予权限删除“经过身份验证的用户”的权限。
关于security - 使用 powershell Set-GPPermissions cmdlet 设置 GPO 安全过滤器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12249658/