The Get-MgUserMailboxSetting cmdlet in Microsoft Graph PowerShell is used to retrieve mailbox settings for a specific user. These settings can include automatic replies, language settings, and other preferences related to a user’s mailbox. This article will cover the syntax, examples, tips, common errors, and practical use cases for utilizing this cmdlet effectively.
Get-MgUserMailboxSetting -UserId <String>
UserId: This parameter is required and represents the unique identifier of the user. This can either be the user’s UserPrincipalName (email address) or their object ID.
Get-MgUserMailboxSetting -UserId "john.doe@contoso.com"
This will return settings such as automatic replies, time zone, and locale for the specified user.
Cause: Incorrect or nonexistent UserId specified.
Solution: Double-check the UserId and ensure the user exists.
Cause: The account running the cmdlet lacks sufficient permissions.
Solution: Ensure your account has the necessary permissions (e.g., MailboxSettings.Read).
Cause: The specified property is not valid or supported.
Solution: Review the properties you're trying to query and use valid ones.
The Get-MgUserMailboxSetting cmdlet is an essential tool for administrators seeking to manage and audit user mailbox settings in a Microsoft 365 environment. From checking automatic replies to confirming user preferences, this cmdlet offers a straightforward way to stay informed and compliant with organizational policies. Leveraging its capabilities for automation and customization can save time and ensure a more personalized experience for users.
Mailbox settings can be retrieved using the /users/{userId}/mailboxSettings endpoint. This returns user preferences like automatic replies, time zone, language, and more.
# Define the user (UPN or ID)
$userId = "john.doe@contoso.com"
# Define the Graph API endpoint
$uri = "https://graph.microsoft.com/v1.0/users/$userId/mailboxSettings"
# Invoke the API request
$response = Invoke-MgGraphRequest -Method GET -Uri $uri
# Output key mailbox settings
Write-Output "Time Zone : $($response.timeZone)"
Write-Output "Language : $($response.language.displayName)"
Write-Output "Automatic Replies : $($response.automaticRepliesSetting.status)"
Write-Output "Working Hours : $($response.workingHours.daysOfWeek -join ', ')"
✅ Equivalent to: Get-MgUserMailboxSetting -UserId "john.doe@contoso.com"
MailboxSettings.Read, MailboxSettings.ReadWrite MailboxSettings.Read, MailboxSettings.ReadWrite© m365corner.com. All Rights Reserved. Design by HTML Codex