ArtikelRahmen V5 MS365 ExchangeOnline V2 1

The ExchangeOnlineManagement module allows administrators to manage a variety of tasks through PowerShell, from user account management to configuring mailbox settings. By leveraging PowerShell for Exchange Online, administrators can automate complex and repetitive tasks.

Examples: “ExchangeOnlineManagement

Install & Connect-ExchangeOnline

Installs the module and connects to the Exchange Online environment.

  • Install-Module -Name ExchangeOnlineManagement -Force
  • installs the Exchange Online Management Module for PowerShell, which is required to manage Exchange Online via PowerShell. The parameter -Force ensures that the module is installed without further prompting, even if an older version is already available.
  • Connect-ExchangeOnline -UserPrincipalName [ADMIN-BENUTZER]
  • Connect to Exchange Online using the credentials of the specified administrator.

New-Mailbox

Creates a new mailbox.

  • New-Mailbox -UserPrincipalName user@domain.com -Alias user -Database “MailboxDatabase01” -Name “User” -OrganizationalUnit “Users” -Password (ConvertTo-SecureString -String “password” -AsPlainText -Force)
  • creates a new mailbox for the user user@domain.com.
  • New-Mailbox -Name “SharedMailbox” -Shared
  • creates a new shared mailbox named SharedMailbox.
  • New-Mailbox -Name “RoomMailbox” -Room
  • creates a new room mailbox named RoomMailbox.

Get-Mailbox

Retrieves information about mailboxes in Exchange environments.

  • Get-Mailbox -ResultSize unlimited
  • returns a summary list of all mailboxes in your organization.
  • Get-Mailbox -OrganizationalUnit Users
  • provides a list of all mailboxes in the Users.
  • Get-Mailbox -Anr Chr
  • finds all mailboxes that match the string “Chr”.
  • get-mailbox -identity [USER] | fl
  • Retrieves detailed information about a specific user mailbox and outputs it as a list.
  • Get-MailboxFolderPermission -Identity [USER]:\Calendar
  • Get-MailboxFolderPermission -Identity [USER]:\Calendar
  • Gets permissions on a user’s calendar.
  • Get-Mailbox | ForEach { Get-MailboxFolderPermission (($_. PrimarySmtpAddress.ToString())+”:\Calendar”) -User [USER] -ErrorAction SilentlyContinue} | select Identity,User,AccessRights
  • All calendars are displayed where the [user] has permissions.

Set mailbox

Changes the settings of existing mailboxes.

  • Set-Mailbox -Identity “User1” -HiddenFromAddressListsEnabled $true
  • hides User1’s mailbox in the address lists.
  • Set-Mailbox -Identity “User2” -ProhibitSendReceiveQuota 10GB
  • sets the send/receive limit for User2’s mailbox to 10GB.
  • Set-Mailbox -Identity “User3” -ForwardingAddress “User4”
  • forwards emails from User3 to User4.
  • Set-MailboxFolderPermission -Identity [USER]:\Calendar -User [B.USER] -AccessRights Editor
  • add-MailboxFolderPermission [USER]:\Calendar -User [B.USER] -AccessRights Editor
  • Calendar (store permissions for the B.USER) – ATTENTION – first user with SET – add more users with ADD.
  • Add-MailboxPermission -Identity “buchhaltung@contaro.com” -User “testo@contaro.com” -AccessRights FullAccess
  • Full access to the mailbox “ACCOUNTING, for the user TESTO”
  • Set-MailboxSentItemsConfiguration -Identity [MAILBOX-ALIAS] -SendAsItemsCopiedTo SenderAndFrom
  • Sent items in the mailbox from which the shipment was made (OnPREM / EXO via GUI possible!)
  • Set-Mailbox “MAILBOX” -GrantSendOnBehalfTo “USER”
  • Add-Mailbox “MAILBOX” -GrantSendOnBehalfTo “USER”
  • USER is allowed to enter the MAILBOX “Send on behalf of…”. ATTENTION – first user with SET – add more users with ADD.
  • get-mailbox -Identity testo@contaro.com | Set-CalendarProcessing -ProcessExternalMeetingMessages $true
  • Exchange Hybrid | Room mailbox from Exchange OnPrem / room mailbox in O365 – no notification
  • Get-Mailbox -ResultSize unlimited | ? {$_. RecipientTypeDetails -eq “UserMailbox”} | Set-MailboxRegionalConfiguration -Language “de-DE” -DateFormat “dd.MM.yyyy” -TimeFormat “HH:mm” -TimeZone “W. Europe Standard Time” -LocalizeDefaultFolderName
  • Set ALL mailboxes to the correct time zone

Remove-Mailbox

Deletes mailboxes and their associated user accounts.

  • Remove-Mailbox -Identity “John Rodman”
  • removes the mailbox and user account for John Rodman.
  • Remove-Mailbox -Identity “John Rodman” -Permanent $true
  • immediately and permanently removes the mailbox and user account for John Rodman.
  • $Temp = Get-Mailbox | Where {$_. DisplayName -eq ‘John Rodman’}; Remove-Mailbox -Database Server01\\Database01 -StoreMailboxIdentity $Temp.MailboxGuid
  • removes John Rodman’s mailbox from the mailbox database.

Get-MailboxStatistics

Displays statistics about a mailbox.

  • Get-MailboxStatistics -Identity AylaKol
  • fetches the mailbox statistics for the mailbox of the user Ayla Kol.
  • Get-MailboxStatistics -Server MailboxServer01
  • retrieves the mailbox statistics for all mailboxes on the MailboxServer01 server.
  • Get-MailboxStatistics -Database “Mailbox Database”
  • fetches the mailbox statistics for all mailboxes in the specified mailbox database.
  • Get-MailboxStatistics [Harry] | ft DisplayName, TotalItemSize
  • displays the username and size of the mailbox for the user Harry.
  • Get-MailboxStatistics -Server erpex13-mbx | Sort-Object TotalItemsize –Descending
  • sorts the mailboxes on the server erpex13-mbx in descending order of size.

Get-Recipient

Retrieves recipient information.

  • Get-Recipient -ResultSize unlimited
  • This example retrieves a summary list of all recipients in your organization.
  • Get-Recipient -Identity “Marketing Department” | Format List
  • Here, detailed information is returned for the recipient named “Marketing Department”.
  • Get-Recipient -RecipientType MailContact -SortBy Office | Format-Table -Auto Office,Name
  • This example retrieves information about all mail contacts in your organization and sorts them by office.
  • Get-Recipient -Filter {CustomAttribute1 -eq “Value1”}
  • This command allows you to search for recipients that have a specific custom attribute.
  • Get-Recipient -OrganizationalUnit “OU=Sales,DC=domain,DC=com”
  • This example shows how you can retrieve recipients in a specific OU.

Set-Recipient (Update-Recipient)

Configures recipient settings.

  • Update-Recipient -Identity “John Smith”
  • This example adds Exchange attributes to the mail contact that represents John Smith’s mailbox.
  • Get-MailContact -OrganizationalUnit “contoso.com/fabrikam.com Users” | Update Recipient
  • In this example, all contacts are updated in a specific OU. This is useful when synchronizing receivers between two forests.
  • Get-Recipient -Filter {CustomAttribute1 -eq “Value1”} | Update Recipient
  • This example shows how you can update recipients with a specific custom attribute.
  • Get-MailContact -OrganizationalUnit “msxfaq.de/Mailkontakte” | Update Recipient
  • This is especially useful when a large number of objects, such as contacts, need to be configured correctly in Exchange.

New-DistributionGroup

Creates new distribution groups and mail-enabled security groups.

  • New-DistributionGroup -Name “Managers” -Type “Security”
  • This example creates a group without specifying a member. Members can be added later.
  • New-DistributionGroup -Name “ITDepartment” -Members chris@contoso.com,michelle@contoso.com,laura@contoso.com,julia@contoso.com
  • Here, a group with predefined members is created.
  • New-DistributionGroup -Name “Marketing Managers” -Alias “MarketingMgrs” -PrimarySmtpAddress “MarketingManagers@Crescent.com” -Type Distribution
  • This example creates a group with a primary SMTP address attribute.

