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.
Test-ServiceHealth
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.
Test-ReplicationHealth
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
-
ClusterService
The clusterService parameter indicates if the Cluster service is active and available on the specific DAG member (or local server)
-
ReplayService
This parameter indicates that exchange replication sercice is active and available on the DAG member.
-
ActiveManager
It indicates the status of the role active manager on the DAG is either of the three- Stand Alone, Primary or Secondary.
-
TasksRpcListener
This parameter is tested to check if the RPC server is active and available in the DAG or local server.
-
TcpListener
A successful test of the TCPListener will indicate that the TCP log copy listener is working on the DAG member or local server
-
DagMembersUp
As the name suggests, this parameter will check for the status of DAG members- whether they are up, running and responding.
-
ClusterNetwork
This parameter indicates whether the networks managed by clusters on the DAG are reachable.
-
QuorumGroup
This parameter indicates the health and online status of the quorum group(which is the default cluster group)
-
FileShareQuorum
The FileShareQuorum will check the configurations of witness server, witness directory and share for the DAG.
-
DBCopySuspended
A failure of this test will indicate that a particular mailbox copy is currently suspended in the DAG
-
DBCopyFailed
This checks if there are failures in database copies in the DAG.
-
DBInitializing
DBInitializing parameter indicates the initialization status of database copies in the DAG or local Server. A passed means all copies have finished initializing.
-
DBDisconnected
This checks if any of the database copy in the mailbox is disconnected from the DAG.
-
DBLogCopyKeepingUp
This parameter indicates if the log generation on the active copy and log copying and inspection in the passive database copies are in sync.
-
DBLogReplayKeepingUp
This parameter indicates if the log generation on the active copy and log replaying in the passive database copies are in sync.
Get-MailboxDatabaseCopyStatus
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.
Parameters
-
Failed
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.
-
Suspended
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.
-
Healthy
A Healthy status message indicates that the copying and replaying function of mailbox database copy is either completed or running.
-
Initializing
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.
-
Seeding
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.
-
SeedingSource
This indicates that the mailbox database copy is presently a source of seeding for another seeding instance.
-
ServiceDown
As the name suggests, this means that the replication process is unavailble or inactive presently or is active on server housing mailbox database copy.
-
Resynchronizing
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.
-
Mounted
This state is returned if the active mailbox database copy is up and available for clients to connect to.
-
Dismounted
This state is returned if the active mailbox database copy is not online and unavailable for clients to connect to.
-
Mounting
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.
-
Dismounting
This state is returned if the active mailbox database copy is about to be offline and unavailable for clients to connect to it.
-
DisconnectedAndHealthy
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.
-
DisconnectedAndResynchronizing
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.
-
FailedAndSuspended
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.
-
SinglePageRestore
As the name suggests, this means that there is an ongoing restoration operation in the database.
New-MailboxRepairRequest
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.
Parameters
-
CorruptionType
The type of the corruption which is to be repaired is specified using this parameter. It can take the following values:
- SearchFolder
- AggregateCounts
- ProvisionedFolder
- FolderView
If there is more than one type of corruptions to be detected, each can be entered simultaneously by separating with a comma.
- SearchFolder
-
Database
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
-
Mailbox
As obvious, this parameter decides which mailbox is to be checked and repaired. It can take the values:
- GUID
- Distinguished name (DN)
- Domain\Account
- User principal name (UPN)
- LegacyExchangeDN
- SMTP address
- Alias
- GUID
-
Archive
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.
-
Confirm
If this parameter is specified, a pop up asking you to confirm the cmdlet execution will not come up.
-
DetectOnly
With this parameter, the cmdlet only detects the corruptions and do not repair it.
-
Force
This means that the repairing process needs to be run with immediate effect.
-
StoreMailbox
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
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.
Parameters
-
DatabaseAvailabilityGroup
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.
-
Database
This chooses the databases on which the script is executed.
-
StartTime
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.
-
EndTime
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.
-
ReportPath
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.
-
GenerateHtmlReport
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.
-
ShowHtmlReport
This parameter will auto open the generated html report upon completion of operation.
-
SummariseCsvFiles
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.
-
ActionType
This parameter will filter the type of operations whose information will be collected by the script.It can take the following values:
- Move
- Mount
- Dismount
- Remount.
- Move
-
ActionTrigger
This parameter will filter the type of administrative operations whose information will be collected by the script.It can take the following values:
- Admin
- Automatic
- Admin
-
RawOutput
This will ask the script to output the results on to the output device upon completion.
Ratish Nair
Microsoft MVP | Exchange Server
Team @MSExchangeGuru.com
July 23rd, 2013 at 3:24 pm
[…] https://msexchangeguru.com/2013/07/23/monitoring-powershell/ […]
July 27th, 2013 at 12:13 am
[…] Exchange 2013 CAS Role Demystified: https://msexchangeguru.com/2013/05/22/exchange-2013-cas/ Exchange 2013 High Availability demystified: https://msexchangeguru.com/2013/05/23/e2013-ha-demystified/ Load Balancing Exchange Server 2013 – Good to know stuff: https://msexchangeguru.com/2013/06/05/load-balancing/ Public Folders Migration from Exchange 2007/2010 to Exchange 2013: https://msexchangeguru.com/2013/04/18/exchange2013-public-folders/ Upgrade from Exchange 2013 CU1 or RTM to CU2: https://msexchangeguru.com/2013/07/10/install-e2013-cu2/ Monitoring and troubleshooting Exchange using powershell: https://msexchangeguru.com/2013/07/23/monitoring-powershell/ […]
July 28th, 2013 at 3:50 pm
[…] Monitoring and troubleshooting Exchange using powershell – 23-July-2013 […]
July 28th, 2013 at 3:54 pm
[…] Monitoring and troubleshooting Exchange using powershell – 23-July-2013 […]
July 31st, 2013 at 6:27 am
[…] Monitoring and troubleshooting Exchange using powershell […]