Simple UI based Office 365 License Management powershell script for custom list of users, script is based on the new AzureAD V2 module

Managing licenses with office 365 has become easier with Azure-AD group based Licensing and multi-select option on the office portal. But, there are many scenarios where Admins go for direct licensing assignment and removal. In many Organizations, admins are supplied with a custom list of users for the license modification and for each modification, the existing scripts (if any) has to be modified and complex parameters need to be supplied.

 To manage any kind of direct license management against a Custom list of Users, this script can be used. It is UI based and flexible to use. This script uses new AzureAD V2 module which implements the Graph API in PowerShell and provides access to newer functionality.

This script launches Windows Presentation framework based UI form and provides users with options either to run Online Query or process users from a CSV list. Using a License picker window, users can Add and/or Remove licenses and apply it on all users or selected users from the list, all at once. This script will only append to or remove the existing user licenses and plans. 

At Present, this script requires no Input parameters, but default switches like -Verbose can be added to view progress on the Powershell window. It creates a log by default on the script's directory which includes the Licenses and runtime details.

Updated to V1.1 - Sep 2017

    Changes:       Removed the Appliesto filter on the Subscribed Skus to list all service plans.       

 Enabled option to export to CSV

Prerequisites:

AzureAD Version 2 GA Module - https://www.powershellgallery.com/packages/AzureAD/2.0.0.115

Powershell Version 3 or greater

How to Use:

Open Powershell and run Connect-Azuread and complete the authentication with AzureAD

Launch the script from powershell. For example –

PS C:\Users\myuserID> D:\Scripts\O365LicenseMgmtV1.ps1

Once the UI is launched, select the input options.

 

If CSV file, it should have a Header with name UserPrinicipalName.

By selecting the second option you can run a custom query to fetch a filtered list to assign licenses against.

PS: The Filter Option can be used to further filter the list and it uses PS query as mentioned in the textbox field.

 

Select the Licenses you want to update to the users. Select all Service plans under an SKU if you Intend to select the complete SKU for adding or removing it from the users.

 

 

Once Licenses are Selected, Multi-select the users from the list to apply the licenses changes on. Click on the TOP left corner of the data grid to select all users. Once selected, click on the Execute button to apply the changes on to the users.

 

Once completed, you may view the result column and/or review the log file it creates to verify the results:

 

 

 

Please let me know if you find it useful or for any suggestions you may have.