Get-DistributionGroup

Gets information about distribution groups.

  • Get-DistributionGroup
  • This example provides an overview of all distribution groups and mail-enabled security groups in your organization.
  • Get-DistributionGroup -Identity “Marketing Reports” | Format List
  • Detailed information about the specific group “Marketing Reports” is retrieved here.
  • Get-DistributionGroup -Anr marketing | Format-Table Name, ManagedBy -Auto
  • This example shows all distribution groups and mail-enabled security groups whose names contain the string “marketing” and shows the group owners.
  • Get-DistributionGroup -OrganizationalUnit “marketing” | Format List
  • This command retrieves the distribution groups and mail-enabled security groups that are located under the marketing OU.
  • Get-DistributionGroup -DomainController “exchDC1”
  • This command is used to retrieve information about all distribution groups in a given domain, which is controlled by the domain controller “exchDC1”.

Set-DistributionGroup

Configures a distribution group.

  • Set-DistributionGroup -Identity “Accounting” -DisplayName “Accounting Group”
  • This example changes the display name of the distribution group “Accounting” to “Accounting Group”.
  • Set-DistributionGroup -Identity “Bldg34 Conf Rooms” -RoomList
  • Here, the distribution group “Bldg34 Conf Rooms” is converted into a room list.
  • Set-DistributionGroup -Identity Ed_DirectReports -Name Ayla_DirectReports -IgnoreNamingPolicy
  • This example changes the name of the distribution group from Ed_DirectReports to Ayla_DirectReports, ignoring the group naming policy.
  • Set-DistributionGroup “Finance USA” -RequireSenderAuthenticationEnabled $False
  • This command allows external users to send email to the Finance USA distribution group.
  • Set-DistributionGroup “Finance UK” -PrimarySmtpAddress finance@contoso.com
  • Here, the primary email address of the Finance UK distribution group is set to finance@contoso.com.
  • Set-DistributionGroup “Sales UK” -HiddenFromAddressListsEnabled $True
  • This command hides the Sales UK distribution group from the Global Address Book.
  • Set-DistributionGroup -identity “marketing” -AcceptMessagesOnlyFrom “AbbeyCrawford2”
  • This example specifies that only AbbeyCrawford2 is allowed to send messages to the marketing distribution group.

Remove-DistributionGroup

Removes distribution groups and mail-enabled security groups.

  • Remove-DistributionGroup -Identity “Temporary Staff”
  • This example removes the Temporary Staff distribution group.
  • Remove-DistributionGroup -Identity “Project Team” -Confirm:$false
  • Here, the Project Team distribution group is removed without a confirmation prompt.
  • Remove-DistributionGroup -Identity “Sales Group” -BypassSecurityGroupManagerCheck
  • This command removes the Sales Group distribution group, even if the user is not the owner of the group.
  • Remove-DistributionGroup -Identity “HR Department” -DomainController “dc01.contoso.com”
  • This example removes the HR Department distribution group using a specific DomainController.
  • Remove-DistributionGroup -Identity “Marketing Team” -WhatIf
  • The command indicates what would happen if the Marketing Team distribution group was removed without actually deleting it.

New-TransportRule

Create transport rules (mail flow rules) to control the flow of messages.

  • New-TransportRule “Ethical Wall – Sales and Brokerage Departments” -BetweenMemberOf1 “Sales Department” -BetweenMemberOf2 “Brokerage Department” -ExceptIfFrom “Tony Smith”,”Pilar Ackerman” -ExceptIfSubjectContainsWords “Press Release”,”Corporate Communication” -RejectMessageReasonText “Messages sent between the Sales and Brokerage departments are strictly prohibited.”
  • Creates a rule that blocks messages between the Sales and Brokerage departments, except when certain conditions are met, such as specific senders or subject lines.
  • New-TransportRule -Name “Block External Email” -FromScope NotInOrganization -RejectMessageEnhancedStatusCode “5.7.1” -RejectMessageReasonText “External emails are not allowed.”
  • Blocks all incoming emails from outside the organization with a specific rejection message.
  • New-TransportRule -Name “Auto Forward to Manager” -SentTo “employee@domain.com” -RedirectMessageTo “manager@domain.com”
  • Automatically forwards all emails sent to a specific employee to their manager.
  • New-TransportRule -Name “Confidential Data Filter” -SubjectContainsWords “Confidential” -ApplyRightsProtectionTemplate “RMS Template”
  • Applies a rights management template to all emails that contain the word “Confidential” in the subject.
  • New-TransportRule -Name “Attachment Blocker” -AttachmentHasExecutableContent $true -RejectMessageReasonText “Executable attachments are not allowed.”
  • Blocks all emails with executable attachments and issues a specific rejection message.
  • New-TransportRule -Name “External Domain Alert” -FromAddressMatchesPatterns “.*@externaldomain.com” -GenerateIncidentReport “admin@domain.com”
  • Generates an incident report for all emails sent from a specific external domain and sends it to the administrator.
  • New-TransportRule -Name “Marketing Campaign Tag” -SubjectContainsWords “Marketing” -SetHeaderName “X-Campaign” -SetHeaderValue “MarketingCampaign”
  • Adds a custom header to emails that include the word “marketing” in the subject line to mark them as part of a marketing campaign.

Get-TransportRule

Displays transport rules in an Exchange organization.

  • Get-TransportRule
  • This example returns a list of all transport rules in the organization.
  • Get-TransportRule “Ethical Wall – Sales and Brokerage Departments” | Format List
  • Detailed information about the Ethical Wall – Sales and Brokerage Departments rule is returned here.
  • Get-TransportRule -DlpPolicy “PII (U.S.)”
  • This example returns an overview of the rules that enforce the PII (US) DLP policy in the organization.
  • Get-TransportRule | Where {$. DlpPolicy -ne $null}_
  • This example lists all the rules that enforce DLP policies in the organization.
  • Get-TransportService | Get-MessageTrackingLog -Start $Start -End $End -EventId AGENTINFO -ResultSize unlimited | select timestamp,sender,eventid,recipients,eventdata -last 3 | ft eventdata
  • This command helps to determine which transport rules have been applied to a particular email from the message tracking logs.

Set-TransportRule

Modifies existing transport rules in Exchange environments.

  • Set-TransportRule “Sales Team Disclaimer” -FromMemberOf “Sales Department”
  • This example modifies the Sales Team Disclaimer rule by adding the condition that the sender of the message must be a member of the Sales Department group.
  • Set-TransportRule -Identity “External Emails Notice” -ExceptIfSenderDomainIs apple.com,microsoft.com
  • Here, the “External Emails Notice” rule is changed to exclude emails from the apple.com and microsoft.com domains.
  • Set-TransportRulePropertiesS -RuleName “External Emails Notice” -Property “ExceptIfSenderDomainIs” -AddValues “microsoftonline.com”,”office365.com”
  • This example adds additional domains to the External Emails Notice rule to exclude.
  • Set-TransportRulePropertiesS -RuleName “External Emails Notice” -Property “ExceptIfSenderDomainIs” -RemoveValues “apple.com”,”office365.com”,”ccsend.com1″
  • This example removes specific domains from the exception list of the External Emails Notice rule.
  • Set-TransportRulePropertiesS -RuleName “External Emails Notice” -Property “ExceptIfSenderDomainIs” -AddValues “microsoftonline.com”,”office365.com” -RemoveValues “apple.com”,”office365.com”,”ccsend.com1″
  • Here, new values are added and existing values are removed from the External Emails Notice rule at the same time.

Remove-TransportRule

Removes transport rules in an Exchange organization.

  • Remove-TransportRule -Identity “Redirect messages from kim@contoso.com to legal@contoso.com”
  • This example removes the rule that redirects messages from kim@contoso.com to legal@contoso.com.
  • Get-TransportRule | foreach { Remove-TransportRule $. Guid -Confirm:$false }_
  • Here, all existing mail flow rules in the organization are removed.
  • Remove-TransportRule -Identity “Confidential Data Filter” -Confirm:$false
  • This example removes the Confidential Data Filter rule without displaying a confirmation prompt.
  • Remove-TransportRule -Identity “External Partner Email Filter” -DomainController “dc01.contoso.com”
  • This example removes the External Partner Email Filter rule using a specific DomainController.
  • Remove-TransportRule -Identity “Marketing Campaign Filter” -WhatIf
  • The command indicates what would happen if the “Marketing Campaign Filter” rule was removed without actually deleting it.

