Set Mailbox in PowerShell: A Step-by-Step Example
Managing mailboxes in a Windows environment can be a breeze with PowerShell. The Set-Mailbox cmdlet is a powerful tool that allows you to configure various aspects of mailboxes. Let's explore how to use this cmdlet with some practical examples.
Before we dive into the examples, ensure you have the Exchange Online PowerShell V2 module installed. If not, you can install it using the command: Install-Module -Name ExchangeOnlineManagement
Setting Mailbox Properties
The Set-Mailbox cmdlet enables you to modify numerous properties of a mailbox. Here are a couple of examples:
Setting an Email Address
You can use the Set-Mailbox cmdlet to set or modify the email address of a mailbox. Here's an example:
Set-Mailbox -Identity "John Doe" -EmailAddresses "johndoe@domain.com"
Enabling or Disabling Mailbox Features
You can enable or disable various features of a mailbox, such as Litigation Hold, In-Place Hold, or Retention Hold. Here's how you can enable Litigation Hold for a mailbox:
Set-Mailbox -Identity "John Doe" -LitigationHoldName "Litigation Hold"
Managing Mailbox Permissions
The Set-Mailbox cmdlet also allows you to manage mailbox permissions. Here are two subtopics demonstrating this:
Granting Full Access Permissions
You can grant full access permissions to another user, allowing them to open and use the mailbox as if it were their own. Here's an example:
Set-Mailbox -Identity "John Doe" -AddGrantee "Jane Doe" -AccessRights FullAccess
Removing Access Permissions
Similarly, you can remove access permissions from a mailbox. Here's how you can remove full access permissions granted to "Jane Doe":
Set-Mailbox -Identity "John Doe" -RemoveGrantee "Jane Doe" -AccessRights FullAccess
In your PowerShell journey, you'll find many more use cases for the Set-Mailbox cmdlet. Keep exploring and expanding your skills. Happy scripting!