1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Exchange question

Discussion in 'Software' started by Theprof, Feb 11, 2012.

  1. Theprof

    Theprof Petabyte Poster Forum Leader

    4,570
    68
    196
    Question, what do you guys do to export a list of all the distribution groups in Exchange 2007? There's usually an export list option, but the version of exchange I am dealing with needs to be updated I think because it does not have Export list option.. I know there are scripts and powershell commands that can be run... I am also wondering if get-distributiongroup command in EMS would do the trick... ideal I just want to export 1000 DG's to an excel file... I can run it and pop all the DG's but can't seem to find the export to csv command... maybe I am missing something simple.
     
    Certifications: A+ | CCA | CCAA | Network+ | MCDST | MCSA | MCP (270, 271, 272, 290, 291) | MCTS (70-662, 70-663) | MCITP:EMA | VCA-DCV/Cloud/WM | VTSP | VCP5-DT | VCP5-DCV
    WIP: VCAP5-DCA/DCD | EMCCA
  2. Sparky
    Highly Decorated Member Award

    Sparky Zettabyte Poster Moderator

    10,191
    299
    319
    What SP level is Exchange at? I had an issue when I was doing an Exchange 2007 install a couple of years ago and my powershell script would not work - after I service packed Exchange 2007 to SP2 (the latest at the time) it worked fine after that.
     
    Certifications: MSc MCSE MCSA:M MCSA:S MCITP:EA MCTS(x5) Security+ Network+ A+
    WIP: Exchange 2007\2010
  3. Theprof

    Theprof Petabyte Poster Forum Leader

    4,570
    68
    196
    I'd have to check tomorrow to be sure... but I think its related to a service pack as to why I don't have the export list option in distribution groups.
     
    Certifications: A+ | CCA | CCAA | Network+ | MCDST | MCSA | MCP (270, 271, 272, 290, 291) | MCTS (70-662, 70-663) | MCITP:EMA | VCA-DCV/Cloud/WM | VTSP | VCP5-DT | VCP5-DCV
    WIP: VCAP5-DCA/DCD | EMCCA
  4. Theprof

    Theprof Petabyte Poster Forum Leader

    4,570
    68
    196
    It does not have a service pack... would explain why I am missing the option... I will have to script something I guess to get the list and update to SP2...

    Edit: I was able to export the list of DG's through the exchange powershell command below:

    Get-DistributionGroup -ResultSize Unlimited | export-csv dg1.csv
     
    Last edited: Feb 13, 2012
    Certifications: A+ | CCA | CCAA | Network+ | MCDST | MCSA | MCP (270, 271, 272, 290, 291) | MCTS (70-662, 70-663) | MCITP:EMA | VCA-DCV/Cloud/WM | VTSP | VCP5-DT | VCP5-DCV
    WIP: VCAP5-DCA/DCD | EMCCA
  5. Gav

    Gav Kilobyte Poster

    447
    14
    27
    That will do part of the job, but you'll find that certain fields will contain multiple values, so a basic Get/Export won't do the trick (you may only want some basic info, in which case this won't bother you). Get-DistributionGroup also won't give you the members.

    If you want to do the members as well, it's probably easiest to create multiple CSVs, something like...

    Export:

    $dgs = Get-DistributionGroup
    foreach ($dg in $dgs){
    $filename = $dg.alias+".csv"
    Get-DistributionGroupMember $dg | Export-CSV $filename
    }

    Import:
    $dgs = Get-Childitem C:\DGs\
    foreach ($dg in $dgs){
    $dgmembers = Import-CSV $dg
    foreach ($dgmember in $dgmembers){
    Add-DistributionGroupMember -identity $dg.primarysmtpaddress -member $dgmember.primarysmtpaddress
    }
    }

    I haven't tested the above code, but I've written a similar script recently that worked (albeit a little more polished than the above example) :-)
     
  6. Theprof

    Theprof Petabyte Poster Forum Leader

    4,570
    68
    196
    Nice! I agree with you, in this particular requirement, the user wanted just the email groups with their email address... not the individual users in them :) I have a powershell script that I can customize to run, similar to yours actually... I set it aside for when I really need it :)
     
    Certifications: A+ | CCA | CCAA | Network+ | MCDST | MCSA | MCP (270, 271, 272, 290, 291) | MCTS (70-662, 70-663) | MCITP:EMA | VCA-DCV/Cloud/WM | VTSP | VCP5-DT | VCP5-DCV
    WIP: VCAP5-DCA/DCD | EMCCA

Share This Page

Loading...