Get-MessageTrace

Searches news data from the last 10 days. Without parameters, data from the last 48 hours is supplied.

  • Get-MessageTrace -SenderAddress john@contoso.com -StartDate 06/13/2018 -EndDate 06/15/2018
  • This example fetches message tracking information for messages sent from john@contoso.com between June 13 and June 15, 2018.
  • Get-MessageTrace -RecipientAddress jane@contoso.com
  • Useful for keeping track of all the messages sent to jane@contoso.com.
  • Get-MessageTrace status “Failed”
  • This could be used to find all the messages that failed to be delivered.
  • Get-MessageTrace -FromIP “192.168.1.1”
  • Useful for tracking messages sent from a specific IP address.
  • Get-MessageTrace -MessageId “d9683b4c-127b-413a-ae2e-fa7dfb32c69d@DM3NAM06BG401.Eop-nam06.prod.protection.outlook.com”
  • This example would provide detailed information about a specific message with the specified message ID.

Get-MessageTraceDetail

message tracking events for a specific message. Searches data from the last 10 days. Without parameters, data from the last 48 hours is supplied.

  • Get-MessageTraceDetail -MessageTraceId ae5c1219-4c90-41bf-fef5-08d837917e7c -RecipientAddress robert@contoso.com
  • This example retrieves detailed information for messages with message tracking ID ae5c1219-4c90-41bf-fef5-08d837917e7c that were sent to robert@contoso.com.
  • Get-MessageTrace -MessageTraceId 2bbad36aa4674c7ba82f4b307fff549f -SenderAddress john@contoso.com -StartDate 06/13/2018 -EndDate 06/15/2018 | Get-MessageTraceDetail
  • Here, message tracking information for messages from john@contoso.com between June 13 and June 15, 2018 is retrieved and routed to Get-MessageTraceDetail.
  • Get-MessageTraceDetail – SEND event
  • This could be used to get details about messages sent by the system.
  • Get-MessageTraceDetail -Action “Block”
  • Useful for getting details about messages that have been blocked due to certain conditions.
  • Get-MessageTraceDetail -StartDate “01/01/2023” -EndDate “01/31/2023”
  • This example would provide detailed information about news in January 2023.

New-PublicFolder

Create a new public folder with the specified name.

  • New-PublicFolder -Name “Marketing”
  • This example creates the Marketing public folder in the root folder of the public folder.
  • New-PublicFolder -Name “FY2014” -Path “\Legal\Cases”
  • This example creates the FY2014 public folder under the existing \Legal\Cases folders.
  • New-PublicFolder -Name “Support” -Mailbox “North_America”
  • This example creates the Support public folder in the North_America public folder hierarchy mailbox.
  • New-PublicFolder -Name “Project2023” -Confirm
  • This example creates the Project2023 public folder and displays a confirmation prompt.

Get-PublicFolder

Retrieve attributes of a public folder or a group of public folders.

  • Get-PublicFolder
  • This example returns the public folder root object (IPM_SUBTREE) without any parameters.
  • Get-PublicFolder -Identity \NON_IPM_SUBTREE -Recurse | Format-List Name
  • This example returns the names of all system folders, starting with the system folder root (\NON_IPM_SUBTREE).
  • Get-PublicFolder -Identity “\Legal\Documents\Pending Litigation”
  • This example returns the Pending Litigation public folder from \Legal\Documents\.
  • Get-PublicFolder -Identity “\Legal\Documents\Pending Litigation” -Recurse
  • This example returns the Pending Litigation public folder from \Legal\Documents\ and any public folders below it.
  • Get-PublicFolder -Mailbox “Legal Department” -ResidentFolders
  • This example returns the public folders that reside in the Legal Department public folder content mailbox.

Set-PublicFolder

Configures the attributes for public folders in Exchange environments.

  • Set-PublicFolder “\Customer Service Requests” -UseDatabaseReplicationSchedule $false
  • Disables the default replication schedule of the database for the Customer Service Requests public folder.
  • Set-PublicFolder “\Customer Service Requests” -OverrideContentMailbox North_America
  • Changes the content location of the mailbox for the public folder hierarchy to North_America.
  • Set-PublicFolder \MyPublicFolder -ReplicationSchedule “Saturday.12:00 AM-Monday.12:00 AM”
  • Specifies that the MyPublicFolder public folder replicates only on weekends.
  • Set-PublicFolder -Identity “StellarPF03” -IssueWarningQuota 1GB -ProhibitPostQuota 2GB
  • Sets warning and prohibition post quotas for the StellarPF03 public folder.
  • Set-PublicFolder -Identity “PFFolder03” -ProhibitSendReceiveQuota 5GB -IssueWarningQuota 4GB -UseDatabaseQuotaDefaults $false
  • Adjusts the send/receive and alert quotas for the PFFolder03 public folder, and disables the use of database quota standards.
  • Set-PublicFolder -Identity “\Marketing” -HiddenFromAddressListsEnabled $true
  • Hides the public folder “Marketing” in the address lists.
  • Set-PublicFolder -Identity “\HR Documents” -PerUserReadStateEnabled $false
  • Disables user-specific read status management for the HR Documents public folder.

Remove-PublicFolder

Removes an existing public folder from all servers in your organization.

  • Remove-PublicFolder -Identity “\Test\Directory\My Public Folder”
  • Deletes the My Public Folder from the \Test\Directory directory tree.
  • remove-publicfolder -identity “\test\directory folder” -recurse
  • Deletes the Directory Folder public folder and all of its child public folders using the Recurse option.

New-InboxRule

Creates inbox rules for mailboxes in Exchange Online.

  • New-InboxRule -Name “MoveToFolder” -Mailbox “John Doe” -SubjectContainsWords “Invoice” -MoveToFolder “Invoices”
  • Moves emails with the word “Invoice” in the subject to the “Invoices” folder for John Doe’s mailbox.
  • New-InboxRule -Name “ForwardToManager” -Mailbox “Jane Doe” -From “ExternalVendor” -ForwardTo “Manager@domain.com”
  • Forwards emails from “ExternalVendor” to “Manager@domain.com” in Jane Doe’s inbox.
  • New-InboxRule -Name “MarkAsImportant” -Mailbox “Alex Smith” -SubjectContainsWords “Urgent” -MarkImportance “High”
  • Mark emails with “Urgent” in the subject line as important in Alex Smith’s inbox.
  • New-InboxRule -Name “DeleteSpam” -Mailbox “Maria Garcia” -SubjectContainsWords “Lottery,Win” -DeleteMessage $true
  • Deletes emails with the words “Lottery” or “Win” in the subject line in Maria Garcia’s inbox.
  • New-InboxRule -Name “AutoReply” -Mailbox “David Lee” -SubjectOrBodyContainsWords “Out of Office” -ReplyWithTemplate “TemplateID”
  • Sends automatic replies to emails that contain “Out of Office” in the subject or body in David Lee’s mailbox.
  • New-InboxRule -Name “ArchiveOldEmails” -Mailbox “Emma Wilson” -ReceivedBeforeDate “01/01/2023” -MoveToFolder “Archive”
  • Moves emails received before 01/01/2023 to the Archive folder in Emma Wilson’s inbox.
  • New-InboxRule -Name “FlagForFollowUp” -Mailbox “Oliver Brown” -SubjectContainsWords “Review” -FlaggedForAction “FollowUp”
  • Marks emails with “Review” in the subject line in Oliver Brown’s mailbox for follow-up.

Get-InboxRule

