Forum Discussion
Kazzan
Sep 21, 2017MVP
Bulk adding to Office 365 Groups with PowerShell
Hello, one of my customer actually trying to onboard every user in the organization to one Yammer Group which is linked to Office 365 Groups. We manage to automate onboarding for new users. But how t...
- Sep 22, 2017
I just did this:
[PS] C:\> $Users = (Get-Recipient -RecipientPreviewFilter {RecipientTypeDetails -eq "UserMailbox" -and CustomAttribute3 -ne "N"}
[PS] C:\> Add-UnifiedGroupLinks -Identity O365Group -LinkTypeMembers -Links $Users.Name
This creates an array of all user mailboxes in the tenant that are not marked with a value in one of the customized attributes. I then use the array as input to Add-UnifiedGroupLinks, which added all (30) the users to the group.
I forgot that I had this example in Chapter 15 of the Office 365 for IT Pros ebook... PowerShell is great!
cfiessinger
Microsoft
Sep 21, 2017Why not leverage dynamic membership instead? https://docs.microsoft.com/en-us/azure/active-directory/active-directory-accessmanagement-groups-with-advanced-rules
Kazzan
Sep 25, 2017MVP
Thanks for pointing to this. But we want a option to user to leave group and Dynamic Membership does not allow this because it add always user back. And also, it is in AAD Plan P1 and not all users are licensed for this.