Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Having trouble running easy Get-ADGroupMember script.

Avatar of Chad Franks
Chad Franks asked on
Active DirectoryShell ScriptingPowershell
2 Comments1 Solution1352 ViewsLast Modified:
Here is my script:

$groups = Get-Content C:\Scripts\Adgroups.txt
foreach($Group in $Groups) {            

Get-ADGroupMember -Id $Group | select  @{Expression={$Group};Label="Group Name"},Name | Export-CSV C:\Scripts\GroupMembersProd.CSV -NoTypeInformation


When I run it I either get:

Get-ADGroupMember : Cannot bind parameter 'Identity' to the target. Exception setting "Identity": "Cannot validate argument on parameter: 'Identity'. The argument is null or empty. Supply an argument that is not null or empty and then try the command

Or my CSV only has the members to the last group in my text file.
Avatar of Subash Sundharan
Subash SundharanFlag of India imageIT Infrastructure Architect

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answers