Configures and manages inbox rules in Microsoft 365 / Exchange Online.

  • Get-InboxRule -Mailbox Joe@Contoso.com
  • Gets all the inbox rules for the mailbox Joe@Contoso.com.
  • Get-InboxRule “ReceivedLastYear” -Mailbox joe@contoso.com -DescriptionTimeFormat “mm/dd/yyyy” -DescriptionTimeZone “Pacific Standard Time”
  • Retrieves the ReceivedLastYear inbox rule from the joe@contoso.com mailbox, specifying the time format and time zone.
  • Get-InboxRule -Identity “MoveToFolderRule” -Mailbox “user@domain.com”
  • Retrieves a specific inbox rule named MoveToFolderRule from the user@domain.com mailbox.
  • Get-InboxRule -Mailbox “user@domain.com” | Where-Object {$_. Enabled -eq $true}
  • Lists all active (enabled) inbox rules in the user@domain.com mailbox.
  • Get-InboxRule -Mailbox “user@domain.com” | Format List
  • Displays detailed information about all inbox rules in the user@domain.com mailbox in list format.
  • Get-InboxRule -Mailbox “user@domain.com” | Where-Object {$_. FromAddressContainsWords -contains “newsletter”}
  • Looks for inbox rules in the user@domain.com mailbox that respond to emails from senders with the word “newsletter.”
  • Get-InboxRule -Mailbox “user@domain.com” | Where-Object {$_. DeleteMessage -eq $true}
  • Finds all inbox rules in the user@domain.com mailbox that automatically delete incoming messages.

Set-InboxRule

Change rule conditions, exceptions, and actions for inbox rules in mailboxes.

  • Set-InboxRule ProjectContoso -MarkImportance “High”
    • Modifies the action of the existing ProjectContoso inbox rule to mark the message with the importance of High.
  • Set-InboxRule -Identity “Rule1” -DeleteMessage $true
    • Enables the action to automatically delete messages that meet the conditions of Rule1 rule.
  • Set-InboxRule -Identity “Vacation Notification” -AutoReplyMessage “I’m on vacation until 8/15.”
    • Changes the automatic reply message of the Holiday Notification rule.
  • Set-InboxRule -Identity “Newsletter” -MoveToFolder “News”
    • Moves messages that match the “Newsletter” rule to the “News” folder.
  • Set-InboxRule -Identity “Important Customers” -ForwardTo “vertrieb@firma.de”
    • Forwards messages that match the Key Customers rule to the vertrieb@firma.de email address.
  • Set-InboxRule -Identity “Spam Filter” -ExceptIfSubjectContainsWords “Offer” -DeleteMessage $true
    • Changes the Spam Filter rule to delete messages unless the subject contains the word “Offer.”
  • Set-InboxRule -Identity “Project Updates” -MarkAsRead $true
    • Automatically marks all messages that match the Project Updates rule as read.

Remove-InboxRule

Remove inbox rules from mailboxes.

  • Remove-InboxRule -Identity “Old Rule”
    • Removes the inbox rule named Old Rule.
  • Remove-InboxRule -Identity “Vacation Notification” -Confirm:$false
    • Removes the Vacation Notification rule without a confirmation prompt.
  • Get-InboxRule -Mailbox “max.mustermann@firma.de” | Remove-InboxRule
    • Removes all inbox rules in John Doe’s mailbox.
  • Remove-InboxRule -Identity “Newsletter” -Mailbox “info@firma.de”
    • Removes the “Newsletter” rule from the “info@firma.de” mailbox.
  • Remove-InboxRule -Identity “Automatic Forwarding” -WhatIf
    • Displays what would happen if the Auto-Forward rule was removed without actually removing it.
  • Remove-InboxRule -Identity “Spam Filter” -Force
    • Removes the Spam Filter rule without confirmation and without regard for errors.
  • Get-InboxRule -Mailbox “vertrieb@firma.de” | Where {$_. ForwardTo -eq “extern@partner.de”} | Remove-InboxRule
    • Removes all rules in the vertrieb@firma.de mailbox that forward emails to extern@partner.de.

Set-CASMailbox

Configures the client access settings for a mailbox.

  • Set-CASMailbox -Identity “user@domain.com” -SmtpClientAuthenticationDisabled $true
    • This example disables SMTP authentication for user@domain.com’s mailbox.
  • Set-CASMailbox -Identity “user@domain.com” -SmtpClientAuthenticationDisabled $false
    • Here, SMTP authentication is enabled for the mailbox of “user@domain.com”.
  • Get-Mailbox -OrganizationalUnit “OU=Sales,DC=domain,DC=com” | Set-CASMailbox -SmtpClientAuthenticationDisabled $true
    • This command disables SMTP authentication for all mailboxes in the Sales OU.
  • Set-CASMailbox -Identity “user@domain.com” -SmtpClientAuthenticationDisabled $null
    • This example resets the SMTP authentication setting for the mailbox from user@domain.com to the default value.
  • Get-CASMailbox | Where {$. SmtpClientAuthenticationDisabled -eq $false} | Set-CASMailbox -SmtpClientAuthenticationDisabled $true_
    • This command searches for and disables all mailboxes that have SMTP authentication enabled.

Get-MailboxAuditLogging

Get mailbox auditing settings.

  • Get-MailboxAuditLogging -Identity “user@domain.com”
    • Retrieves the audit log settings for the mailbox from user@domain.com.
  • Get-MailboxAuditLogging | Where {$_. AuditEnabled -eq $true}
    • Lists all mailboxes that have audit auditing enabled.
  • Get-MailboxAuditLogging | Format List
    • Displays detailed information about the audit settings of all mailboxes.
  • Get-MailboxAuditLogging -Identity “user@domain.com” | Select-Object AuditAdmin, AuditDelegate
    • Displays specific audit settings for admin and delegate actions in the user@domain.com mailbox.
  • Get-MailboxAuditLogging | Export-Csv -Path “C:\AuditLogs.csv”
    • Exports the audit log settings of all mailboxes to a CSV file.

Set-MailboxAuditLogging

Configure mailbox auditing settings.

  • Set-MailboxAuditLogging -Identity “user@domain.com” -AuditEnabled $true
    • Enables audit auditing for user@domain.com’s mailbox.
  • Set-MailboxAuditLogging -Identity “user@domain.com” -AuditAdmin $true -AuditDelegate $true
    • Enables audit auditing for admin and delegate actions in user@domain.com’s mailbox.
  • Set-MailboxAuditLogging -Identity “user@domain.com” -AuditOwnerActions MoveToDeletedItems, SoftDelete
    • Configures specific auditing actions for the mailbox owner.
  • Get-Mailbox | Set-MailboxAuditLogging -AuditEnabled $true
    • Enables audit auditing for all mailboxes in the organization.
  • Set-MailboxAuditLogging -Identity “user@domain.com” -AuditLogAgeLimit 90
    • Sets the age up to which audit logs are retained for the mailbox to 90 days.

Get-TransportConfig

Displays configuration information for global transport settings in the organization.

  • Get-TransportConfig
    • Lists the organization-wide transport settings on a mailbox server or the local transport settings on an Edge Transport server.
  • Get-TransportConfig | Format-List DSN
    • Lists all Delivery Status Notification (DSN) related configuration settings for your organization when running on a mailbox server. An Edge Transport server displays the DSN-related settings that are configured on that Edge Transport server.

Set-TransportConfig

Configures the transport settings in Exchange Online.

  • Set-TransportConfig -MaxSendSize 35MB -MaxReceiveSize 35MB
    • Sets the maximum send size and receive size for messages to 35 MB.
  • Set-TransportConfig -TlsCertificateName “CN=MyCertificate”
    • Configures the name of the TLS certificate for the transport service.
  • Set-TransportConfig -InboundConnector “MyConnector” -TlsSenderCertificateName “CN=SenderCertificate”
    • Configures the name of the TLS sender certificate for a specific inbound connector.
  • Set-TransportConfig -JournalingReportNdrTo “journalreports@domain.com”
    • Sets the email address to which non-delivery reports for journaling are sent.
  • Set-TransportConfig -ShadowRedundancyEnabled $true
    • Enables shadow redundancy to increase the reliability of message delivery.

Add-MailboxFolderPermission

