Monitoring and troubleshooting Exchange using powershell
One of the Method of troubleshooting Exchange 2013 is using the various inbuilt cmdlets available.
Through this article, we shall look in detail some of these cmdlets and how they help in troubleshooting.
All the cmdlets in exchange 2013 is execute using the exchange management shell.
Get-Command Test* can be used to list out all the Test commands in the powershell.
This is the first command you want to run before you start troubleshooting any issues with Exchange. ServicesNotRunning parameter should be blank at any given point.
The Test-ReplicationHealth cmdlet will help in identifying the status of mailbox database replication process. All the details of replication can be reviewed using this cmdlet for a particular mailbox server of a Database Avaialability Group.
The main intention behind this cmdlet is to continuously monitor the status of replication process and different parameters linked with the process like ClusterService, ReplayService, ActiveManager availability, etc.
Parameters Tested Using Test-ReplicationHealth cmdlet
The clusterService parameter indicates if the Cluster service is active and available on the specific DAG member (or local server)
This parameter indicates that exchange replication sercice is active and available on the DAG member.
It indicates the status of the role active manager on the DAG is either of the three- Stand Alone, Primary or Secondary.
This parameter is tested to check if the RPC server is active and available in the DAG or local server.
A successful test of the TCPListener will indicate that the TCP log copy listener is working on the DAG member or local server
As the name suggests, this parameter will check for the status of DAG members- whether they are up, running and responding.
This parameter indicates whether the networks managed by clusters on the DAG are reachable.
This parameter indicates the health and online status of the quorum group(which is the default cluster group)
The FileShareQuorum will check the configurations of witness server, witness directory and share for the DAG.
A failure of this test will indicate that a particular mailbox copy is currently suspended in the DAG
This checks if there are failures in database copies in the DAG.
DBInitializing parameter indicates the initialization status of database copies in the DAG or local Server. A passed means all copies have finished initializing.
This checks if any of the database copy in the mailbox is disconnected from the DAG.
This parameter indicates if the log generation on the active copy and log copying and inspection in the passive database copies are in sync.
This parameter indicates if the log generation on the active copy and log replaying in the passive database copies are in sync.
Get-MailboxDatabaseCopyStatus cmdlet lets you see the mailbox database copy status. With this cmdlet, you can monitor copy of a database, copy of a database on a particular server or the entire database copies in a server.
If the test returns failed then it means that the copy of the mailbox database is currently not suspended and unable to copy the log files.Under this state, the system monitors the status of the reason behind the copy failure for changes. Once there is a change in the status, the copy status will be reverted to healthy.
The status message- suspended, indicates that the state of the database copy of the mailbox is currently suspended. It might be because of the intervention of an admin or because of execution of the cmdlet Suspend-MailboxDatabaseCopy.
A Healthy status message indicates that the copying and replaying function of mailbox database copy is either completed or running.
The initializing state is returned if the mailbox copy is being created, or if the duplication of the mailbox is just initialized or being initialized. It is also returned if the state is in transit from one to another. During this state, system monitors the consistency in states of the database and log stream. The duration for which a system remains in the initializing state is 15 to 30 seconds.
When the test returns seeding, it means that either the database copy of the mailbox, the content index of the copy or both of them are presently being seeded by exchange.If the seeding is complete, the status will be Initializing instead of seeding.
This indicates that the mailbox database copy is presently a source of seeding for another seeding instance.
As the name suggests, this means that the replication process is unavailble or inactive presently or is active on server housing mailbox database copy.
This is returned when the mailbox database copy and the log files are being synchronised for changes. Once all the changes are resolved the status changes.
This state is returned if the active mailbox database copy is up and available for clients to connect to.
This state is returned if the active mailbox database copy is not online and unavailable for clients to connect to.
This state is returned if the active mailbox database copy is about to be online and available for clients so that they can connect to it.
This state is returned if the active mailbox database copy is about to be offline and unavailable for clients to connect to it.
This means that the connection between the active database copy and mailbox database copy has been interrupted and done so when the connection was in a healthy state.They are usually reported when there are network failures in the DAG source and target.
This means that the connection between the active database copy and mailbox database copy has been interrupted and done so when the connection was in a resynchronization state.They are usually reported when there are network failures in the DAG source and target.
This state indicates that there is a failure which requires the intervention of the administrator to be repaired.Here the system do not autmatically monitor the issue and recover but requires intervention from the admin.
As the name suggests, this means that there is an ongoing restoration operation in the database.
The New-MailboxRepairRequest cmdlet is used to troubleshoot and resolve mailbox corruption issues.This command can be executed for a database or a single mailbox. During the execution of the cmdlet, that particular mailbox access is suspended which is being repaired.
The type of the corruption which is to be repaired is specified using this parameter. It can take the following values:
If there is more than one type of corruptions to be detected, each can be entered simultaneously by separating with a comma.
Database name As obvious, this parameter decides which database is to be checked and repaired. Please note that all mailboxes within the database will be checked while exercising this option. The number of simultaneous repair requests for active databases are limited to one. It can take the values:
- GUID of the database
- Database Name
The mailbox parameter and databse parameter cannot be used together.
- GUID of the database
As obvious, this parameter decides which mailbox is to be checked and repaired. It can take the values:
- Distinguished name (DN)
- User principal name (UPN)
- SMTP address
This parameter is specified if you are using mailbox checking and need to detect and repair both the original mailbox and the archive mailbox associated with it.
If this parameter is specified, a pop up asking you to confirm the cmdlet execution will not come up.
With this parameter, the cmdlet only detects the corruptions and do not repair it.
This means that the repairing process needs to be run with immediate effect.
This specified the GUID of the mailbox which is to be repaired. This parameter is used in conjunction with the Database parameter. GUID can be retrieved using the Get-MailboxStatistics cmdlet.
CollectOverMetrics.Ps1 is a script used by exchange during troubleshooting. This script examines the DAG event logs to obtain database operation information like mount, failover etc for a particular duration.
The script then stores certain information from each event in a csv file. The information recorded are:
- Database Identity
- Operation Starting and Ending time
- Database mount server
- Reason for Operation
- Status of completion of Operation-Success/Fail etc.
It decides on which DAG the collectovermetrics script be executed. In the absence of this parameter the script will be executed in the DAG for the local server.
This chooses the databases on which the script is executed.
If this parameter is specified, the script will log the information which began during the specified time. However this may result in partial capturing of information. If end time is not specified the operations are logged for the next 24 hours from specified start time. If neither is specified, the last day’s information is collected.
If this parameter is specified, the script will log the information which ended during the specified time. However this may result in partial capturing of information. If start time is not specified the operations are logged for the previous 24 hours from specified start time. If neither is specified, the last day’s information is collected.
This indicates the path where the collected information will be stored. In the absence of this parameter, information will be stored in the same directory as that of the script.
This parameter will generate a report based on the collected information. The report will be sorted based on the operation type and will be in HTML format with statistics for every group.
This parameter will auto open the generated html report upon completion of operation.
This parameter will ask the script to check for existing csv files to create a report based on them and the newly generated csv files.
This parameter will filter the type of operations whose information will be collected by the script.It can take the following values:
This parameter will filter the type of administrative operations whose information will be collected by the script.It can take the following values:
This will ask the script to output the results on to the output device upon completion.
Microsoft MVP | Exchange Server