I am having an issue with the Active Directory module for Powershell. The issue is...I have a csv file that contains machine accounts in my active directory domain.
In the command below "a_wirelesspilot" is the name of the group I am trying to modify - and following that are the machine accounts I am trying to add.
If one of the machine accounts in the domain is already a member of the group, it fails and doesn't add any additional machine accounts that follow it.
PS C:\Windows\system32> Add-ADGroupMember a_wirelesspilot 5TN9DT1L$,BGBWCT1L$,8Q
4JDT1L$
PS C:\Windows\system32> Add-ADGroupMember a_wirelesspilot 9CLKDT1L$,7S5CGT1L$,23
BWCT1L$,D9R9GT1L$,D72QFT1L$,7FLMRS1L$,5TN9DT1L$,7KFXCT1L$,JQRTFT1L$,HHF7GT1L$
Add-ADGroupMember : The specified account name is already a member of the group
At line:1 char:18
+ Add-ADGroupMember <<<< a_wirelesspilot 9CLKDT1L$,7S5CGT1L$,23BWCT1L$,D9R9GT1
L$,D72QFT1L$,7FLMRS1L$,5TN9DT1L$,7KFXCT1L$,JQRTFT1L$,HHF7GT1L$
+ CategoryInfo : NotSpecified: (a_wirelesspilot:ADGroup) [Add-ADG
roupMember], ADException
+ FullyQualifiedErrorId : The specified account name is already a member o
f the group,Microsoft.ActiveDirectory.Management.Commands.AddADGroupMember
The problem is with the error handling. I have tried to add:
-ea silently continue
and...
-ea stop
to the command and neither works. (same error) Please advise.
-Thor Kakar