【问题标题】:Linking a GPO to a user将 GPO 链接到用户
【发布时间】:2019-02-28 13:50:38
【问题描述】:

我编写了一个代码,允许我将 GPO 链接到 OU,但我想更具体并将其链接到已知用户。

下面是我写的代码:

Import-Module ActiveDirectory
Import-Module GroupPolicy
$GPOName = 'DisableInternet'
$GPO = New-GPO -Name $GPOName -Domain 'Administrateur.6NLG-AD'
Set-GPPrefRegistryValue -Name $GPOName -Context User -Key 'HKCU\Software\Policies\Microsoft\Internet Explorer\Restrictions' -ValueName 'NoBrowserOptions' -Value 1 -Type DWord -Action Create
Set-GPPrefRegistryValue -Name $GPOName -Context User -Key 'HKCU\Software\Policies\Microsoft\Internet Explorer\Restrictions' -ValueName 'NoBrowserOptions' -Value 1 -Type DWord -Action Update
Set-GPPrefRegistryValue -Name $GPOName -Context User -Key 'HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings' -ValueName ProxyServer -Value 0.0.0.0:80 -Type String -Action Create
Set-GPPrefRegistryValue -Name $GPOName -Context User -Key 'HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings' -ValueName ProxyEnable -Value 1 -Type DWord -Action Create
Set-GPPrefRegistryValue -Name $GPOName -Context User -Key 'HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings' -ValueName ProxyServer -Value 0.0.0.0:80 -Type String -Action Update
Set-GPPrefRegistryValue -Name $GPOName -Context User -Key 'HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings' -ValueName ProxyEnable -Value 1 -Type DWord -Action Update
New-GPLink -Name $GPOName -Target 'OU=Nouvelle_UO,DC=Administrateur,DC=6NLG-AD'

【问题讨论】:

    标签: powershell active-directory group-policy


    【解决方案1】:

    您不能将 GPO 链接到用户,只能链接到 OU。但是,您可以使用权限过滤 GPO,因此它仅适用于特定用户或组。

    因此,请使用New-GPLink 将 GPO 链接到用户帐户所在的 OU。或者在继承将允许 GPO 应用于用户 OU 的级别。

    您需要从 GPO 中删除 Authenticated Users 或任何其他范围广泛的群组,例如 Domain Users

    您可以通过查看 GPO 来检查这些组,例如在下面的屏幕截图中,您可以在 Security Filtering 部分下看到默认的 Authenticated Users 具有 GPO 的权限:

    在为您的用户添加权限之前,您需要从安全过滤中删除该组:

    Set-GPPermission -TargetName "Domain\Authenticated Users" -TargetType Group -PermissionLevel None -Replace
    

    然后将 GPO 的权限设置为您希望它应用到的用户:

    Set-GPPermission -Name DisableInternet -TargetName SamAccountName -TargetType User -PermissionLevel GpoApply
    

    有关更多信息和示例,请参阅Set-GPPermission documentation

    【讨论】:

    • 谢谢,但我不太明白如何从 GPO 中删除域用户或任何其他范围广泛的组
    • 我已经更新了我的答案,对此有更好的解释:)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-23
    • 1970-01-01
    • 2023-02-15
    • 1970-01-01
    • 2021-11-12
    相关资源
    最近更新 更多