Update Licensing \ Location information for Office 365 \ Azure \ MSOL Online
This will need some updating of coarse but here is the basics.
Connect to the 365 cloud:
$msolcred = get-credential
import-module MSOnline
connect-msolservice -credential $msolcred
Get the licenses that you have purchased for your account:
Get-MsolAccountSku | fl *sku*
Shows / Outputs (example):
AccountSkuId : <365masteraccountname>:STANDARDWOFFPACK_FACULTY
SkuId : <random id digits>
SkuPartNumber : STANDARDWOFFPACK_FACULTY
AccountSkuId : <365masteraccountname>:STANDARDWOFFPACK_STUDENT
SkuId : <random id digits>
SkuPartNumber : STANDARDWOFFPACK_STUDENT
Choose the one you want to assign to users and get the license options for (SkuPartNumber)
$LicensePlans = Get-MsolAccountSku | Where {$_.SkuPartNumber -eq "<SkuPartNumber>"}
List the options for the plan:
$LicensePlans.servicestatus
Shows / Outputs (example):
ServicePlan ProvisioningStatus
----------- ------------------
SHAREPOINTWAC_EDU Success
MCOSTANDARD Success
SHAREPOINTSTANDARD_EDU Success
EXCHANGE_S_STANDARD Success
Choose the plans you would like DISABLED and create a license plan:
$MyLicPlan = New-MsolLicenseOptions -AccountSkuId <365masteraccountname>:STANDARDWOFFPACK_STUDENT -DisabledPlans SHAREPOINTWAC_EDU, MCOSTANDARD
Turn all that work into a script:
Source
Record the credential to a file online if this needs to be automated as a task
(This is only the Password, it will be stored securely NOT in clear text):
#Use this next line to record the credentials.
#read-host -assecurestring | convertfrom-securestring | out-file C:\script\cred.txt
$password = get-content C:\Script\cred.txt | convertto-securestring
$msolcred = new-object -typename System.Management.Automation.PSCredential -argumentlist "dirsync@mydomain.edu",$password
import-module MSOnline
connect-msolservice -credential $msolcred
get-msoluser -UnlicensedUsersOnly –All -DomainName mydomain.edu | set-msoluser -UsageLocation "US"
$MyLicPlan = New-MsolLicenseOptions -AccountSkuId <365masteraccountname>:STANDARDWOFFPACK_STUDENT -DisabledPlans SHAREPOINTWAC_EDU,SHAREPOINTSTANDARD_EDU
get-msoluser -UnlicensedUsersOnly -All -DomainName mydomain.edu | Set-MsolUserLicense -LicenseOptions $MyLicPlan -AddLicenses <365masteraccountname>:STANDARDWOFFPACK_STUDENT