Petri.co.il forums Home Forums Start Page Forums Frequently Asked Questions FAQ Member List Members List
Go Back   Petri IT Knowledgebase Forums > Windows Scripting > General Scripting
Petri.co.il is happy to award RicklesP the title of Most Valuable Member !!!
Register Calendar Calendar Search Petri IT Knowledgebase Forums Search Todays Posts Today's Posts Mark Forums Read
Notices

Export members of Distribution group

Export members of Distribution group

this thread has 9 replies and has been viewed 12058 times

Closed Thread
 
Thread Tools Search this Thread Display Modes
  #1  
Old 27th December 2010, 02:17
capricorn capricorn is offline
Casual
It's not a coincidence
 
 Join Date: Jun 2010
  6 month star 12 month star
 Posts: 65
 Reputation: capricorn is on a distinguished road (10)
Default Export members of Distribution group

I am trying to export the members of DL from active directory using the link below.

http://support.microsoft.com/kb/555365


It works fine and i get the output in a file but the problem is that the member output is in encrypted form.

How can i get the members name in plain text?

Regards,
  #2  
Old 27th December 2010, 19:31
v-2nas's Avatar
v-2nas v-2nas is offline
Member
Someone to look up to
 
 Join Date: Jul 2008
  6 month star 12 month star
 Location: Singapore
 Posts: 722
  Send a message via MSN to v-2nas
 Reputation: v-2nas will become famous soon enough (80)
Default Re: Export members of Distribution group

Hi,

can you use powershell v2.0 and questAD commandlets?

Then you can use the following command or script
command get-qadmemeberof

script
http://www.petri.co.il/forums/showthread.php?t=52274

or you can use dsquery or dsget
dsget group "DN of the group" -members | dsget user -samid
__________________
Thanks & Regards
v-2nas

MCTS 2008, MCTIP, MCSE 2003, MCSA+Messaging E2K3, MCP, E2K7
Sr. Wintel Eng. (Investment Bank)
Independent IT Consultant and Architect
Blog: http://www.exchadtech.blogspot.com

Show your appreciation for my help by giving reputation points
  #3  
Old 30th December 2010, 13:43
capricorn capricorn is offline
Casual
It's not a coincidence
 
 Join Date: Jun 2010
  6 month star 12 month star
 Posts: 65
 Reputation: capricorn is on a distinguished road (10)
Default Re: Export members of Distribution group

Thanks
I used

dsget user to get the information of specific user.

Now i get long information. Can i truncate information i.e in a txt file i only want to have the groups name not OT and Dc information and some spacing between them?

Regards,
  #4  
Old 30th December 2010, 20:26
v-2nas's Avatar
v-2nas v-2nas is offline
Member
Someone to look up to
 
 Join Date: Jul 2008
  6 month star 12 month star
 Location: Singapore
 Posts: 722
  Send a message via MSN to v-2nas
 Reputation: v-2nas will become famous soon enough (80)
Default Re: Export members of Distribution group

Hi,

use the following command
dsget group "DN of the group" -members | dsget user -samid > users.txt
__________________
Thanks & Regards
v-2nas

MCTS 2008, MCTIP, MCSE 2003, MCSA+Messaging E2K3, MCP, E2K7
Sr. Wintel Eng. (Investment Bank)
Independent IT Consultant and Architect
Blog: http://www.exchadtech.blogspot.com

Show your appreciation for my help by giving reputation points
  #5  
Old 3rd January 2011, 19:36
capricorn capricorn is offline
Casual
It's not a coincidence
 
 Join Date: Jun 2010
  6 month star 12 month star
 Posts: 65
 Reputation: capricorn is on a distinguished road (10)
Default Re: Export members of Distribution group

dsget user "CN=Lastname\, firstname,OU=Users,OU=abc,OU=Italy,DC=mydomain,DC= alfa,DC=corp" -members | dsget user -samid > user.txt

Error:

dsget failed:'-members' is an unknown parameter.
  #6  
Old 3rd January 2011, 19:43
capricorn capricorn is offline
Casual
It's not a coincidence
 
 Join Date: Jun 2010
  6 month star 12 month star
 Posts: 65
 Reputation: capricorn is on a distinguished road (10)
Default Re: Export members of Distribution group

Sorry i should run

dsget group but the problem is where should i mention the username?
  #7  