Adds permissions to a mailbox folder.

  • Add-MailboxFolderPermission -Identity “user@domain.com:\Calendar” -User “assistant@domain.com” -AccessRights Editor
    • Adds the user “assistant@domain.com” with edit rights to the calendar of the user “user@domain.com”.
  • Add-MailboxFolderPermission -Identity “user@domain.com:\Inbox” -User “manager@domain.com” -AccessRights Reviewer
    • Grants the manager read access to the user’s user@domain.com inbox.
  • Add-MailboxFolderPermission -Identity “team@domain.com:\SharedFolder” -User “team.member@domain.com” -AccessRights Owner
    • Make “team.member@domain.com” the owner of a shared folder in the mailbox “team@domain.com”.
  • Add-MailboxFolderPermission -Identity “executive@domain.com:\Confidential” -User “assistant@domain.com” -AccessRights None
    • Removes all wizard permissions from the manager’s confidential folder.
  • Add-MailboxFolderPermission -Identity “hr@domain.com:\HR Documents” -User “hr.assistant@domain.com” -AccessRights Contributor
    • Adds the HR assistant with contributor rights to the HR documents folder of the HR mailbox.

Get-MailboxFolderPermission

Gets permissions for a mailbox folder.

  • Get-MailboxFolderPermission -Identity “user@domain.com:\Calendar”
    • Displays the permissions for the user’s calendar user@domain.com.
  • Get-MailboxFolderPermission -Identity “team@domain.com:\SharedFolder”
    • Lists the permissions for a shared folder in the team mailbox.
  • Get-MailboxFolderPermission -Identity “executive@domain.com:\Inbox”
    • Shows who has access to the CEO’s inbox.
  • Get-MailboxFolderPermission -Identity “hr@domain.com:\HR Documents”
    • Lists the permissions for the HR Documents folder.
  • Get-MailboxFolderPermission -Identity “user@domain.com:\Inbox” -User “assistant@domain.com”
    • Verifies the specific permissions of the user’s Inbox wizard.

Remove-MailboxFolderPermission

Removes permissions from a mailbox folder.

  • Remove-MailboxFolderPermission -Identity “user@domain.com:\Calendar” -User “ex.assistant@domain.com”
    • Removes the permissions of the former wizard from the user’s calendar.
  • Remove-MailboxFolderPermission -Identity “team@domain.com:\SharedFolder” -User “ex.member@domain.com”
    • Removes a former team member from the permissions of a shared folder.
  • Remove-MailboxFolderPermission -Identity “executive@domain.com:\Confidential” -User “ex.assistant@domain.com”
    • Removes the former assistant’s permissions from the manager’s confidential folder.
  • Remove-MailboxFolderPermission -Identity “hr@domain.com:\HR Documents” -User “ex.hr.assistant@domain.com”
    • Removes the permissions of the former HR assistant from the HR documents folder.
  • Remove-MailboxFolderPermission -Identity “user@domain.com:\Inbox” -User “ex.colleague@domain.com”
    • Removes the permissions of a former colleague from the user’s inbox.

New-ManagementRole

Creates a new management role in Exchange Online.

  • New-ManagementRole -Name “CustomRole” -Parent “Mail Recipients”
  • Creates a new CustomRole management role based on the parent Mail Recipients role.
  • New-ManagementRole -Name “HR Role” -Parent “User Options”
  • Creates a specific role for the HR team, based on the User Options role.
  • New-ManagementRole -Name “IT Admin Role” -Parent “Mailbox Import Export”
  • Creates a role for IT administrators with permissions to import and export mailboxes.
  • New-ManagementRole -Name “Executive Assistant Role” -Parent “Mail Recipients”
  • Creates a role for executive assistants with advanced permissions to manage mail recipients.
  • New-ManagementRole -Name “Team Manager Role” -Parent “Distribution Groups”
  • Creates a role for team managers to manage distribution groups.

Remove-ManagementRole

Removes custom management roles that are no longer needed.

  • Remove-ManagementRole ExampleRole1
  • Removes the single ExampleRole1 role.
  • Remove-ManagementRole ExampleRole2 -Recurse -WhatIf
  • Runs the command with the WhatIf option to simulate what would happen if the ExampleRole2 role and all of its child roles were removed.
  • Get-ManagementRole Example | Remove-ManagementRole -WhatIf
  • Fetches a list of roles that contain “Example” in the name and simulates the removal of these roles.
  • Remove-ManagementRole “In-house scripts” -UnScopedTopLevel
  • Removes the unscoped top-level management role “In-house scripts”.

New-ManagementRoleAssignment

Creates new assignments of management roles.

  • New-ManagementRoleAssignment -Role “Mail Recipients” -User “Jane Doe”
  • Assigns the Mail Recipients role to the user Jane Doe.
  • New-ManagementRoleAssignment -Role “Mailbox Import Export” -Group “IT Admins”
  • Assigns the Mailbox Import Export role to the IT Admins group.
  • New-ManagementRoleAssignment -Role “User Options” -User “Emma Smith” -CustomRecipientWriteScope “Contoso Users”
  • Assigns Emma Smith the User Options role with a custom recipient write area.
  • New-ManagementRoleAssignment -Role “Mail Recipients” -RoleGroup “Help Desk”
  • Assigns the Mail Recipients role to the Help Desk role group.
  • New-ManagementRoleAssignment -Role “Mail Recipients” -User “David Johnson” -RecipientRelativeWriteScope “Self”
  • Assigns David Johnson the Mail Recipients role with the Self writing scope.

Get-ManagementRoleAssignment

Gets assignments from management roles.

  • Get-ManagementRoleAssignment
  • Displays all management role assignments in the organization.
  • Get-ManagementRoleAssignment -Role “Mail Recipients”
  • Lists all assignments of the Mail Recipients role.
  • Get-ManagementRoleAssignment -User “John Doe”
  • Displays all role assignments for the John Doe user.
  • Get-ManagementRoleAssignment -RoleGroup “Organization Management”
  • Lists all role assignments for the Organization Management role group.
  • Get-ManagementRoleAssignment -Role “Mail Recipients” -Delegating $true
  • Displays delegated role assignments for the Mail Recipients role.

Set-ManagementRoleAssignment

modify existing management role assignments.

  • Set-ManagementRoleAssignment “Mail Recipients_Denver Help Desk” -Enabled $false
  • Disables the Mail Recipients_Denver Help Desk role assignment so that users can no longer run the cmdlets granted by the role.
  • Set-ManagementRoleAssignment “MyGAL_KimA” -RecipientRelativeWriteScope MyGAL
  • Changes the recipient scope of the MyGAL_KimA role assignment to MyGAL.
  • Set-ManagementRoleAssignment “Mail Recipients_Marketing Admins” -RecipientOrganizationalUnitScope “contoso.com/North America/Marketing/Users”
  • Restricts the Mail Recipients_Marketing Admins role assignment to the contoso.com/North America/Marketing/Users OU.
  • Set-ManagementRoleAssignment “Distribution Groups_Cairns Admins” -CustomRecipientWriteScope “Cairns Recipients”
  • Restricts the Distribution Groups_Cairns Admins role assignment to the Cairns Recipients custom recipient scope.
  • Set-ManagementRoleAssignment -Identity “Mail Recipients_Marketing Admins” -RecipientOrganizationalUnitScope “contoso.com/North America/Marketing/Users” -Enabled $true
  • Enables the Mail Recipients_Marketing Admins role assignment for the specified OU and allows users of the Marketing Admins group to create, modify, and remove objects in that OU.

Remove-ManagementRoleAssignment

Removes assignments of management roles.

  • Remove-ManagementRoleAssignment “Mail Recipients-John Doe”
  • Removes the Mail Recipients role assignment for the John Doe user.
  • Remove-ManagementRoleAssignment “Mailbox Import Export-IT Admins”
  • Removes the Mailbox Import Export role assignment for the IT Admins group.
  • Remove-ManagementRoleAssignment “User Options-Emma Smith”
  • Removes the User Options role assignment for the Emma Smith user.
  • Remove-ManagementRoleAssignment “Mail Recipients Help Desk”
  • Removes the Mail Recipients role assignment for the Help Desk role group.
  • Remove-ManagementRoleAssignment “Mail Recipients-David Johnson”
  • Removes the Mail Recipients role assignment for the user David Johnson.

New-ActiveSyncMailboxPolicy

