Script to bulk upload user to use Office 365 Group of type "Security" Not "Office 365".
1) Create a CSV file with colum name "UserPrincipalName"
Add all the email, which needs Microsoft 365 license .
1) Create a CSV file with colum name "UserPrincipalName"
Add all the email, which needs Microsoft 365 license .
Set-ExecutionPolicy unrestricted Install-Module MSOnline $AzureAdCred = Get-Credential Connect-MsolService -Credential $AzureAdCred Import-CSv -Path “D:\Assign D365 license user 1.0.CSV” | ForEach { $UPN=$_.UserPrincipalName $Users=Get-MsolUser -UserPrincipalName $UPN
# Get the Security Group id from Azure Ad
$Groupid = Get-MsolGroup -ObjectId “1349607e-825a-45d0-b3a2-068de8f6” $Users | ForEach {Add-MsolGroupMember -GroupObjectId $GroupID.ObjectID -GroupMemberObjectId $Users.ObjectID -GroupMemberType User} }
No comments:
Post a Comment