Step by Step Directions for Techs
Tag Archives: automatically assign licenses
October 24, 2013Posted by on
Well, you can’t. Have a great day!
Aside from this being super helpful, I have a workaround for you based on this post from Microsoft (it has a few minor errors) – http://social.technet.microsoft.com/wiki/contents/articles/15905.how-to-use-powershell-to-automatically-assign-licenses-to-your-office-365-users.aspx
This file (rename it to ZIP) has the Powershell files: O365LicenseScripts
This assumes that you have the MS Online Services Sign-In Assistant (you already have this if DirSync is installed) and Microsoft Online Services Module for PowerShell (found here http://g.microsoftonline.com/0BX10EN/423).
How to get it working:
- Unzip the files to C:\O365LicenseScripts (or where you keep your scripts). You can also recreate the scripts from the MSFT post, but there are a few issues with spaces, file names, and it doesn’t set a location for the users before assigning the license.
- Open Powershell
- CD to C:\O365LicenseScripts
- Run .\SetupScript.ps1
- [Office 365 directory sync account – using the onmicrosoft.com address]
- [Password for account]
This is the attribute in AD you are using to identify which users get licenses
Value that the users will have if in AD they are supposed to have the license
The attribute in AD that has the license name, like OFFICESUBSCRIPTION for Office.
- This will create several scripts from the TMP files and some text files.
If you run Get-LicensingInputFromAD.ps1, you will see what the system thinks the users should be and their corresponding licenses.
If you run AssignLicense.ps1, it will assign the licenses based on what the Get-LicensingInputFromAD.ps1 script output was (stored in the queuedLicense folder created during setup).
If you want to schedule it, you can use the Schedule.ps1 script. I won’t go too far into the weeds, but the command is “powershell.exe” (without the quotes) and the arguement is “-file C:\O365LicenseScripts\Schedule.ps1” (without the quotes).
There is one difference in my scripts. You will find 2 lines that are commented out in case you don’t want to set the license type in Active Directory. I often find that most customers only use one license type, so I put in an attribute to say which accounts get the license and then hard set the license in the script (set it in the TMP file otherwise the setup script will delete your work!).