Creates a new ActiveSync mailbox policy.

  • New-ActiveSyncMailboxPolicy -Name “Standard Policy”
  • Creates a new ActiveSync mailbox policy named Standard Policy.
  • New-ActiveSyncMailboxPolicy -Name “Executive Policy” -AllowBluetooth $true -AllowCamera $false
  • Creates a policy for executives that allows Bluetooth but prohibits camera use.
  • New-ActiveSyncMailboxPolicy -Name “IT Security Policy” -PasswordEnabled $true -PasswordRecoveryEnabled $true
  • Creates a security policy for IT staff that requires a password and enables password recovery.
  • New-ActiveSyncMailboxPolicy -Name “Sales Team Policy” -AllowBrowser $false -AllowWiFi $true
  • Creates a policy for the sales team that prohibits browser access but allows WiFi.
  • New-ActiveSyncMailboxPolicy -Name “HR Policy” -MaxEmailAgeFilter OneMonth -MaxCalendarAgeFilter TwoWeeks
  • Creates a policy for HR that limits email to one month and calendar entries to two weeks.

Remove-ActiveSyncMailboxPolicy

Removes an ActiveSync mailbox policy.

  • Remove-ActiveSyncMailboxPolicy -Identity “Standard Policy”
  • Removes the ActiveSync mailbox policy “Standard Policy”.
  • Remove-ActiveSyncMailboxPolicy -Identity “Executive Policy”
  • Removes the ActiveSync Executive Policy mailbox policy.
  • Remove-ActiveSyncMailboxPolicy -Identity “IT Security Policy”
  • Removes the ActiveSync IT Security Policy mailbox policy.
  • Remove-ActiveSyncMailboxPolicy -Identity “Sales Team Policy”
  • Removes the Sales Team Policy ActiveSync mailbox policy.
  • Remove-ActiveSyncMailboxPolicy -Identity “HR Policy”
  • Removes the ActiveSync mailbox policy “HR Policy”.

New-RemoteDomain

Creates a managed connection for a remote domain to control mail flow and message formatting.

  • New-RemoteDomain -DomainName .contoso.com -Name Contoso
  • Creates a remote domain for contoso.com and all subdomains.
  • New-RemoteDomain -DomainName partner.com -Name PartnerDomain
  • Specifies a specific remote domain for partner.com.
  • New-RemoteDomain -DomainName .example.org -Name ExampleOrg
  • Establishes a remote domain for example.org and all of its subdomains.
  • New-RemoteDomain -DomainName suppliers.net -Name Suppliers -Confirm
  • Creates a remote domain for suppliers.net with confirmation prompt.
  • New-RemoteDomain -DomainName clients.co.uk -Name ClientsUK -WhatIf
  • Simulates the creation of a remote domain for clients.co.uk.

Get-RemoteDomain

Retrieves information about configured remote domains.

  • Get-RemoteDomain
  • Lists all configured remote domains.
  • Get-RemoteDomain -Identity Contoso
  • Displays the configuration of the Contoso remote domain.
  • Get-RemoteDomain | Format-List Name, DomainName
  • Lists names and domain names of all remote domains.
  • Get-RemoteDomain -Identity PartnerDomain | Format List
  • Displays all properties of the remote domain PartnerDomain.
  • Get-RemoteDomain | Where {$_. DomainName -like “*.org”}
  • Lists all remote domains whose domain name ends in .org.

Set-RemoteDomain

Changes settings for an existing remote domain.

  • Set-RemoteDomain -Identity Contoso -AutoReplyEnabled $false
  • Disables automatic replies for the remote Contoso domain.
  • Set-RemoteDomain -Identity PartnerDomain -TNEFEnabled $true
  • Enables TNEF for the remote domain PartnerDomain.
  • Set-RemoteDomain -Identity ExampleOrg -CharacterSet UTF8
  • Sets the character set to UTF8 for the remote domain ExampleOrg.
  • Set-RemoteDomain -Identity Suppliers -DeliveryReportEnabled $false
  • Disables delivery reports for the remote Suppliers domain.
  • Set-RemoteDomain -Identity ClientsUK -AllowedOOFType External
  • Allows only external out-of-office messages for the remote ClientsUK domain.

Remove-RemoteDomain

Removes a configured remote domain.

  • Remove-RemoteDomain -Identity Contoso
  • Removes the remote domain Contoso.
  • Remove-RemoteDomain -Identity PartnerDomain -Confirm
  • Removes the remote domain PartnerDomain after confirmation.
  • Remove-RemoteDomain -Identity ExampleOrg -WhatIf
  • Simulates the removal of the remote domain ExampleOrg.
  • Remove-RemoteDomain -Identity Suppliers
  • Removes the Suppliers remote domain.
  • Remove-RemoteDomain -Identity ClientsUK
  • Removes the remote ClientsUK domain.

New-PublicFolder

Create a new public folder with the specified name.

  • New-PublicFolder -Name “Marketing”
  • This example creates the Marketing public folder in the root folder of the public folder.
  • New-PublicFolder -Name “FY2010” -Path “\Legal\Cases” -Server “MBXSVR01”
  • In Exchange Server 2010, this example creates the FY2010 public folder under the existing \Legal\Cases folders on Server MBXSVR01.
  • New-PublicFolder -Name “FY2014” -Path “\Legal\Cases”
  • This example creates the FY2014 public folder under the existing \Legal\Cases folders.
  • New-PublicFolder -Name “Support” -Mailbox “North_America”
  • This example creates the Support public folder in the North_America public folder hierarchy mailbox.
  • New-PublicFolder -Name “Project2023” -Confirm
  • This example creates the Project2023 public folder and displays a confirmation prompt.

Get-PublicFolder

Retrieve attributes of a public folder or a group of public folders.

  • Get-PublicFolder
  • This example returns the public folder root object (IPM_SUBTREE) without any parameters.
  • Get-PublicFolder -Identity \NON_IPM_SUBTREE -Recurse | Format-List Name
  • This example returns the names of all system folders, starting with the system folder root (\NON_IPM_SUBTREE).
  • Get-PublicFolder -Identity “\Legal\Documents\Pending Litigation”
  • This example returns the Pending Litigation public folder from \Legal\Documents\.
  • Get-PublicFolder -Identity “\Legal\Documents\Pending Litigation” -Recurse
  • This example returns the Pending Litigation public folder from \Legal\Documents\ and any public folders below it.
  • Get-PublicFolder -Mailbox “Legal Department” -ResidentFolders
  • This example returns the public folders that reside in the Legal Department public folder content mailbox.

Set-PublicFolder

Configures the attributes for public folders in Exchange environments.

  • Set-PublicFolder “\Customer Service Requests” -UseDatabaseReplicationSchedule $false
  • Disables the default replication schedule of the database for the Customer Service Requests public folder.
  • Set-PublicFolder “\Customer Service Requests” -OverrideContentMailbox North_America
  • Changes the content location of the mailbox for the public folder hierarchy to North_America.
  • Set-PublicFolder \MyPublicFolder -ReplicationSchedule “Saturday.12:00 AM-Monday.12:00 AM”
  • Specifies that the MyPublicFolder public folder replicates only on weekends.
  • Set-PublicFolder -Identity “StellarPF03” -IssueWarningQuota 1GB -ProhibitPostQuota 2GB
  • Sets warning and prohibition post quotas for the StellarPF03 public folder.
  • Set-PublicFolder -Identity “PFFolder03” -ProhibitSendReceiveQuota 5GB -IssueWarningQuota 4GB -UseDatabaseQuotaDefaults $false
  • Adjusts the send/receive and alert quotas for the PFFolder03 public folder, and disables the use of database quota standards.
  • Set-PublicFolder -Identity “\Marketing” -HiddenFromAddressListsEnabled $true
  • Hides the public folder “Marketing” in the address lists.
  • Set-PublicFolder -Identity “\HR Documents” -PerUserReadStateEnabled $false
  • Disables user-specific read status management for the HR Documents public folder.

Remove-PublicFolder

Removes an existing public folder from all servers in your organization.

  • Remove-PublicFolder -Identity “\Test\Directory\My Public Folder”
  • Deletes the My Public Folder from the \Test\Directory directory tree.
  • remove-publicfolder -identity “\test\directory folder” -recurse
  • Deletes the Directory Folder public folder and all of its child public folders using the Recurse option.

