0

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

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

如果我所指的组是通用的,它就可以工作,但如果它是全球的,它就不行。是否需要使用开关来使其找到全局组?

4

1 回答 1

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}
于 2012-08-15T14:52:46.557 回答