Updating ExchangeLabs groups using Powershell
One of the ways to manipulate a group on your tenant on ExchangeLabs is through the use of Powershell. If however you need to update a large amount of members into a specific group this is also quite simple using Powershell (and some built in cmdlets). In future we will look at using ILM to do the same, but we’ll need to check it the GROUP object type can be manipulated
Have a look at the following:
I have created a file that contains all my members that should be added to my group. In this example I have already created by group called “testGroup”.
Import file format
Name : StudentNumber
Name : 33809771
Name : 7990529
Name : 44940750
Parameters or required fields Connect to you ExchangeLabs tenant using Powershell
Group Identity: the group you want to add the member to
Input file: the members you wish to add to the group
In order to use Powershell 2 to connect to you ExchangeLabs service you must create a remote runspace using WinRM and Powershell 2. For more information regarding this procedure, refer to Remote Powershell with Exchange Labs. (note that once R3 launches this requirement will increase to CTP3)
Require components:
Windows PowerShell V2 Community Technology Preview 2 (CTP2)
WinRM 2.0 CTP
$LiveCred = Get-Credential
$rs = New-Runspace -Shell Microsoft.Exchange
-ConnectionUri https://ps.exchangelabs.com/powershell/
-Credential $LiveCred -Authentication Basic
Script to execute command
To read you text file of members into memory and add each member into the specified group (testGroup) execute the following command (all in one line.
Import-Csv C:names.txt -delimiter ":" |
foreach {Invoke-Command -r $rs { param($User)
add-distributiongroupmember -identity testGroup
-member $User.StudentNumber} -Arg $_}
Additional Reading
Remote PowerShell with Exchange Labs
Create Dynamic Distribution Groups in Exchange Labs