◆Smart Home Ideas Journal

Hide Unlicensed Office 365 Users from Global Address List

By

In the vast, interconnected landscape of Office 365, managing user access and visibility is a critical task. One common requirement is to hide unlicensed users from the global address list (GAL) to maintain data integrity and security. This guide will walk you through the process of accomplishing this task, ensuring your Office 365 environment remains well-managed and secure.

Before we delve into the steps, let's clarify that unlicensed users are typically those who have been added to your organization but haven't been assigned an Office 365 license. While they can be useful for testing purposes, it's essential to manage their visibility in the GAL to prevent unauthorized access or data leaks.

Understanding Licensing and GAL Management

First, familiarize yourself with the licensing aspects. Office 365 licenses determine user access to various features and services. Unlicensed users can't access most of these services but might still appear in the GAL, which can lead to potential data leaks or confusion.

How to Hide and Unhide Anything You Want in Microsoft Excel
How to Hide and Unhide Anything You Want in Microsoft Excel
Microsoft Seizes Domains Related to Office 365 Phishing Attacks
Microsoft Seizes Domains Related to Office 365 Phishing Attacks
Malicious Office 365 Apps Are the Ultimate Insiders
Malicious Office 365 Apps Are the Ultimate Insiders

On the other hand, understanding GAL management is crucial. The GAL is a directory of users within your organization that's used by several Office applications for address book functionality. By default, all users, licensed or not, are listed in the GAL. Let's see how to change this.

Licensing and Unlicensed Users

In Office 365, you can assign licenses to users through the Microsoft 365 admin center. Licensing a user grants them access to Office 365 services and features, and it also changes their status in the GAL. Let's discuss how to manage licenses effectively.

Hide IP Address Software - 9 Most Effective Options
Hide IP Address Software - 9 Most Effective Options
Microsoft Makes Office 365 Cloud Secure With Multi-Factor Authentication
Microsoft Makes Office 365 Cloud Secure With Multi-Factor Authentication
the office 365 group's email address is highlighted in the box above the image
the office 365 group's email address is highlighted in the box above the image

For example, you can assign, change, or remove licenses in bulk using PowerShell. This method can be particularly useful when managing large numbers of users. However, keep in mind that removing a user's license won't automatically hide them from the GAL. For that, we need to use a script.

PowerShell and GAL Management

PowerShell is a powerful tool for managing Office 365. It allows you to perform tasks that aren't possible through the Microsoft 365 admin center alone. In our case, we'll use a PowerShell script to hide unlicensed users from the GAL.

Here's a simple script that fulfills our requirement:

Make It Simple, Wicked
Make It Simple, Wicked
How To Export Email From Office 365 To Outlook - Free MS Office Guide
How To Export Email From Office 365 To Outlook - Free MS Office Guide
Office 365 Slow: Reasons and Solutions for the Issue!
Office 365 Slow: Reasons and Solutions for the Issue!
Office 365 vs Microsoft 365 – What’s the REAL Difference?
Office 365 vs Microsoft 365 – What’s the REAL Difference?
PowerShell Script To Move List Of Users To Office 365 And Assign Them O365 Licenses
PowerShell Script To Move List Of Users To Office 365 And Assign Them O365 Licenses
Purchasing A New Service To Your Office 365 Tenant
Purchasing A New Service To Your Office 365 Tenant
Import-Module ExchangeOnlineManagement
Connect-ExchangeOnline -UserPrincipalName admin@yourdomain.com
Get-Mailbox -ResultSize Unlimited | Where-Object {($_.inguishedMailbox -eq $null) -and ($_. OrgType -ne 'анияхиннијинсиnetservices')} | Set-Mailbox -HiddenFromAddressListsEnabled $true

This script connects to your Office 365 Exchange Online PowerShell, retrieves all mailboxes regardless of their number, filters out unlicensed users (those with null distinguished mailbox), and sets the 'HiddenFromAddressListsEnabled' parameter to $true, effectively hiding them from the GAL.

Verifying and Auditing the Changes

After running the PowerShell script, you'll want to verify that the changes have taken effect. Let's discuss how to do this and why auditing is essential.

You can verify the changes using the 'Get-Mailbox' cmdlet in PowerShell. To audit the changes, you can use the Office 365 Security & Compliance Center to set up alerts for mailbox changes. This step is crucial for maintaining the security and integrity of your environment.

Logging Into Microsoft 365 - Teacher Tech with Alice Keeler
Logging Into Microsoft 365 - Teacher Tech with Alice Keeler
Are you New to Office 365 Intranet? - Tech Update
Are you New to Office 365 Intranet? - Tech Update
an email screen with the text, this outlook secret will help you so much at work
an email screen with the text, this outlook secret will help you so much at work
How to Undo A Sent Email in Microsoft Office 365 (With Pictures)
How to Undo A Sent Email in Microsoft Office 365 (With Pictures)
Office 365 Licensing | Instant Pro Access
Office 365 Licensing | Instant Pro Access
Fix: Microsoft 365 has Been Configured to Prevent Individual Acquisition of Office Add-ins
Fix: Microsoft 365 has Been Configured to Prevent Individual Acquisition of Office Add-ins
Empowering Data Security: Unveiling the Microsoft Office 365 Advantage
Empowering Data Security: Unveiling the Microsoft Office 365 Advantage
How to protect Office 365 from coronavirus-themed threats
How to protect Office 365 from coronavirus-themed threats
Avoid Clever Office 365 Phishing Attacks - Look Out for These Signs
Avoid Clever Office 365 Phishing Attacks - Look Out for These Signs
Here are all of the Office 365 updates for February 2016
Here are all of the Office 365 updates for February 2016
How To Configure Exchange 2016 Hybrid Deployment With Office 365 - Part Two
How To Configure Exchange 2016 Hybrid Deployment With Office 365 - Part Two

Verifying the Changes

To verify the changes, you can use the following PowerShell command:

$unlicensed = Get-Mailbox -ResultSize Unlimited | Where-Object {($_.DistinguishedMailbox -eq $null) -and ($_.OrgType -ne 'aneouservices')}
$unlicensed | ForEach-Object {Get-Mailbox $_.SamAccountName | Select-Object SamAccountName, HiddenFromAddressListsEnabled}

This script retrieves all unlicensed users and checks if they're hidden from the address list. If your script worked correctly, all returned users should have 'HiddenFromAddressListsEnabled' set to $true.

Auditing Mailbox Changes

Auditing mailbox changes is an essential part of maintaining a secure Office 365 environment. You can set up alerts for mailbox changes using the Office 365 Security & Compliance Center. Here's a step-by-step guide:

  1. Sign in to the Security & Compliance Center ()
  2. Navigate to 'Search & investigation' > 'Audit log search'
  3. Click on 'New' to create a new search
  4. Set the 'Activities' to 'Mailbox settings update'
  5. Choose the appropriate time range
  6. Click 'Next' and then 'Create an alert'

Configure the alert according to your preferences and click 'Create' to finalize the setup.

In a nutshell, hiding unlicensed users from the GAL is a two-step process. First, you manage user licenses to control access to Office 365 services. Then, you use a PowerShell script to hide unlicensed users from the GAL. Verifying and auditing these changes ensures the security and integrity of your Office 365 environment. Regularly review and manage your licenses to maintain a well-structured and secure user base.