Nov 06 2018
12:02 PM
- last edited on
Feb 01 2023
10:53 AM
by
TechCommunityAP
Nov 06 2018
12:02 PM
- last edited on
Feb 01 2023
10:53 AM
by
TechCommunityAP
We are changing several accounts from E3 to E1 and I need a Method to automate this.
My thought is to create a Text file with the Account names like Waldo@mydomain.com and name it E3toE1Feed.txt
Then Run:
Get-Content "D:\E3toE1Feed.txt" | Set-MsolUserLicense -UserPrincipalName $_.UserPrincipalName -AddLicenses "mydomain:STANDARDPACK"
but...
I get this Error:
Set-MsolUserLicense : Cannot bind argument to parameter 'UserPrincipalName' because it is null.
At line:1 char:81
+ ... | Set-MsolUserLicense -UserPrincipalName $_.UserPrincipalName -AddLic ...
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Set-MsolUserLicense], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.Online.Administration.Automatio
n.SetUserLicense
Anybody what I'm doing wrong? or a better method?
Nov 06 2018 12:19 PM
Nov 06 2018 10:12 PM
You'll probably just have to use foreach.
Something like:
Get-Content "D:\E3toE1Feed.txt" | % { Set-MsolUserLicense -UserPrincipalName $_ -AddLicenses "mydomain:STANDARDPACK" }
Quadrotech - Management, Reporting and Migration for Office 365 and Exchange
Nov 06 2018 11:51 PM
There are multiple scripts out there that you can just reuse, this one will make the switch while preserving the status of any individually enabled/disabled services: https://blogs.technet.microsoft.com/cloudpfe/2014/01/30/how-to-change-office-365-licenses-in-bulk-re...
Nov 11 2018 12:09 PM
You could use Group Based licensing see https://docs.microsoft.com/en-us/azure/active-directory/fundamentals/active-directory-licensing-what...
Nov 14 2018 06:25 AM
My fix was this:
#Converts the Content of CSV file from E3 to E1 License
#
#Set Variable for What is Old and What is New
$oldLicense = "yourdomain:ENTERPRISEPACK"
$newLicense = "yourdomain:STANDARDPACK"
#Define source to work with
$users = import-csv .\E3toE1Group3.csv
#Process each Account in import file
foreach ($user in $users) {Set-MsolUserLicense -UserPrincipalName $users.userprincipalname -AddLicenses $newLicense -RemoveLicenses $oldLicense }