none
Office 365 with PowerShell RRS feed

  • Question

  • I see many forums showing how to add multiple users to a single distribution group via PowerShell. Is there a way to add a single user to multiple distribution groups with PowerShell. For example take user 1 and add him to all 3 groups

    group1

    group2

    group3

    Wednesday, May 20, 2015 1:30 PM

Answers

All replies

  • Yes.  Just add the user to all three groups.

    $user='jsmith'

    'group1','group2','group3' | Add-AdGroupMember $_ -Member $user


    \_(ツ)_/

    Wednesday, May 20, 2015 1:57 PM
  • Will that work with this command add-distributiongroupmember for office 365?
    Wednesday, May 20, 2015 4:47 PM
  • Did you try it?


    \_(ツ)_/

    Wednesday, May 20, 2015 5:00 PM
  • Getting error Cannot bind argument to parameter 'Identity' because it is null.
    • Edited by CrazyJdean Wednesday, May 20, 2015 5:02 PM
    Wednesday, May 20, 2015 5:02 PM
  • Works fine on my O365 setup.  Perhaps you are not using good group names.

    Test with:

    Get-DsitributionGroup 'some group'


    \_(ツ)_/

    Wednesday, May 20, 2015 5:14 PM
  • I had to remove $_ from the command and it works now. Thanks for the help
    Wednesday, May 20, 2015 6:49 PM
  • I had to remove $_ from the command and it works now. Thanks for the help

    Sorry.  I didn't see that.  It was a remnant f my test but I forgot to remove it when I posted.

    Glad you got it.


    \_(ツ)_/

    Wednesday, May 20, 2015 10:23 PM