@EavenHuang-0590
Step 1 : Prepare CSV file as picture below:
Step 2: Modify the script below:
$Mailboxes = import-csv c:/temp/users.csv #Location of CSV file
$PassWord = "Password123" #Default password for new created users, they are forced to change their password the next time they sign in.
$planName="domain:SPE_E3" #Plane name of your Office 365. "Get-MsolAccountSku"
foreach($Mailbox in $Mailboxes){
New-MsolUser -UserPrincipalName $Mailbox.PrimarySmtpAddress -DisplayName $Mailbox.DisplayName -UsageLocation us -Password $password -ForceChangePassword $true
Set-MsolUserLicense -UserPrincipalName $Mailbox.PrimarySmtpAddress -AddLicenses $planName
}
Step 3: Connect with the Microsoft Azure Active Directory Module for Windows PowerShell
Step 4: Run this script(The output is the result of creating users, and those users will be assigned license in the next step automatically):
You can use command below to double check the license status of new users:
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.