Lander7
Lander7

Reputation: 13

Why is the command Add-ADGroupMember no longer working with the parameter -Member?

Command Ran:

Add-ADGroupMember -Identity "Group Name" -Member UserName

Works fine with:

Major Minor Build Revision
----- ----- ----- --------
5 1 14409 1005

Does not work now with:

Major Minor Build Revision
----- ----- ----- --------
5 1 17134 228

Error Displayed:

Add-ADGroupMember : Parameter cannot be processed because the parameter name 'Member' is ambiguous.

I can't find anything on Microsofts website stating that they made a change.

Upvotes: 1

Views: 6525

Answers (2)

Gabriel Luci
Gabriel Luci

Reputation: 40868

PowerShell supports partial parameter names, as long as they are unambiguous.

So even though -Member was never a parameter, it was interpreted to be -Members since that was the only parameter that started with "Member".

The change that broke this is the addition of the MemberTimeToLive parameter to the Add-ADGroupMembers cmdlet. So now -Member can either match to -Members or -MemberTimeToLive. It's not going to decide for you, so you get the error.

Upvotes: 4

SysEngineer
SysEngineer

Reputation: 354

The param is plural, you need to use:

Add-ADGroupMembers -Identity "Group Name" -Members samaccountname

As far as I know this has always been the case with powershell 5+.

https://learn.microsoft.com/en-us/powershell/module/addsadministration/add-adgroupmember?view=win10-ps

Upvotes: 3

Related Questions