Announcement

Collapse
No announcement yet.

Export members of Distribution group

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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://forums.petri.com/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

    Comment


    • #3
      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,

      Comment


      • #4
        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

        Comment


        • #5
          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.

          Comment


          • #6
            Re: Export members of Distribution group

            Sorry i should run

            dsget group but the problem is where should i mention the username?

            Comment


            • #7
              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

              Comment


              • #8
                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,

                Comment


                • #9
                  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, 14:45. Reason: whoops

                  Comment


                  • #10
                    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; 28th March 2011, 22:14. Reason: added code-tags

                    Comment

                    Working...
                    X