Using Set-CASMailbox in Powershell: Everything You Need to Know

When managing Exchange environments, whether on-premises or in the cloud, the Set-CASMailbox cmdlet is a crucial tool for administrators.

This command allows you to adjust client access settings on mailboxes, ensuring secure and efficient communication between users and their email clients.

This guide covers everything you need to know about using Set-CASMailbox in PowerShell, including steps, practical examples, and tips for effective mailbox management.

Whether you're new to Exchange administration or an experienced pro, we provide everything you need to get started with this cmdlet quickly.

What is the Set-CASMailbox PowerShell Cmdlet?

The Set-CASMailbox cmdlet is a command in Exchange PowerShell used to configure various client access settings on a mailbox.

This includes managing settings for protocols like Exchange ActiveSync, Outlook, Outlook on the web, POP3, and IMAP4. It allows administrators to enable or disable these protocols, control which devices can sync with the mailbox, and adjust other client access features, ensuring proper communication and functionality between mailboxes and different client applications in an Exchange environment.

Here’s a brief overview of the Set-CASMailbox command:

Set-CASMailbox

[-Identity] <MailboxIdParameter>

[-ActiveSyncAllowedDeviceIDs <MultiValuedProperty>]

[-ActiveSyncBlockedDeviceIDs <MultiValuedProperty>]

[-ActiveSyncDebugLogging <Boolean>]

[-ActiveSyncEnabled <Boolean>]

[-ActiveSyncMailboxPolicy <MailboxPolicyIdParameter>]

[-ActiveSyncSuppressReadReceipt <Boolean>]

[-Confirm]

[-DisplayName <String>]

[-DomainController <Fqdn>]

[-ECPEnabled <Boolean>]

[-EmailAddresses <ProxyAddressCollection>]

[-EwsAllowEntourage <Boolean>]

[-EwsAllowList <MultiValuedProperty>]

[-EwsAllowMacOutlook <Boolean>]

[-EwsAllowOutlook <Boolean>]

[-EwsApplicationAccessPolicy <EwsApplicationAccessPolicy>]

[-EwsBlockList <MultiValuedProperty>]

[-EwsEnabled <Boolean>]

[-HasActiveSyncDevicePartnership <Boolean>]

[-IgnoreDefaultScope]

[-ImapEnabled <Boolean>]

[-ImapEnableExactRFC822Size <Boolean>]

[-ImapMessagesRetrievalMimeFormat <MimeTextFormat>]

[-ImapForceICalForCalendarRetrievalOption <Boolean>]

[-ImapSuppressReadReceipt <Boolean>]

[-ImapUseProtocolDefaults <Boolean>]

[-IsOptimizedForAccessibility <Boolean>]

[-MacOutlookEnabled <Boolean>]

[-MAPIBlockOutlookExternalConnectivity <Boolean>]

[-MAPIBlockOutlookNonCachedMode <Boolean>]

[-MAPIBlockOutlookRpcHttp <Boolean>]

[-MAPIBlockOutlookVersions <String>]

[-MAPIEnabled <Boolean>]

[-MapiHttpEnabled <Boolean>]

[-Name <String>]

[-OneWinNativeOutlookEnabled <System.Boolean>]

[-OutlookMobileEnabled <Boolean>]

[-OWAEnabled <Boolean>]

[-OWAforDevicesEnabled <Boolean>]

[-OwaMailboxPolicy <MailboxPolicyIdParameter>]

[-PopEnabled <Boolean>]

[-PopEnableExactRFC822Size <Boolean>]

[-PopForceICalForCalendarRetrievalOption <Boolean>]

[-PopMessagesRetrievalMimeFormat <MimeTextFormat>]

[-PopSuppressReadReceipt <Boolean>]

[-PopUseProtocolDefaults <Boolean>]

[-PrimarySmtpAddress <SmtpAddress>]

[-PublicFolderClientAccess <Boolean>]

[-ResetAutoBlockedDevices]

[-SamAccountName <String>]

[-ShowGalAsDefaultView <Boolean>]

[-SmtpClientAuthenticationDisabled <Boolean>]

[-UniversalOutlookEnabled <Boolean>]

[-WhatIf]

[<CommonParameters>]

What Can You Use the Set-CASMailbox Command For?

