User Tools

Site Tools


add_user_in_groups

How to add users with csv in office 365 Groups (powershell)

Connect to your office 365 tenant :

$365Logon = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $365Logon -Authentication Basic -AllowRedirection
Import-PSSession $Session

Create an CSV file :

example.csv
email
s.ab@xxx.fr
g.a@xxx.fr
a.a@xxx.fr

Script PowerShell for import csv :

#ATTENTION ENCODAGE FOR THE FILE PS1 : Windows-1252 # OR UTF8 with Atom

import_test.ps1
#launch in powershell
 
Import-CSV "C:\example.csv" | ForEach-Object {
#Write-Host ($_.email)
Add-UnifiedGroupLinks –Identity "GROUPSOFFICE365" –LinkType Members –Links $_.email
}

Source : Morgane Tech Space


- created date : 2018.11.23 -

add_user_in_groups.txt · Last modified: 2019/05/17 17:07 by admin