Link to home
Start Free TrialLog in
Avatar of asantia
asantiaFlag for United States of America

asked on

VBScript to list members of an AD group

Hello,

I'm trying to find or create a VBScript that can query an AD "domain-local" group and export the members of the group to a text file.
The export of the members needs to be in the format of:  "DOMAIN\SAMAccountName"

DOMAIN is preferred to be in the NetBIOS format, but FQDN is also acceptable.

I need the domain to be prefaced because there are members of trusted domains in these groups which I must differentiate.

Thanks.
Avatar of HainKurt
HainKurt
Flag of Canada image

what about powershell

on command line type powershell and press enter
then run this

Get-ADGroup "Name of Group" | Get-ADGroupMember

Open in new window


is this something you want?
SOLUTION
Avatar of Shaun Vermaak
Shaun Vermaak
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of asantia

ASKER

Thanks, but PowerShell isn't an option as I need to work with some older DCs.
VBScript is fully supported among all, so that is what I need to go with.
Also that function does not output in NetBIOS or FQDN format. It only shows DN.
Plus it errors out on domain-local groups that have trusted foreign accounts in it.

The DN isn't going to work.
I had found plenty of examples returning the DN. That's why I had asked specifically for NetBIOS or FQDN output format.
If there is a way to modify your script to transform the DN to NetBIOS or FQDN, I'd be open to adding a function to the script to do so.
In the end I need it in NetBIOS or FQDN format.

Thanks.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

Split:
-- Robert (https:#a42289639)
-- Shaun Vermaak (https:#a42289532)


If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

Pber
Experts-Exchange Cleanup Volunteer