To set a forwarding address for a mailbox that will also deliver the message to the Identity’s mailbox:

Set-Mailbox -Identity identityname -DeliverToMailboxAndForward $true -ForwardingSMTPAddress “my@mail.address

Note: If DeliverToMailboxAndForward is $false, then the message will not be deliver to the Identity’s mailbox. Just forwarded.

To remove a forwarding address for a mailbox:

Set-Mailbox -Identity identityname -ForwardingSMTPAddress $null -ForwardingAddress $null

To delete email from a mailbox:
Search-Mailbox -Identity someuser -SearchQuery ‘Received:someuser -SearchQuery ‘Sent:Get-MailboxAutoReplyConfiguration accountname | Format-List

To disable auto reply for an account:

Set-MailboxAutoReplyConfiguration accountname -AutoReplyState:disabled

To add an email address to a mailbox:

Set-Mailbox accountname -EmailAddresses @{add=”email@address.domain“}

To only restore the Inbox for a mailbox:

Restore-Mailbox -Identity restoreto -RecoveryDatabase recoverydbname -RecoveryMailbox restorefrom -Target targetfolder -IncludeFolders \Inbox

To disable a mailbox means to disconnect a mailbox from an account. It doesn’t remove either the account or the mailbox. All Exchange attributes will be removed from the account and the mailbox will be in a disabled state. Note: The mailbox does not immediatley show up in the disabled mailbox list until the Clean-MailboxDatabase process runs again. This periodically happens on the system, but can be forced with the Clean-MailboxDatabase command. To disable a mailbox:

Disable-Mailbox -Identity “Display Name

Update list of disabled mailboxes:

Clean-MailboxDatabase “Mailbox Database Name

To list all disabled mailboxes:

Get-MailboxDatabase | Get-MailboxStatistics | Where { $_.DisconnectReason -eq “Disabled” }

To connect a mailbox to a user account:

Connect-Mailbox -Database DatabaseName -Identity “Mailbox Display Name” -User accountname

Note: For the Identity or User, you can use the Legacy DN. I found this useful, when I had two of the same Display Name mailboxes disabled at the same time. You can determine the Legacy DN using the following:

Get-MailboxDatabase | Get-MailboxStatistics | Where { $_.DisconnectReason -eq “Disabled” | Select DisplayName,LegacyDN}

To check you send filter configuration:

Get-SenderFilterConfig

Note: This will override the current setting and only block the one address.
To block a user:

Set-SenderFilterConfig -BlockedSenders emailaddress

To block more than one:

Set-SenderFilterConfig -BlockedSenders emailaddress1,emailaddress2

To block an entire domain:

Set-SenderFilterConfig -BlockedDomains domainname

The BlockedSenders and BlockedDomains are “Multivalue properties”, so to add or remove entries instead of entering all them every time you just want to add one, you can do the following:

Set-SenderFilterConfig -BlockedSenders @{Add=”emailaddress1“, “emailaddress2“}

Or:

Set-SenderFilterConfig -BlockedDomains @Add={“domainname1“, “domainname2

Same idea to remove from the list:

Set-SenderFilterConfig -BlockedSenders @{Remove=”emailaddress1“, “emailaddress2“}

Or:

Set-SenderFilterConfig -BlockedDomains @Remove={“domainname1“, “domainname2

Managing message size:
Here are the places where sending and receiving message size can be managed:

Get-TransportConfig | FL

Get-ReceiveConnector | FL

Get-SendConnector | FL

Get-Mailbox mailbox | FL

You want too look at the MaxSendSize, MaxReceiveSize settings.

Get-TransportConfig | FT MaxSendSize, MaxReceiveSize

Get-ReceiveConnector | FT MaxMessageSize

Get-SendConnector | FT Name,MaxMessageSize

Get-Mailbox mailbox | FT Name,MaxSendSize, MaxReceiveSize

get-transportconfig | Set-TransportConfig -maxsendsize 15MB -maxreceivesize 15MB; get-receiveconnector | set-receiveconnector -maxmessagesize 10MB; get-sendconnector | set-sendconnector -maxmessagesize 10MB; get-mailbox | Set-Mailbox -Maxsendsize 10MB -maxreceivesize 10MB

To modify the limits:

Set-TransportConfig -MaxSendSize 100MB -MaxReceiveSize 100MB

Set-ReceiveConnector -MaxMessageSize 100MB

Set-SendConnector connectorname -MaxMessageSize 100MB

Get-Mailbox mailbox | Set-Mailbox -MaxSendSize 100MB -MaxReceiveSize=100MB

There is a way to limit the attachment size itself, but creating a transport rule:

New-TransportRule -Name GTHMaxAttachSize -AttachmentSizeOver 100MB -RejectMessageReasonText “This attachment is too big! What were you thinking?”

Distribution Groups:
Create a new group:
New-DistributionGroup -Name “group name” -Alias “groupalias” -OrganizationalUnit ‘oudn

Modify a group setting:
Set-DistributionGroup groupalias -RequireSenderAuthenticationEnabled $false

Update a group member:
Update-DistributionGroupMember groupalias -Members “emailaddress

Add a group member:
Add-DistributionGroupMember groupalias -Member “emailaddress

Remove a group member:
Remove-DistributionGroupMember groupalias -Member “emailaddress

Look at at distribution group:
Get-DistributionGroup groupalias | Format-List

Get the list of members in a distribution group:
Get-DistributionGroupMember groupalias | Format-Table

Check deleted item policy on a mailbox:
Get-Mailbox alias | Select Name,RetainDeletedItemsFor,RetainDeletedItemsUntilBackup

How to find mailboxes that are hidden:
Get-Mailbox | where {$_.HiddenFromAddressListsEnabled -eq $true}

This is a good command to list all options/members of an object. In this case a mailbox. Get-Member can used like this against really any EMS command:

Get-Mailbox | Get-Member

To restore the deleted items, right mouse click on the “Deleted Items” folder and select “Recover Deleted Items.” A window will come up with all the messages still available within the deleted item retention policy.

To see if a mailbox has auditing enabled:

Get-Mailbox mailboxname | Select Name,AudtiEnabled

To enable auditing on a mailbox:

Set-Mailbox -Identity “mailboxidentity” -AuditEnabled $true

To search the audit log for activity in a mailbox:

Search-MailboxAuditlog -Identity “mailboxidentity

Note: Enabling auditing seems to take a while before any results show up.

An easy way to list all the folders and size in a mailbox:
Get-MailboxFolderStatistics -identity “myidentity” | select FolderPath,FolderSize

Here is a very good way to search through the logs using EMS:
Get-MessageTrackingLog -Start “mm/dd/yyyy HH:MM” -End “mm/dd/yyyy HH:MM” -ResultSize Unlimited-Sender sender@email.address | Where {($_.Recipients -like “*somestring*”)} | Select Sender,Recipients,TimeStamp,MessageSubject