Exchange Servers
Exchange 2010 SP3
EWS
Get-WebServicesVirtualDirectory |fl identity,internalurl,externalurl
Set-WebServicesVirtualDirectory -Identity "server1\EWS (Default Web Site)" -ExternalUrl https://webmail.some.org/EWS/Exchange.asmx
Get-ClientAccessServer | fl identity,autodiscoverserviceinternaluri
https://autodiscover.some.org/autodiscover/autodiscover.xml
DAG and cluster
Find where the Primary Active Manager (PAM) is:
Get-DatabaseAvailabilityGroup -status | fl name, primaryactivemanager
Get-DatabaseAvailabilityGroup -Identity SomeDAG -Status | fl name,primaryactivemanager
Add-DatabaseAvailabilityGroupServer -Identity SomeDAG -MailboxServer server1
Get-ClusterLog -TimeSpan 4320 -Destination -UseLocalTime c:\Users\user1\Desktop\cluster-logs
Give permissions to cas to solve error 4002 and 4010
Get-ClientAccessServer | Add-ADPermission -AccessRights ExtendedRight -ExtendedRights "ms-Exch-EPI-Token-Serialization" -User "some.org\Exchange Servers"
Block database copy activation for a server
Get-MailboxServer server1 | fl DatabaseCopyAutoActivationPolicy
Set-MailboxServer -identity server1 -DatabaseCopyAutoActivationPolicy Blocked
Unblock database copy activation for a server
Set-MailboxServer -identity server1 -DatabaseCopyAutoActivationPolicy Unrestricted
Get-MailboxServer server1| Format-List DatabaseCopyAutoActivationPolicy
Get server info
Get-ExchangeServer | Format-List
Get-ExchangeServer | Format-Table Name, *Version*
Creating a new copy of a mailbox database
Add-MailboxDatabaseCopy -Identity "DB 4" -MailboxServer Server3 -ActivationPreference 3 -SeedingPostponed
Test replication
Get-DatabaseAvailabilityGroup | select -ExpandProperty:Servers | Test-ReplicationHealth
Test-ReplicationHealth -Identity server1
Re-enter key for a server
Set-ExchangeServer -ID server1 -ProductKey <product-key>
Connecting to remote server failed with the following error message : The WS-Management service cannot process the request.
The system load quota of 1000 requests per 2 seconds has been exceeded. Send future requests at a slower rate or raise the system quota.
The next request from this user will not be approved for at leas...
--> iireset
Calendar Repair Assistant
Set-MailboxServer -Identity server1 -CalendarRepairSchedule Saturday.19:00-Saturday.22:00
for all servers:
Get-MailboxServer | Set-MailboxServer -CalendarRepairWorkCycle 7.00:00:00 -CalendarRepairWorkCycleCheckpoint 1.00:00:00 -CalendarRepairLogFileAgeLimit 30.00:00:00 -CalendarRepairLogDirectorySizeLimit unlimited -CalendarRepairLogSubjectLoggingEnabled $true -CalendarRepairLogEnabled $true -CalendarRepairIntervalEndWindow 60 -CalendarRepairSchedule Mon.20:00-Mon.23:59,Tue.20:00-Tue.23:59,Wed.20:00-Wed.23:59,Thu.20:00-Thu.23:59,Fri.20:00-Fri.23:59,Sat.20:00-Sat.23:59,Sun.20:00-Sun.23:59
Set-EventLogLevel "server2MSExchangeSA\OAL generator" -Level Expert
Decommission mailbox server
Change the OAB (Offline Address Book) generation role to other available server
- Open EMC, navigate to Organization Configuration - Mailbox
- Select Offline Address Book tab - Right click and select Move - select the mailbox server which will have the OAB - click on Move button.
- The same for other OAB
Remove the server from the DAG membership - Before removing a server from the DAG, all the database copies on that server have to be removed
Remove-MailboxDatabaseCopy -Identity "DB 1\server1"
Once all the database copies on that server are removed, it can be then removed from the DAG
Remove-DatabaseAvailabilityGroupServer -Identity "TheDAG" -MailboxServer "server1"
Move the Arbitration mailboxes to another available Mailbox Server
To see all available Arbitration mailboxes
Get-Mailbox -Arbitration | select Alias
To move all Arbitration mailboxes to a different mailbox server:
get-mailboxdatabase | Get-Mailbox -Arbitration |ft name,database,servername
Name Database ServerName
---- -------- ----------
SystemMailbox{1f05a927-1e76-4ec3-b5f... DB 1 server2
SystemMailbox{e0dc1c29-89c3-4034-b67... DB 1 server2
FederatedEmail.4c1f4d8b-8179-4148-93... DB 1 server2
Get-Mailbox -Arbitration | New-MoveRequest -TargetDatabase "DB 2"
Ensure that none of the databases are using public folder of this server as default and Move Public folder replica to other available mailbox server
Move Public Folder Replica and change the database public folder settings
To move the public folder replica
.\MoveAllReplicas.ps1 -Server server1 -NewServer server7
Change public folder settings for each of the databases using this one.
Get-MailboxDatabase | ft name,PublicFolderDatabase
Then:
Remove-MailboxDatabaseCopy -Identity "DB 3\server1" -whatif
Remove-MailboxDatabaseCopy -Identity "DB 3\server1"
Remove-DatabaseAvailabilityGroupServer -Identity "TheDAG" -MailboxServer "server1" -whatif
Remove-DatabaseAvailabilityGroupServer -Identity "TheDAG" -MailboxServer "server1"