Add-ADGroupMember无法找到全局组

时间:2012-08-15 13:40:37

标签: powershell active-directory

我正在运行一个简单的命令:

Import-CSV $ myfile | ForEach = Object {Add-AdGroupMember -Identity $ mygroup -Members $ _.Alias}

如果我所指的组是Universal,那么它是有效的,但如果它是Global,则不然。是否需要使用交换机才能找到全局组?

1 个答案:

答案 0 :(得分:0)

我会尝试这样的事情:

$myGroup = Get-ADGroup ... #Play with the search scope, etc until you can get $myGroup set.  It's a better cmdlet for searching for groups because of those options.

使用此页面了解更多详细信息:http://technet.microsoft.com/en-us/library/ee617196 - 然后,一旦$ mygroup成为您想要的,下一行就可以正常工作,或者可以修改为:

Import-CSV $myfile | % {$myGroup | Add-AdGroupMember -Members $_.Alias}