Add users to a distribution group based on Job title

Welcome Forums General PowerShell Q&A Add users to a distribution group based on Job title

This topic contains 1 reply, has 2 voices, and was last updated by  Forums Archives 7 years, 2 months ago.

  • Author
  • #6533

    Points: 0
    Rank: Member

    by Jordan at 2013-03-13 07:25:49

    Need a PowerShell script that will add users to a distribution group based on Job title.

    What I have so far.

    Add-DistributionGroupMember -Identity "Group name" -Job title "title name"

    by DonJ at 2013-03-13 08:16:13

    Yeah, but that command won't actually work. The documentation for Add-DistributionGroupMember is at ... 1%29.aspx; it does not have a "-job title" parameter.

    You specify -Identity to tell it what group to modify, and -Member to specify the new members. For example, -Member (), and in the parentheses you'd put a command that retrieved the users you wanted.

    by nate-n8 at 2013-03-13 10:46:00

    might be easier if you create a dynamic list instead based off the job title.

  • #111866

    Points: 2
    Rank: Member


    You can create a csv file of the users with specific job title, then use this csv file to update the distribution group members. Please follow the below script. Modify the bold italic part with your values

    • Get-User -ResultSize unlimited | Where-Object {$_.title -eq 'title name'} | Select-Object userprincipalname | Export-Csv c:\temp\Titleusers.csv
    • Import-Csv C:\temp\Titleusers.csv | ForEach-Object { Add-DistributionGroupMember -Identity DistributionGroupName -Member $_.userprincipalname}



The topic ‘Add users to a distribution group based on Job title’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort