Forum Discussion
Rising Flight
Jul 03, 2019Brass Contributor
license
Hi All
I want assign EMS license to 100 users and my users are in text file. The text file format is below. Will the below syntax work for me.
user
user1@abc.com
user2@abc.com
$LIC = New-MsolLicenseOptions -AccountSkuId "abc:EMS" -DisabledPlans "Service1","Service2","Service3"
$userlist = Get-Content -Path "C:\myusers.txt"
foreach ($user in $userlist){
Set-MsolUser -UserPrincipalName $user -UsageLocation "United Kingdom"
Set-MsolUserLicense -UserPrincipalName $user -AddLicenses "abc:EMS" -LicenseOptions $LIC
}
- headburghIron Contributor
Rising Flight since you want to assign EM+S Licenses. You could also use group-based licensing. Saves you the hassle of using Powershell and is more dynamic. But as previously stated your code would work but would need to be run every time you want to add another user.
https://docs.microsoft.com/en-us/azure/active-directory/users-groups-roles/licensing-groups-assign
/Viktor
- Poornim Dutt AluriCopper Contributor