Part of our jobs as consultants is to assess the health of an environment and make recommendations for service improvement. Microsoft has some great tools like the Best Practice Analyzer and the Remote Connectivity Analyzer, but those reports alone are not enough. I want to dig further and document all the settings of each feature so that I can see what is right and wrong. We have been called back to perform follow-up checks so it is good to have a solid reference for tracking historical configurations.

I do not like documents full of screenshots so I avoid screenshots whenever possible. I prefer simple tables with more detailed text documents attached in an appendix at the end. I use this script to automate the data collection for both my tables and text documents. Most settings export to a CSV well, but a few have multi-valued properties that look better as a format-table in a text document. I built this for Exchange 2010 to match the format of a document I had for 2007. I have not tried this script in an Exchange 2007 or 2013 environment, but most of the commands should work.

Health Check Data Dump

[CODE]

#MailboxSize

Get-Mailbox -ResultSize unlimited | Get-MailboxStatistics | select-object DisplayName,ItemCount,@{Name="TotalItemSize(MB)";Expression={$_.TotalItemSize.Value.ToMB()}},Database | Export-Csv c:\Download\Scripts\Output\Mailboxsize.csv -NoTypeInfo

 

#Virtual Directories

#OWA Virtual Directories

Get-OwaVirtualDirectory | select-object server,internalurl,externalurl | export-csv get-OWAVirtDir-Sum.csv -NoTypeInfo

 

$OWA = Get-OwaVirtualDirectory

Foreach ($OWAVD in $OWA)

{

Get-OwaVirtualDirectory -server $OWAVD.server | Format-List | out-file $("get-OWAVirtDir-"+$OWAVD.server+".txt")

}

 

#ActiveSync Virtual

Get-ActiveSyncVirtualDirectory | select-object server,internalurl,externalurl | export-csv Get-EASVirtDir-Sum.csv -NoTypeInfo

 

$EAS = Get-ActiveSyncVirtualDirectory

Foreach ($ASVD in $EAS)

{

Get-ActiveSyncVirtualDirectory -server $ASVD.server | Format-List | out-file $("get-EASVirtDir-"+$ASVD.server+".txt")

}

 

#Exchange Control Panel Virtual Directory

Get-ECPVirtualDirectory | select-object server,internalurl,externalurl | export-csv Get-ECPVirtDir-Sum.csv -NoTypeInfo

 

$ECP = Get-ECPVirtualDirectory

Foreach ($ECPVD in $ECP)

{

Get-ECPVirtualDirectory -server $ECPVD.server | Format-List | out-file $("get-ECPVirtDir-"+$ECPVD.server+".txt")

}

 

#Exchange Web Services Virtual Directory

Get-WebServicesVirtualDirectory | select-object server,internalurl,externalurl | export-csv Get-EWSVirtDir-Sum.csv -NoTypeInfo

 

$EWS = Get-WebServicesVirtualDirectory

Foreach ($EWSVD in $EWS)

{

Get-WEBServicesVirtualDirectory -server $EWSVD.server | Format-List | out-file $("get-EWSVirtDir-"+$EWSVD.server+".txt")

}

 

#Offline Address Book

Get-OfflineAddressBook | fl | out-file get-OAB.txt

 

Get-OabVirtualDirectory | select-object server,internalurl,externalurl | export-csv Get-OABVirtDir-Sum.csv -NoTypeInfo

 

$OAB = Get-OABVirtualDirectory

Foreach ($AB in $OAB)

{

Get-OABVirtualDirectory -server $AB.server | Format-List | out-file $("get-OABVirtDir-"+$AB.Server+".txt")

}

 

#Outlook Providers

Get-OutlookProvider exch | fl | out-file get-OutlookProv-EXCH.txt

Get-OutlookProvider expr | fl | out-file get-OutlookProv-EXPR.txt

Get-OutlookProvider web | fl | out-file get-OutlookProv-WEB.txt

 

#Client Access Array

Get-ClientAccessArray | select-object name,site,fqdn | export-csv Get-CASArray-Sum.csv -NoTypeInfo

 

$CA = Get-ClientAccessArray

Foreach ($Array in $CA)

{

Get-ClientAccessArray -id $Array.identity | Format-List | out-file $("get-CASArray-"+$Array.identity+".txt")

}

 

#Autodiscover

Get-ClientAccessServer | select-object name,autodiscoverserviceinternaluri | export-csv get-autodiscover-internaluri.csv -NoTypeInfo

 

#OutlookAnywhere

Get-OutlookAnywhere | select-object Server,ExternalHostname,ClientAuthenticationMethod | export-csv get-OutlookAnywhere-Sum.csv -NoTypeInfo

 