The Set-CASMailbox cmdlet can be used to configure and manage client access settings on mailboxes in an Exchange environment. Here are three use cases:

  • Disabling ActiveSync for Specific Users: A company can use this cmdlet to disable Exchange ActiveSync for specific users. For example, if a company wants to prevent a user named Roger Doe from syncing his mobile device with the Exchange server, they would run the command to disable ActiveSync for his mailbox.
  • Blocking Specific Versions of Outlook: An organization might use this cmdlet to block specific versions of Outlook from accessing a mailbox. For instance, if the company needs to ensure that only certain versions of Outlook are allowed to connect for security and compatibility reasons, they can block older or unsupported versions.
  • Enabling or Disabling POP3 Access: A business might want to control access to mailboxes using the POP3 protocol. If they decide to disable POP3 access for a user, they can run a command to turn off this protocol for that user's mailbox, ensuring the user can't use POP3 clients to retrieve their email.

Prerequisites to Run Set-CASMailbox in PowerShell

To use the Set-CASMailbox cmdlet, the following prerequisites must be met:

  1. Permissions: First, you need to have the appropriate permissions assigned to your account to execute the Set-CASMailbox cmdlet.
  2. Exchange Environment: You must be operating within an Exchange environment, which could be on-premises Exchange Server (2010, 2013, 2016, 2019) or Exchange Online.
  3. PowerShell Access: You need access to the Exchange Management Shell or a PowerShell session connected to Exchange Online.
  4. Mailbox Identification: You must know the identity of the mailbox you want to configure. This can be specified using parameters like -Identity with a valid mailbox identifier (e.g., email address, user principal name, or mailbox alias).

How to Use Set-CASMailbox in PowerShell in 3 Easy Steps

To use the Set-CASMailbox cmdlet, we’ll follow three detailed steps to ensure you correctly configure client access settings on a mailbox in an Exchange environment.

Step 1: Open Exchange Management Shell or Connect to Exchange Online

First, on your Exchange Server, open the Exchange Management Shell. If you haven’t already installed the Exchange Online PowerShell module, run the following command:

Install-Module -Name ExchangeOnlineManagement

Once the module has been installed, connect to Exchange Online by running this cmdlet and using your account’s credentials:

Connect-ExchangeOnline -UserPrincipalName <youremail@meetingroom365.com> -Credential $UserCredential

This prompts you to enter your admin credentials and establish a connection to Exchange Online.

Step 2: Identify the Mailbox

Next, identify the mailbox you want to configure. The -Identity parameter accepts several types of identifiers, including the user’s email address, alias, user principal name, or GUID.

So, suppose you want to configure the mailbox for Roger Doe, whose email address is james@meetingroom365.com.You would use:

-Identity james@meetingrom365.com

Ensure you have the correct identifier to avoid making changes to the wrong mailbox and proceed with the next step.

Step 3: Execute the Set-CASMailbox Cmdlet with Desired Parameters

Familiarize yourself with the parameters available for the Set-CASMailbox cmdlet by checking the syntax mentioned above. Remember that each parameter allows you to enable or disable specific protocols and features for the mailbox.

For example, to disable ActiveSync and enable POP3 for Roger Doe's mailbox, use this command:

Set-CASMailbox -Identity james@meetingrom365.com -ActiveSyncEnabled $false -PopEnabled $true

Alternatively, if you’d like to disable Outlook on the Web for Roger Doe, use:

Set-CASMailbox -Identity james@meetingrom365.com -OWAEnabled $false

Execute the Set-CASMailbox cmdlet with the chosen parameters. Review the command and verify the settings you are applying. Finally, here’s an example of a complete command:

Set-CASMailbox -Identity james@meetingrom365.com -ActiveSyncEnabled $false -PopEnabled $true -OWAEnabled $false

This command disables Exchange ActiveSync, enables POP3, and disables the Outlook Web App (OWA) for the mailbox associated with james@meetingroom365.com in the Exchange environment.

After executing the cmdlet, verify the changes to ensure they have been applied correctly. You can use the Get-CASMailbox cmdlet to retrieve the current settings for the mailbox:

Get-CASMailbox -Identity james@meetingroom365.com | Format-List

Review the output to confirm the settings are as expected. That's it—you have just learned how to effectively use the Set-CASMailbox command in three steps!

Using Set-CASMailbox Command Effectively

Mastering the Set-CASMailbox cmdlet in PowerShell allows Exchange administrators to optimize client access settings effectively.

Whether you're managing access for different email protocols, ensuring compatibility with various Outlook versions, or balancing security and convenience, Set-CASMailbox offers the tools needed for efficient Exchange management.

You can now confidently utilize Set-CASMailbox to its fullest potential, ensuring a resilient and responsive Exchange environment for your organization.