这不起作用,因为 DisplayName 不是一个可接受的值。这是有效值的列表。在此处查看 cmdlet 联机帮助:http ://technet.microsoft.com/en-us/library/ee617210.aspx
Members
Specifies a set of user, group, and computer objects in a
comma-separated list to add to a group. To identify each object, use
one of the following property values. Note: The identifier in
parentheses is the LDAP display name.
Distinguished Name
Example: CN=SaraDavis,CN=Europe,CN=Users,DC=corp,DC=contoso,DC=com
GUID (objectGUID)
Example: 599c3d2e-f72d-4d20-8a88-030d99495f20
Security Identifier (objectSid)
Example: S-1-5-21-3165297888-301567370-576410423-1103
SAM Account Name (sAMAccountName)
Example: saradavis
此外,Members 参数接受一组值,因此您也可以这样做:
$members = Import-CSV $file | Foreach-Object {$_.Alias}
$myGroup | Add-ADGroupMember -Members $members