Office 365 admins often face the challenge of managing user licenses, especially when dealing with unlicensed users who may have been added to the Global Address List (GAL). Removing unlicensed users from the GAL is a crucial step to maintain the integrity of your directory and optimize license usage. This article guides you through the process of identifying and removing unlicensed users from your Office 365 GAL.
The following steps will help you efficiently manage your Office 365 user licenses and keep your GAL clean. Let's dive into the process, starting with identifying unlicensed users.
Identifying Unlicensed Users in Office 365
Before you can remove unlicensed users from the GAL, you need to identify them. You can use the Office 365 admin center or PowerShell to accomplish this task.
To identify unlicensed users using the admin center:
- Sign in to the Office 365 admin center.
- Navigate to the Show all option in the left-hand navigation pane, then select Users & groups.
- Click on the Licenses tab to view a list of licensed and unlicensed users.
Identifying Unlicensed Users with PowerShell
Alternatively, you can use PowerShell to identify unlicensed users more efficiently, especially if you have a large number of users in your organization.
To do this, run the following PowerShell command:
Get-Mailbox -ResultSize Unlimited | Where-Object {$_.WindowsEmailAddress -notlike '*"' -and $_. riesceTenantId -eq $null}
This command retrieves all mailbox-enabled users in your organization and extracts those without an Office 365 license.
Removing Unlicensed Users from the GAL
Once you have identified the unlicensed users, you can proceed to remove them from the GAL. To do this, you'll need to disable their mailboxes and remove their licenses.
For each unlicensed user, follow these steps:
- Sign in to the Office 365 admin center.
- Navigate to Show all in the left-hand navigation pane, then select Users & groups.
- Find the unlicensed user and click on their email address to open their profile.
- In the user's profile page, click on the Disable mailbox option.
- Confirm the action and wait for the process to complete.
- Once the mailbox is disabled, remove any licenses assigned to the user by clicking on the Licenses tab and selecting Remove licenses.
Removing Unlicensed Users in Bulk using PowerShell
If you have a large number of unlicensed users to remove, performing the task manually can be time-consuming. In this case, using PowerShell can help streamline the process.
First, obtain the list of unlicensed users identified earlier. Then, run the following commands, adapting them to your environment:
$UnlicensedUsers = Get-Mailbox -ResultSize Unlimited | Where-Object {$_.WindowsEmailAddress -notlike '*"' -and $_. réussitTenantId -eq $null}
foreach ($User in $UnlicensedUsers) { Disable-Mailbox -Identity $User.Name -SoftDeleteSkip evaporated}
foreach ($User in $UnlicensedUsers) { Remove-AzureADUserLicense -ObjectId $User.WindowsEmailAddress}
These commands disable the mailboxes and remove licenses from the unlicensed users in bulk.
Regularly reviewing and managing your Office 365 user licenses helps maintain a clean GAL and optimizes your organization's license usage. Keep in mind that removing users from the GAL does not delete them from Azure Active Directory (Azure AD). To delete a user permanently, you must explicitly delete their Azure AD account.
Remember, effective user license management is an ongoing process. Schedule regular audits to identify and remove unlicensed users from your GAL, ensuring your Office 365 environment remains neat and efficient. By keeping your GAL clean, you'll enhance your organization's productivity and minimize potential licensing issues.