New-InboxRule

Creates a new Inbox rule for a mailbox.

  • New-InboxRule -Mailbox “user@domain.com” -Name “MoveToFolder” -MoveToFolder “Inbox\Subfolder” -From “sender@example.com”
  • Creates a rule in the mailbox of “user@domain.com” to move messages from “sender@example.com” to a subfolder.
  • New-InboxRule -Mailbox “user@domain.com” -Name “ForwardToManager” -ForwardTo “manager@domain.com” -SubjectContainsWords “Urgent”
  • Forwards emails with the subject “Urgent” in the inbox from “user@domain.com” to “manager@domain.com”.
  • New-InboxRule -Mailbox “user@domain.com” -Name “DeleteSpam” -DeleteMessage -FromAddressContainsWords “spam.com”
  • Automatically deletes emails in the mailbox of “user@domain.com” that come from addresses with “spam.com”.
  • New-InboxRule -Mailbox “user@domain.com” -Name “MarkAsRead” -MarkAsRead -SubjectContainsWords “Newsletter”
  • Automatically marks emails with the subject “Newsletter” as read in the inbox of “user@domain.com”.

Get-InboxRule

Gets inbox rules for a mailbox.

  • Get-InboxRule -Mailbox “user@domain.com”
  • Lists all the inbox rules for the user@domain.com mailbox.
  • Get-InboxRule -Mailbox “user@domain.com” | Format List
  • Displays detailed information about all inbox rules for the user@domain.com mailbox.
  • Get-InboxRule -Mailbox “user@domain.com” | Where {$_. Enabled -eq $true}
  • Lists all active (enabled) inbox rules for the user@domain.com mailbox.
  • Get-InboxRule -Mailbox “user@domain.com” | Where {$_. Description -like “Spam”}
  • Looks for inbox rules in the inbox of “user@domain.com” that contain the word “spam” in their description.

New-GlobalAddressList

Creates a new global address list in Exchange Online.

  • New-GlobalAddressList -Name “All Employees” -IncludedRecipients MailboxUsers
  • Creates a global address list for all mailbox users.
  • New-GlobalAddressList -Name “Executives” -RecipientFilter {Title -like “CEO” -or Title -like “CTO”}
  • Creates a global address list specifically for executives.
  • New-GlobalAddressList -Name “Project Team A” -RecipientContainer “contoso.com/Teams/ProjektA”
  • Creates a global address list for a specific project team.
  • New-GlobalAddressList -Name “External Partners” -RecipientFilter {CustomAttribute1 -eq “Partners”}
  • Creates a global address list for external partners based on a user-defined attribute.
  • New-GlobalAddressList -Name “Department Marketing” -RecipientFilter {Department -eq “Marketing”}
  • Creates a global address list for the marketing department.

Get-GlobalAddressList

Gets the Global Address List (GAL) for an organization.

  • Get-GlobalAddressList
  • Displays the default GAL for the organization.
  • Get-GlobalAddressList -Identity “Custom GAL”
  • Gets a specific GAL named “Custom GAL”.
  • Get-GlobalAddressList | Format-List Name, IncludedRecipients
  • Lists the names and recipient types of all GALs.
  • Get-GlobalAddressList | Where {$_. Name -like “Sales”}
  • Look for GALs whose name contains the word “Sales”.
  • Get-GlobalAddressList -Identity “Default Global Address List” | Format List
  • Displays detailed information about the standard GAL.

Get-MobileDevice

Retrieves information about mobile devices connected to Exchange Online.

  • Get-MobileDevice mailbox “maria@contoso.com”
  • Retrieves information about all mobile devices connected to Maria’s mailbox.
  • Get-MobileDevice | Where {$_. DeviceModel -like “iPhone”}
  • Lists all iPhones that are connected to Exchange Online.
  • Get-MobileDevice | Where {$_. LastSuccessSync -lt (Get-Date). AddDays(-30)}
  • Finds devices that haven’t synced in more than 30 days.
  • Get-MobileDevice -Mailbox “j.doe@contoso.com” | Format List
  • Displays detailed information about John Doe’s mobile devices.
  • Get-MobileDevice | Where {$_. DeviceOS -like “Android”}
  • Lists all Android devices connected to Exchange Online.

Clear-MobileDevice

Deletes all data from a mobile device connected to Exchange Online.

  • Clear-MobileDevice -Identity “Maria’s iPhone”
  • Performs a remote wipe on Maria’s iPhone.
  • Clear-MobileDevice -Identity “JohnsAndroid” -NotificationEmailAddresses “admin@contoso.com”
  • Performs a remote wipe on John’s Android device and notifies the administrator.
  • Get-MobileDevice Mailbox “maria@contoso.com” | Clear-MobileDevice
  • Performs remote wipe on all devices connected to Maria’s mailbox.
  • Clear-MobileDevice -Identity “iPad Sales” -Cancel
  • Cancels an already initiated remote wipe on an iPad.
  • Get-MobileDevice | Where {$_. DeviceModel -like “iPad”} | Clear-MobileDevice
  • Performs remote wipe on all iPads connected to Exchange Online.

Get-CalendarProcessing

Gets calendar processing settings for room mailboxes in Exchange Online.

  • Get-CalendarProcessing -Identity “Conference Room1”
  • Gets the calendar processing settings for conference room 1.
  • Get-CalendarProcessing -Identity “Meeting Room” | Format List
  • Displays detailed calendar processing settings for a meeting room.
  • Get-CalendarProcessing -Identity “Room A” | Select AutomateProcessing, AllowConflicts
  • Displays specific settings for automatic processing and conflict allow for room A.
  • Get-CalendarProcessing -Identity “Board Room” | Where {$_. AllowRecurringMeetings -eq $false}
  • Checks if recurring meetings are allowed in the boardroom.
  • Get-Mailbox -RecipientTypeDetails RoomMailbox | Get-CalendarProcessing
  • Gets calendar processing settings for all room mailboxes.

Set-CalendarProcessing

Change calendar processing options for resource mailboxes.

  • Set-CalendarProcessing -Identity “Conf 212” -AutomateProcessing AutoAccept -DeleteComments $true -AddOrganizerToSubject $true -AllowConflicts $false
  • Automates the processing of calendar requests for the Conf 212 resource mailbox.
  • Set-CalendarProcessing -Identity “Car 53” -AutomateProcessing None
  • Disables automatic processing for the Car 53 resource mailbox.
  • Set-CalendarProcessing -Identity “5th Floor Conference Room” -AutomateProcessing AutoAccept -AllBookInPolicy $true
  • Allows Calendar Auto to approve policy-compliant requests from all users.
  • Set-CalendarProcessing -Identity “5th Floor Conference Room” -AutomateProcessing AutoAccept -AllRequestInPolicy $true -AllBookInPolicy $false -ResourceDelegates “chris@contoso.com”,”michelle@contoso.com”
  • Allows all users to submit intra-policy requests, but they are subject to delegate approval.
  • Set-CalendarProcessing -Identity “Room 221” -AutomateProcessing AutoAccept -RequestOutOfPolicy DavidPelton@contoso.com -ResourceDelegates “chris@contoso.com”,”michelle@contoso.com”
  • Allows the Calendar Auto to accept requests from David Pelton that do not comply with the guidelines, but is subject to delegate approval.
  • Set-CalendarProcessing -Identity “Car 53” -AutomateProcessing AutoAccept -BookInPolicy “ayla@contoso.com”,”tony@contoso.com” -AllBookInPolicy $false
  • Allows a list of users to send policy-compliant meeting requests to the Car 53 device mailbox.
  • Set-CalendarProcessing -Identity “Room 221” -ProcessExternalMeetingMessages $false
  • Rejects meeting requests from users who are not members of the Exchange organization.

Get-MailboxPermission