Old 3rd January 2011, 20:39
v-2nas's Avatar
v-2nas v-2nas is offline
Member
Someone to look up to
 
 Join Date: Jul 2008
  6 month star 12 month star
 Location: Singapore
 Posts: 722
  Send a message via MSN to v-2nas
 Reputation: v-2nas will become famous soon enough (80)
Default Re: Export members of Distribution group

Hi,

can you post the screenshot of the command and error that you issue and recieved?
__________________
Thanks & Regards
v-2nas

MCTS 2008, MCTIP, MCSE 2003, MCSA+Messaging E2K3, MCP, E2K7
Sr. Wintel Eng. (Investment Bank)
Independent IT Consultant and Architect
Blog: http://www.exchadtech.blogspot.com

Show your appreciation for my help by giving reputation points
  #8  
Old 4th January 2011, 01:55
capricorn capricorn is offline
Casual
It's not a coincidence
 
 Join Date: Jun 2010
  6 month star 12 month star
 Posts: 65
 Reputation: capricorn is on a distinguished road (10)
Default Re: Export members of Distribution group

I will do that but i have one confusion. Where i should write username i.e

I want to see the ditribution group of username Jonny i.e in which groups jonny is a member.

can you please write the command for jonny. That will really help me.

Regards,
  #9  
Old 25th March 2011, 16:18
kold kold is offline
Casual
Casual
 
 Join Date: Mar 2011
  6 month star 12 month star
 Posts: 1
 Reputation: kold is on a distinguished road (10)
Default Re: Export members of Distribution group

Try this:

>dsquery group -name "dl name" | dsget group -members | dsget user -upn

That should return the email addresses of all the users in the distribution group you're looking through. If you just need the usernames, you can change -upn to -samid.

or you can query the username, and then request the membership

>dsquery user -name "username" | dsget user -memberof

Hope this helps,

Last edited by kold; 25th March 2011 at 16:45.. Reason: whoops
  #10  
Old 28th March 2011, 21:48
scurlaruntings's Avatar
scurlaruntings scurlaruntings is offline
Senior Member
Someone to look up to
 
 Join Date: Apr 2008
  6 month star 12 month star
 Location: London England
 Posts: 1,006
  Send a message via MSN to scurlaruntings
 Reputation: scurlaruntings will become famous soon enough (97)
Default Re: Export members of Distribution group

Code:
'Script begins here

Dim objGroup, objUser, objFSO, objFile, strDomain, strGroup, Domain, Group

'Change DomainName to the name of the domain the group is in
strDomain = Inputbox ("Enter the Domain name", "Data needed", "Default domain name")
'Change GroupName to the name of the group whose members you want to export
strGroup = InputBox ("Enter the Group name", "Data needed", "Default group name")
Set objFSO = CreateObject("Scripting.FileSystemObject")
'On the next line change the name and path of the file that export data will be written to.
Set objFile = objFSO.CreateTextFile("C:\" & strGroup & " - Members.txt")
Set objGroup = GetObject("WinNT://" & strDomain & "/" & strGroup & ",group")
For Each objUser In objGroup.Members
    objFile.WriteLine objUser.Name & " - " & objUser.Class
Next
objFile.Close
Set objFile = Nothing
Set objFSO = Nothing
Set objUser = Nothing
Set objGroup = Nothing
Wscript.Echo "Done"
Wscript.Echo "Please check the c: for your output file"
Try the above. Save it as a .vbs script. Run with CScript or WS whichever is your preference.

Last edited by Rems; 29th March 2011 at 00:14.. Reason: added code-tags
Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I enumerate all members of a Dynamic Distribution Group? JDMils PowerShell 1 21st December 2010 02:18
Hiding Distribution Groups/Query Based Distribution Group's pcsdps Exchange 2000 / 2003 2 11th July 2010 18:53
Don't deliver to certain members of a distribution group? gforceindustries Exchange 2007 / 2010 / 2013 1 24th June 2010 09:06
Email enabled distribution group with no members ReggieP Exchange 2000 / 2003 1 28th January 2009 15:52
How to count number of members in the distribution groups kauf Misc 0 17th September 2007 17:05


All times are GMT +3. The time now is 21:58.

Steel Blue 3.5.4 vBulletin Style ©2006 vBEnhanced
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
 

Valid XHTML 1.0!   Valid CSS!

Copyright 2005 Daniel Petri