Managing licenses for Microsoft 365 can be a daunting task, especially when you have a large number of users. However, PowerShell provides a powerful and efficient way to manage licenses in Microsoft 365. In this article, we will walk you through the steps to manage Microsoft 365 licenses using PowerShell.
To get started, launch PowerShell as an administrator and connect to Microsoft 365 PowerShell. You can do this by running the following command:
This command will prompt you to enter your Microsoft 365 admin credentials. Once you have entered your credentials, you will be connected to Microsoft 365 PowerShell.
Once you are connected to Microsoft 365 PowerShell, you can get a list of all available licenses by running the following command:
This command will return a list of all available licenses in Microsoft 365, along with their unique SKU IDs.
To view a list of all users in your organization who have been assigned licenses, run the following command:
This command will return a list of all users who have been assigned licenses, along with the details of the licenses they have been assigned.
To assign a license to a user, you can use the Set-MsolUserLicense cmdlet. Run the following command to assign a license to a single user:
Replace "user@domain.com" with the email address of the user you want to assign the license to. Replace "ENTERPRISEPACK" with the SKU ID of the license you want to assign.
You can also assign licenses to multiple users at once using PowerShell. To assign licenses to multiple users, create a CSV file with the following columns:
UserPrincipalName, AccountSkuId, and UsageLocation. For each user, enter their email address, the SKU ID of the license you want to assign, and the usage location (e.g. US, UK, etc.). Then, run the following command:
Replace "C:\Users.csv" with the path to the CSV file you created.
To remove a license from a user, use the Set-MsolUserLicense cmdlet again. Run the following command to remove a license from a single user:
Replace "user@domain.com" with the email address of the user you want to remove the license from. Replace "ENTERPRISEPACK" with the SKU ID of the license you want to remove.
You can also remove licenses from multiple users at once using PowerShell. To remove licenses from multiple users, create a CSV file with the following columns: UserPrincipalName, AccountSkuId, and UsageLocation. For each user, enter their email address, the SKU ID of the license you want to remove, and the usage location (e.g. US, UK, etc.). Then, run the following command:
To view the details of the licenses assigned to a specific user, run the following command:
Replace "user@domain.com" with the email address of the user you want to view license details for.
To view the details of the licenses assigned to all users in your organization, run the following command:
This command will return a list of all users in your organization along with the details of the licenses they have been assigned.
To disable a specific license for all users in your organization, run the following command:
Replace "ENTERPRISEPACK" with the SKU ID of the license you want to disable. Replace "SHAREPOINTWAC_EDU" with the SKU ID of the specific plan you want to disable.
In conclusion, PowerShell provides a powerful and efficient way to manage Microsoft 365 licenses. With PowerShell, you can quickly and easily assign licenses to users, remove licenses from users, view license details for specific users or all users, and disable specific licenses for all users. By using PowerShell to manage licenses, you can save time and ensure that your organization is properly licensed and compliant.