Get-MailboxPermission is used to retrieve permissions for mailboxes in Exchange environments.

  • Get-MailboxPermission -Identity “John Doe”
  • Gets all permissions on John Doe’s mailbox.
  • Get-MailboxPermission -Identity “info@contoso.com” | Where-Object { $_. User -like “admin” }
  • Displays all permissions on the mailbox “info@contoso.com” that affect users with “admin” in the name.
  • Get-MailboxPermission -Identity “Sales Department” | Format-List User, AccessRights
  • Displays a detailed list of users and their access rights to the Sales Department mailbox.
  • Get-MailboxPermission -Identity “HR Mailbox” | Where-Object { $_. IsInherited -eq $false }
  • Displays all non-inherited permissions for the HR Mailbox mailbox.
  • Get-MailboxPermission -Identity “Marketing” | Select-Object User, AccessRights, Deny | Where-Object { $_. Deny -eq $true }
  • Lists all denied permissions for the Marketing mailbox.

Add-MailboxPermission

Add-MailboxPermission is used to add permissions to mailboxes.

  • Add-MailboxPermission -Identity “John Doe” -User “Jane Smith” -AccessRights FullAccess -InheritanceType All
  • Grants Jane Smith full access to John Doe’s mailbox.
  • Add-MailboxPermission -Identity “info@contoso.com” -User “HR Department” -AccessRights ReadPermission
  • Adds read permissions to the info@contoso.com mailbox to HR.
  • Add-MailboxPermission -Identity “Sales” -User “Tony Stark” -AccessRights SendAs
  • Allows Tony Stark to send emails as “Sales”.
  • Add-MailboxPermission -Identity “Marketing” -User “External Consultant” -AccessRights ExternalAccount -InheritanceType All
  • Adds access rights to the Marketing mailbox to an external consultant.
  • Add-MailboxPermission -Identity “CEO Mailbox” -User “Assistant” -AccessRights FullAccess -AutoMapping $false
  • Grants the wizard full access to the CEO’s mailbox without automatically adding it in Outlook.

New-DlpPolicy

Create data loss prevention policies in Exchange environments.

  • New-DlpPolicy -Name “Contoso PII” -Template “U.S. Personally Identifiable Information (PII) Data”
  • Creates a new DLP policy called Contoso PII based on the U.S. Personally Identifiable Information (PII) Data template.
  • New-DlpPolicy -Name “Financial Data Protection” -Template “Financial Data”
  • Creates a DLP policy to protect financial data with a pre-built template.
  • New-DlpPolicy -Name “Employee Privacy” -Description “Protection of Employees’ Personal Data”
  • Creates a DLP policy called Employee Privacy with a description to protect employee personal data.
  • New-DlpPolicy -Name “Healthcare Compliance” -Template “Health Insurance Portability and Accountability Act (HIPAA)”
  • Creates a healthcare DLP policy based on the HIPAA standard.
  • New-DlpPolicy -Name “Credit Card Security” -Template “Credit Card Information”
  • Creates a DLP policy to protect credit card information.

Get-DlpPolicy

Get Data Loss Prevention (DLP) policies in Exchange environments.

  • Get-DlpPolicy
  • Lists all DLP policies in the organization.
  • Get-DlpPolicy -Identity “Financial Data Protection”
  • Gets details about the Financial Data Protection DLP policy.
  • Get-DlpPolicy | Where-Object { $_. State -eq “Enabled” }
  • Displays all active DLP policies.
  • Get-DlpPolicy | Format-Table Name, Mode
  • Outputs a table with the names and modes of all DLP policies.
  • Get-DlpPolicy | Select-Object Name, Description | Where-Object { $_. Description -like “sensitive” }
  • Lists all DLP policies that have the word “sensitive” in their description.

Enable-MailboxArchiving

Enable archive mailboxes for users in Exchange environments.

  • Enable-Mailbox -Identity "John Doe" -Archive
  • Enables the archive mailbox for John Doe’s user mailbox.
  • Enable-Mailbox -Identity "info@contoso.com" -Archive
  • Enables the archive mailbox for the info@contoso.com mailbox.
  • Get-Mailbox -Filter {ArchiveStatus -Eq "None"} | Enable-Mailbox -Archive
  • Enables archive mailboxes for all user mailboxes that don’t currently have an archive.
  • Enable-Mailbox -Identity "Sales Department" -Archive
  • Activates the archive mailbox for the sales department mailbox.
  • Enable-Mailbox -Identity "HR Mailbox" -Archive
  • Enables the archive mailbox for the HR mailbox.

“ExchangeOnlineManagement” commands

BefehlBeschreibung
Install-Module -Name MicrosoftTeamsInstalliert das Microsoft Teams Modul
Connect-MicrosoftTeamsStellt eine Verbindung zu Microsoft Teams her
Disconnect-MicrosoftTeamsTrennt die Verbindung zu Microsoft Teams
New-TeamErstellt ein neues Team in Microsoft Teams
Get-TeamRuft Informationen über Teams ab
Set-TeamÄndert Eigenschaften eines Teams
Remove-TeamEntfernt ein spezifiziertes Team aus Microsoft Teams
New-TeamChannelErstellt einen neuen Kanal in einem Team
Get-TeamChannelRuft Informationen über Kanäle in einem Team ab
Set-TeamChannelÄndert Eigenschaften eines Kanals in einem Team
Remove-TeamChannelEntfernt einen Kanal aus einem Team
New-TeamsAppErstellt eine neue App in Teams
Get-TeamsAppRuft Informationen über Apps in Teams ab
Set-TeamsApppasst die Einstellungen einer App in Teams an
Remove-TeamsAppEntfernt eine App aus Teams
Get-TeamUserRuft Informationen über Teammitglieder ab
Add-TeamUserFügt einem Team einen Benutzer hinzu
Set-TeamUserÄndert die Rolle eines Benutzers in einem Team
Remove-TeamUserEntfernt einen Benutzer aus einem Team
Get-CsTeamsPolicyRuft Teams-Richtlinieninformationen ab
Set-CsTeamsPolicyÄndert Teams-Richtlinien
Get-CsOnlineTelephoneNumberRuft Informationen zu Online-Telefonnummern ab
Set-CsUserCallingSettingsÄndert Anrufeinstellungen für einen Benutzer
Get-CsTeamsSecurityPolicyRuft Sicherheitsrichtlinien für Teams ab
Set-CsTeamsSecurityPolicyÄndert Sicherheitsrichtlinien für Teams
Get-CsTeamsMeetingPolicyRuft Besprechungsrichtlinien für Teams ab
Set-CsTeamsMeetingPolicyÄndert Besprechungsrichtlinien für Teams
Get-TeamMessagingSettingsRuft Messaging-Einstellungen für ein Team ab
Set-TeamMessagingSettingsÄndert Messaging-Einstellungen für ein Team
Get-TeamGuestSettingsRuft Einstellungen für Gastzugriff in einem Team ab
Set-TeamGuestSettingsÄndert Einstellungen für Gastzugriff in einem Team
Get-TeamMemberSettingsRuft Mitgliedereinstellungen für ein Team ab
Set-TeamMemberSettingsÄndert Mitgliedereinstellungen für ein Team
Get-TeamFunSettingsRuft “Spaß”-Einstellungen für ein Team ab
Set-TeamFunSettingsÄndert “Spaß”-Einstellungen für ein Team
Get-CsTeamsEducationConfigurationRuft Bildungskonfigurationen für Teams ab
Set-CsTeamsEducationConfigurationÄndert Bildungskonfigurationen für Teams
Get-CsTeamsShiftsPolicyRuft Schichtplanungsrichtlinien für Teams ab
Set-CsTeamsShiftsPolicyÄndert Schichtplanungsrichtlinien für Teams
New-CsTeamTemplateErstellt eine neue Teamvorlage
Get-CsTeamTemplateRuft Informationen zu Teamvorlagen ab
Remove-CsTeamTemplateEntfernt eine Teamvorlage
Get-CsUserCallingSettingsRuft Anrufeinstellungen für einen Benutzer ab
New-CsUserCallingDelegateFügt einen neuen Delegierten für Anrufe hinzu
Remove-CsUserCallingDelegateEntfernt einen Delegierten für Anrufe
Get-LicenseReportForChangeNotificationSubscriptionRuft Lizenzberichte für Benachrichtigungsabonnements ab
Add-TeamsAppInstallationInstalliert eine App in Teams
Remove-TeamsAppInstallationEntfernt eine installierte App aus Teams