I have been trying to get a list of members to an AD Security Group. I have tried every combination I can think of but nothing is working. It all comes back with no results. I think the problem is that my group name has (BCC) in it. For example the group name is “Family members - including non clients (BCC)”. I am trying to export the list of active directory members to this group to a csv file. I have used get-adgroup and piped that into get-adgroupmember and piped that into export-csv. I have used get-adgroupmember in many different combination. I have also used a couple of my commands with a different group and it gives me a partial list of members for that group. I have aslo tried get-adgroup -Identity “GUID”
I have used as simple of cmds as 'Get-ADGroupmember -identity “Family Members - Including Non Clients (BCC Only)” ’ Just to get the list to display on the screen and that didn’t even work. It did not give me an error but it did not return any results either.
I am totally out of ideas. Anyone can help that would be great.
HI Carrie,
What happened when you type this in?
Get-ADGroupMember ‘GroupName’ | Select-Object name
If you get a list of users, as you should…you can than export | export-csv C:\somefile.csv
It just returned to the PS command prompt with no results and no errors.
have you tried different groups? I am assuming the group is not empty?
Group is not empty. and I just tried your command with another group and the same thing happened.
I just tried your command with a different group then the previous two groups and it gave names.
Does it matter that the members in the security group are contacts? They are not users but they are contacts.
Carrie A Gale.
can you run this please?
(Get-ADGroupMember ‘FsMarketingRw’).count
I am thinking that you might have too many objects in it, and its causing issues.
let’s see if it can get a count!
sorry I am also working trying to respond when I can.
I got a reply of 0.
But in AD Users and Computers there are tons of contact names under the Members tab
Do I need to put the server name in there?
Sorry, enter your group between the quotes, that was a local group for me! sorry!
Also, I am assuming you have appropriate permissions?
I entered my groups and included the -server name and it still returns a 0
which makes no sense because there is probably 100 contacts in this Global Security Group.
Other groups with less contacts seem to give me results but not this group or other groups this big.
I am a Domain Admin on this domain
Yes, it absolutely matters that the group members are contacts. Get-ADGroupMember only returns user objects unfortunately. You should be able to get what you want using Get-ADObject however.
Get-ADObject -filter "cn -eq 'groupname'" -Properties member | select -ExpandProperty Member
OH WOW, Thanks so much. This has been driving me crazy but your command works great.
NP, but I do need to retract part of my previous statement. Get-ADGroupMembers returns User and Computer objects, but not Contacts. Just for clarification.
can you tell me what cn-eq means in the command?
Hi Carrie,
‘cn’ refers to the Common-Name of the AD object, in this case a group
‘-eq’ equal to