WindowsServerAD2022-使用PowerShell通过GPO将域用户添加到本地组“远程桌面用户”

我必须通过 GPO 将域用户添加到本地组“远程桌面用户”。

我必须通过 GPO 将域用户添加到本地组“远程桌面用户”。

由于我以自动方式构建域控制器映像,因此我想创建一个策略,将域用户设置为每个域的远程桌面用户本地组的一部分,并使用 PowerShell 加入 Windows 客户端计算机。

我一直在尝试通过 PowerShell 从 GPO 管理受限组,但没有成功。我找到了以下代码,但它只返回一个.xml,我可以从 GPO 检查位于受限组的组。https://social.technet.microsoft.com/Forums/en-US/a956c361-3852-4ec2-a6e3-15475e67bdaa/listing-gpo-restricted-groups-with-powershell?forum=winserverpowershell

如果有一种方法可以将 GPO 导出为.XML 或任何其他格式,并对其进行编辑并导入更改,也可以。

我发现的另一个论坛,这是一个很好的解决方案,但它仍然是手动的,是的一个。我想通过 PowerShell 自动执行这些步骤,但很难做到。https://techcommunity.microsoft.com/t5/core-infrastructure-and-security/using-group-policy-preferences-to-manage-the-local-administrator/ba-p/259223

请,有没有人知道一些自动的方式来创建一个 GPO,包括域用户到本地组?

谢谢大家!

0
   Try **Invoke-Command** and **Add-LocalGroupMember**
ForEach ($ServerName in $Servers)
{    
   Invoke-command -ComputerName $ServerName -ScriptBlock {Add-LocalGroupMember -Group "Remote Desktop User" -Member "Admin02", "MicrosoftAccount\username@Outlook.com", "AzureAD\DavidChew@contoso.com", "CONTOSO\Admins"}
}
0
https://social.technet.microsoft.com/wiki/contents/articles/20402.active-directory-group-policy-restricted-groups.aspx

创建新的 GPO:计算机配置 / 策略 / Windows 设置 / 安全设置 / 受限组

或者,如果需要由 powershell 脚本创建 GPOConfiguring PowerShell Startup Scripts with Group Policy

和启动脚本:

Add-LocalGroupMember -Group "Remote Desktop User" -Member "Admin02", "MicrosoftAccount\username@Outlook.com", "AzureAD\DavidChew@contoso.com", "CONTOSO\Admins"

本站系公益性非盈利分享网址,本文来自用户投稿,不代表码文网立场,如若转载,请注明出处

(873)
Python-猜词游戏在带有重复字符的单词上失败
上一篇
如何获得当前月份 (october month number)
下一篇

相关推荐

发表评论

登录 后才能评论

评论列表(25条)