Resources for IT Professionals > Página Inicial dos Fóruns > Admin > How can I add members to a new distribution group from a CSV file?
Fazer uma PerguntaFazer uma Pergunta
 

RespondidoHow can I add members to a new distribution group from a CSV file?

  • quarta-feira, 18 de março de 2009 17:08Sandy Wood Medalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     
    I'd like to import users from a CSV file to a Distribution Group. I've exported the members of an exisiting Distribtution Group to the CSV and I basically want to clone it with a different name. I can't get the Powershell to work...

    I thought it should look like

    Import-Csv -Path D:\ml.csv | ForEach-Object {Add-DistributionGroupMember....this is where I'm lost....
    Orange County District Attorney

Respostas

  • sábado, 4 de julho de 2009 23:17Jim McBee - Exchange MVPMVPMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     Respondido
    Exchange Server 2003 does not have this cmdlet or an similar function.  If you want to use PowerShell and you are using Exchange 2003, you could probably use the Quest Active Directory Powershell tools
    http://www.quest.com/powershell/activeroles-server.aspx

    You would need to install the PowerShell and then install the Quest tools. Then take a look at the Add-QADGroupMember cmdlet that Quest provides.
    Jim McBee - Blog - http://mostlyexchange.blogspot.com
  • quinta-feira, 19 de março de 2009 3:18Amit TankMVP, ModeradorMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     Respondido
    Hey Sandy,

    Try below cmdlet to import from CSV file...

    Import-CSV FileName.csv | ForEach {Add-DistributionGroupMember -Identity "DG Name" -Member $_.Name}

    In filename.csv file should have a column Name and the values must be in anyone of below format to add them as a member...
    GUID distinguished name UPN LegacyExchangeDN Domain\Account Name SMTP Address

    Add-DistributionGroupMember



    Amit Tank | MVP - Exchange | MCITP:EMA MCSA:M | http://ExchangeShare.WordPress.com

Todas as Respostas

  • quinta-feira, 19 de março de 2009 3:18Amit TankMVP, ModeradorMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     Respondido
    Hey Sandy,

    Try below cmdlet to import from CSV file...

    Import-CSV FileName.csv | ForEach {Add-DistributionGroupMember -Identity "DG Name" -Member $_.Name}

    In filename.csv file should have a column Name and the values must be in anyone of below format to add them as a member...
    GUID distinguished name UPN LegacyExchangeDN Domain\Account Name SMTP Address

    Add-DistributionGroupMember



    Amit Tank | MVP - Exchange | MCITP:EMA MCSA:M | http://ExchangeShare.WordPress.com
  • quinta-feira, 19 de março de 2009 6:48James-LuoMSFT, ModeradorMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     

    Good job, Amit

    I tested in the lab

    Step 1: Export Value of the user object you want to add into DG (Distribution Group)

    Csvde -r objectclass=user -d "OU=ExTeam,DC=contoso,DC=com" -l "Name" -f C:\member.txt

    Step 2: Import the file as Amit said

    import-csv C:\member.txt | foreach {add-distributiongroupmember DGName -member $_.Name}

    Step 3: Verify the result via EMC or EMS

  • quinta-feira, 19 de março de 2009 14:15Sandy Wood Medalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     
    Thanks again Amit. We gave it a try and it worked perfectly.
    Orange County District Attorney
  • quinta-feira, 19 de março de 2009 14:19Amit TankMVP, ModeradorMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     
    My pleasure Sandy... :)
    Amit Tank | MVP - Exchange | MCITP:EMA MCSA:M | http://ExchangeShare.WordPress.com
  • sábado, 4 de julho de 2009 8:19Andrey Zakharov Medalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     
    Hi Amit,
    how can i do this on exchange 2003?
    I now that add-distributiongroupmember - is exchange 2007 cmdlet and is don't work on 2003.
    10x
  • sábado, 4 de julho de 2009 23:17Jim McBee - Exchange MVPMVPMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     Respondido
    Exchange Server 2003 does not have this cmdlet or an similar function.  If you want to use PowerShell and you are using Exchange 2003, you could probably use the Quest Active Directory Powershell tools
    http://www.quest.com/powershell/activeroles-server.aspx

    You would need to install the PowerShell and then install the Quest tools. Then take a look at the Add-QADGroupMember cmdlet that Quest provides.
    Jim McBee - Blog - http://mostlyexchange.blogspot.com
  • domingo, 5 de julho de 2009 17:03Andrey Zakharov Medalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     
    WOW

    Jim thx, it work Perfect!!! :)

    Thanks
  • domingo, 5 de julho de 2009 20:39Jim McBee - Exchange MVPMVPMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     
    The Quest tools are great.  I use them on all of my E2K3 servers (that I wish I could migrate to E2K7)  :-)

    Jim McBee - Blog - http://mostlyexchange.blogspot.com
  • segunda-feira, 6 de julho de 2009 11:24anil-rocks Medalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     
    Exchange Server 2003 does not have this cmdlet or an similar function.  If you want to use PowerShell and you are using Exchange 2003, you could probably use the Quest Active Directory Powershell tools
    http://www.quest.com/powershell/activeroles-server.aspx

    You would need to install the PowerShell and then install the Quest tools. Then take a look at the Add-QADGroupMember cmdlet that Quest provides.
    Jim McBee - Blog - http://mostlyexchange.blogspot.com


    Hi Amit,

    I have 100+ DL's & need to add 15-30Users a memeber of it, can you please let me know how do i achieve this with VB script & a input file as csv

    The CSV file will be GroupName, DN,GroupType, Memebers (User Sam A/c) with clon seperated.

    Thanks

    Rocks