Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.
Creating Office 365 Groups with PowerShell
To get started a PowerShell session to Exchange Online needs to be established.
The following script can assist in connecting to Exchange Online quickly: https://gallery.technet.microsoft.com/office/Connect-To-Office-365-9b235018
Now that a session to Exchange Online has been established, now we can go ahead and run the following cmdlet to create the new group.
New-UnifiedGroup –DisplayName “Global-Ex-Support” –Alias GlobalExSupport
As you can see above the group has been created, however we have not specified if it should be a private or public group. By default the group is created as an empty public group with the owner as the admin user who created the group. Let’s go ahead and change the group's AccessType and add additional members to the group.
To set the group to private the following cmdlet can be used.
Set-UnifiedGroup –Identity GlobalExSupport –AccessType Private
So, the group GlobalExSupport has now been changed to private. Let’s go ahead and add some members to the newly created group.
To add members to the group the following cmdlet and be used.
Add-UnifiedGroupLink –Identity GlobalExSupport –LinkType Member –Links Farren@ThatLazyAdmin.com, Renjith@ThatlazyAdmin.com
How do you change the group owner once a group has been created already by another staff member?
To add an additional owner to the group, the following cmdlet can be used.
Add-UnifiedGroupLink –Identity GlobalExSupport –LinkType Owner –Link Farren@ThatLazyAdmin.com
To list the group members the following cmdlet can be used.
Get-UnifiedGroupLinks GlobalExSupport –LinkType Member
To list the group owners the following cmdlet can be used.
Get-UnifiedGroupLinks GlobalExSupport –LinkType Owner
To remove a group owner the following cmdlet can be used.
Remove-UnifiedGroupLinks –Identity GlobalExSupport –LinkType Owner –Links Farren.Prag
Now that we have looked at how to remove a group owner, let’s look at how to remove a group member as well.
To remove a group member the following cmdlet can be used.
Remove-UnifiedGroupLinks –Identity GlobalExSupport –LinkTypeMember –Links Renjith.VC
To wrap it up, we have gone through the creation and modification of an Office 365 group. Hope you got something out of it.