Saturday, July 27, 2019

How to add office 365 users in Office 365 groups = Group type "Office 365"


Script to bulk upload user to use Office 365 Group of type "Office 365" Not "Security".

1) Create a CSV file with colum name  "UserPrincipalName"
Add all the email, which needs Microsoft 365 license .


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#Create credential object
$credObject = Get-Credential
#Import the Exchange Online ps session
$ExchOnlineSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $credObject -Authentication Basic -AllowRedirection
Import-PSSession $ExchOnlineSession

Import-CSv -Path “C:\Users\sanjivk\D365\Assisgn Bulk license script\Assign D365 license user 1.0.CSV” | ForEach {

$UPN=$_.UserPrincipalName

Write-Host $UPN
Add-UnifiedGroupLinks –Identity "D365Prod-CR Account Configuration Team-OSG" –LinkType Members  –Links $UPN
}

No comments:

Post a Comment

HTML

Script:

JS