$OA = Get-OutlookAnywhere

Foreach ($OAS in $OA)

{

Get-OutlookAnywhere -server $OAS.server | Format-List | out-file $("get-OutlookAnywhere-"+$OAS.server+".txt")

}

 

#Accepted Domains

Get-AcceptedDomain | select-object name,domainname,domaintype,default | export-csv Get-AccDom-Sum.csv -NoTypeInfo

 

$ADOM = Get-AcceptedDomain

Foreach ($DOM in $ADOM)

{

Get-AcceptedDomain $DOM.Name | Format-List | out-file $("get-AcceptedDomain-"+$DOM.Name+".txt")

}

 

#Email Address Policies

$EAP = Get-EmailAddressPolicy

Foreach ($POL in $EAP)

{

Get-EmailAddressPolicy $POL.Name | Format-List | out-file $("get-EmailAddressPolicy-"+$POL.Name+".txt")

}

 

#Transport Rules

Get-TransportRule | select-object name,state,priority | export-csv Get-TransRule-Sum.csv -NoTypeInfo

 

$TRULE = Get-TransportRule

Foreach ($RULE in $TRULE)

{

Get-TransportRule "$RULE" | Format-List | out-file $("get-TransRule-"+$Rule+".txt")

}

 

#Send Connectors

Get-SendConnector | select-object name,enabled,smarthostsstring | export-csv Get-SendConn-Sum.csv -NoTypeInfo

 

$SCONN = Get-SendConnector

Foreach ($CONN in $SCONN)

{

Get-SendConnector "$CONN" | Format-List | out-file $("get-SendConn-"+$CONN+".txt")

}

 

#Receive Connectors

Get-ReceiveConnector | select-object server,name,enabled | export-csv Get-RecConn-Sum.csv -NoTypeInfo

 

$RCONN = Get-ReceiveConnector

Foreach ($REC in $RCONN)

{

Get-ReceiveConnector "$REC" | Format-List | out-file $("get-RecConn-"+$REC.Server+"-"+$REC.Name+".txt")

}

 

#Routing Group Connectors

Get-RoutingGroupConnector | ft name,sourcetransportservers,targettransportservers -AutoSize | out-file Get-RoutingGroupConn-Servers-Sum.txt

 

Get-RoutingGroupConnector | select-object name,sourceroutinggroup,targetRoutingGroup | export-csv Get-RoutingGroupConn-Groups-Sum.CSV -NoTypeInfo

 

$ROUTCONN = Get-RoutingGroupConnector

Foreach ($ROUTE in $ROUTCONN)

{

Get-RoutingGroupConnector "$ROUTE" | Format-List | out-file $("get-RouteConn-"+$ROUTE.Name+".txt")

}

 

#Mailbox Databases

Get-MailboxDatabase | select-object name,server,MasterServerOrAvailabilityGroup,rpcClientAccessServer | export-csv Get-MailDB-Sum.csv -NoTypeInfo

 

$MDB = Get-MailboxDatabase

Foreach ($DB in $MDB)

{

Get-MailboxDatabase "$DB" | Format-List | out-file $("get-MailDB-"+$DB+".txt")

}

 

#Sharing Policy

 

#Address Lists

 

#Retention Policy Tag

Get-RetentionPolicyTag | select-object name,type,RetentionAction | export-csv Get-RetPolTag-Sum.csv -NoTypeInfo

 

$RPTAG = Get-RetentionPolicyTag

Foreach ($TAG in $RPTAG)

{

Get-RetentionPolicyTag "$TAG" | Format-List | out-file $("get-RetPolTag-"+$TAG+".txt")

}

 

#RetentionPolicies

get-retentionpolicy | ft name,RetentionPolicyTagLinks -AutoSize | out-file get-RetPolicy-Sum.txt

 

$RPOL = Get-RetentionPolicy

Foreach ($POL in $RPOL)

{

Get-RetentionPolicy "$POL" | Format-List | out-file $("get-RetPol-"+$POL+".txt")

}

 

#Database Availability Groups

Get-DatabaseAvailabilityGroup | ft name,servers,WitnessServer,AlternateWitnessServer -AutoSize | out-file Get-DAG-Sum.txt

 

#Exchange Servers

Get-ExchangeServer | select-object name,serverRole,Edition,AdminDisplayVersion | export-csv Get-ExchServer-Sum.csv -NoTypeInfo

 

$EXCH = Get-ExchangeServer

Foreach ($ESERV in $EXCH)

{

Get-ExchangeServer "$ESERV" | Format-List | out-file $("get-ExchServer-"+$ESERV+".txt")

}

[/CODE]