Get List of all Microsoft Bookings Mailbox and Block Sign-In using PowerShell

Product: Exchange Online
Using: PowerShell

After connecting to exchange online, type the following command into the PowerShell to get list of all mailboxes associated with Microsoft Bookings.

Get-MailBox | Where {$_.RecipientTypeDetails -eq "SchedulingMailbox"} 

How about if you want to disable the sign-in for the accounts associated with Bookings. Simply assign the output of the above commands to the variable $msBookingsAccount and then iterate over it to



$msBookingsAccount = Get-MailBox | Where {$_.RecipientTypeDetails -eq "SchedulingMailbox"} 


foreach ($account in $msBookingsAccount){
        $email = $account.PrimarySmtpAddress
        $id = Get-AzureADUser -ObjectId $email
        $accountStatus = ($id).AccountEnabled

        write-host "$($accountStatus), $($id.DisplayName), $($email)"
        Set-AzureADUser -ObjectID $email -AccountEnabled $false
}

Scroll to Top