2013-02-26 129 views
1

编写脚本以创建/更新Active Directory用户没有问题。现在需要为每个域用户添加名称映射,以便我们可以使用中央Kerberos身份验证。Powershell安全标识映射/ Active Directory中的名称映射

PS:我正在使用QUEST Active Directory模块。

我在Powershell脚本中找不到任何可以实现此目的的东西。有人知道吗?它可以是任何语言,不一定在Powershell中。我总是可以让Powershell与另一个脚本交谈来实现目标。

下面显示了手动添加名称映射的屏幕。 enter image description here

回答

0

秘密是这是altSecurityIdentities属性。

我花了很多时间在网上寻找一种方法来做到这一点,我找不到答案。 This microsoft page是我需要的突破。

这是我想出来的:

您可能需要Import-Module ActiveDirectory在脚本的开始。 在我的代码中,替换USERNAME,但保留引号。

在这里,我将2名的Kerberos:

Set-ADUser -Identity "USERNAME" -Replace @{Kerberos:[email protected],Kerberos:[email protected]} 

在这里我插入X509证书和Kerberos名称:

Set-ADUser -Identity "USERNAME" -Replace @{X509:CERTIFICATEINFORMATION,Kerberos:[email protected]} 

很明显,你可以通过添加多于或少于2使用逗号分隔条目。 以下命令我用于验证我成功添加的信息...但它可能有助于用户手动映射并用它来获得的格式应该是什么样子的想法:

Get-ADUser -Identity "USERNAME" -Properties * | select altSecurityIdentities 

希望这有助于!

1

警告:确切的语法是映射帐户

Set-ADUser "Username" -Add @{'altSecurityIdentities'="Kerberos:[email protected]","Kerberos:[email protected]"} 

一定要加'altSecurityIdentities'=的括号内。

您可以使用-Add或-Replace取决于您想要达到的目标。

希望这会有所帮助。