############################################################################# # Author: Jude Perera # Date: 06/12/2019 # Description: This tool will provide you with a comprehensive detail html of your Exchange environment and provide a summary in an HTML file. # #NOTE # The script is custom written and the functionality should be tested prior to ensure validity and is provided “AS IS” without warranty of any kind, # either expressed or implied. ############################################################################# $Header = @" "@ $filenamedate = [datetime]::now.ToString('_ddMMyyyy_HHmmss') $Attachment = "$PSScriptRoot\ExchangeComprehensiveReport$filenamedate.htm" $ErrorActionPreference= 'silentlycontinue' $FormatEnumerationLimit = '-1' $start = @"
"@ $ReportHD =@"

Exchange Environment Comprehensive Report

$(Get-Date)

"@ ##START OF SUMMARY $ServerHead =@"

Server Summary

No.Exchange Servers No.Databases
$((Get-ExchangeServer).count) $((Get-MailboxDatabase).count)

"@ $ServerBody = foreach ($server in ((Get-ExchangeServer))) {" "} $ServerEnd = @"
Name Edition Version Server Role Site Operating System Database Count Mailbox Count
$($server.name) $($server.edition) $([string]($server.AdminDisplayVersion)) $($server.serverrole) $($server.site.name) $($windows2012above = ((Get-WmiObject -ComputerName $server.name -class Win32_OperatingSystem -ErrorAction SilentlyContinue) | Where-Object{($_.Version -like "6.*") -or ($_.version -like "10.*") -and ($_.Version -notlike "6.1.*") -and ($_.version -notlike "6.0.*")}).version.count if ($windows2012above -eq 1) {(Get-CimInstance -ComputerName $server.name Win32_OperatingSystem -ErrorAction SilentlyContinue).caption}) $((Get-mailboxdatabase -server $server).count) $((Get-mailbox -server $server -resultsize Unlimited).count)


"@ ##START OF DATABASE DETAILS $DatabaseHead =@"

Database Summary

"@ $DatabaseBody = foreach ($database in ((Get-MailboxDatabase -status -ErrorAction SilentlyContinue))) { " "} # # $DatabaseEnd = @"
Name Database Size Mounted On Warning Quota (GB) Prohibit Send Quota (GB) Prohibit Send/Recv Quota (GB) Database Copies Last Full backup RPC CAS FQDN Circular Logging EDB Path Log Path
$($database.name) $("{0:N2}" -f ($database.databasesize.Tobytes() / 1GB)) $($database.server.name) $("{0:N2}" -f ($database.IssueWarningQuota.value.Tobytes() / 1GB)) $("{0:N2}" -f ($database.ProhibitSendQuota.value.Tobytes() / 1GB)) $("{0:N2}" -f ($database.ProhibitSendReceiveQuota.value.Tobytes() / 1GB)) $([string]::join("
",($database.servers)))
$($database.LastFullBackup) $($database.RpcClientAccessServer) $($database.CircularLoggingEnabled) $($database.EdbFilePath) $($database.LogFolderPath) $($windows2012above = ((Get-WmiObject -ComputerName $server.name -class Win32_OperatingSystem -ErrorAction SilentlyContinue) | Where-Object{($_.Version -like "6.*") -or ($_.version -like "10.*") -and ($_.Version -notlike "6.1.*") -and ($_.version -notlike "6.0.*")}).version.count if ($windows2012above -eq 1) {(Get-CimInstance -ComputerName $server.name Win32_OperatingSystem -ErrorAction SilentlyContinue).caption})
$((Get-mailboxdatabase -server $server).count)$((Get-mailbox -server $server).count)


"@ ##START OF DATABASE COPY DETAILS $DBCopyHead =@"

Database Copy Summary

"@ $DBCopyBody = foreach ($dbcopy in ((Get-MailboxDatabaseCopyStatus * -ErrorAction SilentlyContinue))) { " "} $DBCopyEnd = @"
Database Name Server Status Content Index Status Copy Queue Length Replay Queue Length
$($dbcopy.databasename) $($dbcopy.MailboxServer) $($dbcopy.Status) $($dbcopy.ContentIndexState) $($dbcopy.CopyQueueLength) $($dbcopy.ReplayQueueLength)


"@ ##START OF DATABASE AVAILABILITY GROUP DETAILS $DAGHead =@"

Database Availability Group Summary

"@ $DAGBody = foreach ($dag in ((Get-DatabaseAvailabilityGroup -status * -ErrorAction SilentlyContinue))) { " "} $DAGEnd = @"
DAG Name DAG Members Witness In Use Witness Server Alternate Witness Server DAG IP Primary Active Manager Operational Servers Exchange Version Witness Directory Alternate Witness Directory
$($dag.Name) $([string]::join("
",($dag.Servers)))
$($dag.WitnessShareInUse) $($dag.WitnessServer) $($dag.AlternateWitnessServer) $($dag.DatabaseAvailabilityGroupIpv4Addresses) $($dag.PrimaryActiveManager) $([string]::join("
",($dag.OperationalServers)))
$($dag.ExchangeVersion) $($dag.WitnessDirectory) $($dag.AlternateWitnessDirectory)


"@ ###################################################### ##START OF DATABASE AVAILABILITY GROUP NETWORK DETAILS ###################################################### $DAGNWHead =@"

Database Availability Group Network Summary

"@ $DAGNWBody = foreach ($dagnw in ((Get-DatabaseAvailabilityGroupNetwork -ErrorAction SilentlyContinue))) { " "} $DAGNWEnd = @"
Network Name Subnets Interfaces MAPI Enabled Replication Enabled
$($dagnw.Name) $([string]::join("
",($dagnw.subnets)))
$([string]::join("
",($dagnw.Interfaces)))
$($dagnw.MapiAccessEnabled) $($dagnw.ReplicationEnabled)


"@ ###################################################### ##START OF OWA VIRTUAL DIRECTORY DETAILS ###################################################### $OWAVDHead =@"

OWA Virtual Directory Summary

"@ $OWAVDBody = foreach ($owavd in ((Get-OwaVirtualDirectory -ErrorAction SilentlyContinue))) { " "} $OWAVDEnd = @"
Server Name Internal URL External URL Internal Auth Methods External Auth Methods Basic Auth Windows Auth Forms Auth Digest Auth
$($owavd.Server) $($owavd.Name) $($owavd.InternalURL) $($owavd.ExternalURL) $([string]::join("
",($owavd.InternalAuthenticationMethods)))
$([string]::join("
",($owavd.ExternalAuthenticationMethods)))
$($owavd.BasicAuthentication) $($owavd.WindowsAuthentication) $($owavd.FormsAuthentication) $($owavd.DigestAuthentication)


"@ ###################################################### ##START OF ECP VIRTUAL DIRECTORY DETAILS ###################################################### $ECPVDHead =@"

ECP Virtual Directory Summary

"@ $ECPVDBody = foreach ($ecpvd in ((Get-ECPVirtualDirectory -ErrorAction SilentlyContinue))) { " "} $ECPVDEnd = @"
Server Name Internal URL External URL Internal Auth Methods External Auth Methods Basic Auth Windows Auth Forms Auth Digest Auth
$($ecpvd.Server) $($ecpvd.Name) $($ecpvd.InternalURL) $($ecpvd.ExternalURL) $([string]::join("
",($ecpvd.InternalAuthenticationMethods)))
$([string]::join("
",($ecpvd.ExternalAuthenticationMethods)))
$($ecpvd.BasicAuthentication) $($ecpvd.WindowsAuthentication) $($ecpvd.FormsAuthentication) $($ecpvd.DigestAuthentication)


"@ ###################################################### ##START OF OAB VIRTUAL DIRECTORY DETAILS ###################################################### $OABVDHead =@"

OAB Virtual Directory Summary

"@ $OABVDBody = foreach ($oabvd in ((Get-OABVirtualDirectory -ErrorAction SilentlyContinue))) { " "} $OABVDEnd = @"
Server Name Internal URL External URL Internal Auth Methods External Auth Methods Basic Auth Windows Auth
$($oabvd.Server) $($oabvd.Name) $($oabvd.InternalURL) $($oabvd.ExternalURL) $([string]::join("
",($oabvd.InternalAuthenticationMethods)))
$([string]::join("
",($oabvd.ExternalAuthenticationMethods)))
$($oabvd.BasicAuthentication) $($oabvd.WindowsAuthentication)


"@ ###################################################### ##START OF EAS VIRTUAL DIRECTORY DETAILS ###################################################### $EASVDHead =@"

ActiveSync Virtual Directory Summary

"@ $EASVDBody = foreach ($easvd in ((Get-ActiveSyncVirtualDirectory -ErrorAction SilentlyContinue))) { " "} $EASVDEnd = @"
Server Name Internal URL External URL Internal Auth Methods External Auth Methods Basic Auth Windows Auth
$($easvd.Server) $($easvd.Name) $($easvd.InternalURL) $($easvd.ExternalURL) $([string]::join("
",($easvd.InternalAuthenticationMethods)))
$([string]::join("
",($easvd.ExternalAuthenticationMethods)))
$($easvd.BasicAuthentication) $($easvd.WindowsAuthentication)


"@ ###################################################### ##START OF EWS VIRTUAL DIRECTORY DETAILS ###################################################### $EWSVDHead =@"

EWS Virtual Directory Summary

"@ $EWSVDBody = foreach ($ewsvd in ((Get-WebServicesVirtualDirectory -ErrorAction SilentlyContinue))) { " "} $EWSVDEnd = @"
Server Name Internal URL External URL Internal Auth Methods External Auth Methods Basic Auth Windows Auth
$($ewsvd.Server) $($ewsvd.Name) $($ewsvd.InternalURL) $($ewsvd.ExternalURL) $([string]::join("
",($ewsvd.InternalAuthenticationMethods)))
$([string]::join("
",($ewsvd.ExternalAuthenticationMethods)))
$($ewsvd.BasicAuthentication) $($ewsvd.WindowsAuthentication)


"@ ###################################################### ##START OF MAPI VIRTUAL DIRECTORY DETAILS ###################################################### $MAPIVDHead =@"

MAPI Virtual Directory Summary

"@ $MAPIVDBody = foreach ($mapivd in ((Get-MapiVirtualDirectory -ErrorAction SilentlyContinue))) { " "} $MAPIVDEnd = @"
Server Name Internal URL External URL IIS Auth Methods Internal Auth Methods External Auth Methods Basic Auth Windows Auth
$($mapivd.Server) $($mapivd.Name) $($mapivd.InternalURL) $($mapivd.ExternalURL) $([string]::join("
",($mapivd.IISAuthenticationMethods)))
$([string]::join("
",($mapivd.InternalAuthenticationMethods)))
$([string]::join("
",($mapivd.ExternalAuthenticationMethods)))
$($mapivd.BasicAuthentication) $($mapivd.WindowsAuthentication)


"@ ###################################################### ##START OF OUTLOOK ANYWHERE DETAILS ###################################################### $OAHead =@"

Outlook Anywhere Summary

"@ $OABody = foreach ($oa in ((Get-OutlookAnywhere -ErrorAction SilentlyContinue))) { " "} $OAEnd = @"
Server Name Internal URL External URL IIS Auth Methods Internal Auth Methods External Auth Methods
$($oa.ServerName) $($oa.Name) $($oa.InternalHostname) $($oa.ExternalHostname) $([string]::join("
",($oa.IISAuthenticationMethods)))
$([string]::join("
",($oa.InternalClientAuthenticationMethod)))
$([string]::join("
",($oa.ExternalClientAuthenticationMethod)))


"@ ###################################################### ##START OF CLIENT ACCESS SERVER DETAILS ###################################################### $CASHead =@"

Client Access Server Autodiscover URL

"@ $CASBody = foreach ($CASsvr in ((Get-ClientAccessService -ErrorAction SilentlyContinue))) { " "} $CASEnd = @"
Name AutoDiscover URL
$($cassvr.Name) $($cassvr.AutoDiscoverServiceInternalUri)


"@ ###################################################### ##START OF RECEIVE CONNECTOR DETAILS ###################################################### $RCONHead =@"

Receive Connector Summary

"@ ## $RCONBody = foreach ($RCON in ((Get-ReceiveConnector -ErrorAction SilentlyContinue))) { " "} ## $RCONEnd = @"
Server Name Enabled Max Message Size (MB) FQDN Transport Role Require TLS Permissions Authentication Protocol Logging Enabled Bindings Remote IPs
Open Relay Connectors
$($RCON.Server.name) $($RCON.Name) $($RCON.Enabled) $("{0:N2}" -f ($RCON.MaxMessageSize.Tobytes() / 1MB)) $($RCON.FQDN) $($RCON.TransportRole) $($RCON.RequireTLS) $($RCON.PermissionGroups -replace ",","
")
$($RCON.AuthMechanism -replace ",","
")
$($RCON.ProtocolLoggingLevel) $([string]::join("
",($RCON.Bindings)))
$([string]::join("
",($RCON.RemoteIPRanges)))
$(Get-ReceiveConnector -id $RCON | Get-ADPermission | where {$_.identity -notlike "*Default*" -and $_.identity -notlike "*Client*" -and $_.user -like "NT AUTHORITY\*" -and $_.ExtendedRights -like "MS-Exch-SMTP-Accept-Any-Recipient"}.ExtendedRights)


"@ ###################################################### ##START OF SEND CONNECTOR DETAILS ###################################################### $SCONHead =@"

Send Connector Summary

"@ $SCONBody = foreach ($SCON in ((Get-SendConnector -ErrorAction SilentlyContinue))) { " "} $SCONEnd = @"
Name Enabled Max Message Size (MB) FQDN DNS Routing Enabled Frontend Proxy Enabled Ignore STARTTLS Require TLS Logging Smarthosts Source Servers
$($SCON.Name) $($SCON.Enabled) $($SCON.MaxMessageSize) $($SCON.AddressSpaces) $($SCON.DNSRoutingEnabled) $($SCON.FrontendProxyEnabled) $($SCON.IgnoreSTARTTLS) $($SCON.RequireTLS) $($SCON.ProtocolLoggingLevel) $($SCON.Smarthosts) $([string]::join("
",($SCON.SourceTransportServers.name)))


"@ ###################################################### ##START OF TRANSPORT CONFIG DETAILS ###################################################### $TransportHead =@"

Transport Configuration Summary

"@ $TransportBody = foreach ($tx in ((get-TransportConfig -ErrorAction SilentlyContinue))) { " "} $TransportEnd = @"
Max Receive Size Max Send Size (MB)
$($tx.MaxReceiveSize.value.tomb()) $($tx.MaxSendSize.value.tomb())


"@ ###################################################### ### START OF OAB DETAILS ###################################################### $oabHead =@"

Outlook Address Book Summary

"@ $oabBody = foreach ($oab in ((Get-OfflineAddressBook -ErrorAction SilentlyContinue))) { " "} $oabEnd = @"
Name Version Public Folder Distribution Web Distribution Address Lists
$($oab.name) $($oab.Version) $($oab.PublicFolderDistributionEnabled) $($oab.WebDistributionEnabled) $($oab.AddressLists)


"@ ###################################################### ### START OF ACCEPTED DOMAIN DETAILS ###################################################### $accdomHead =@"

Accepted Domain Summary

"@ $accdomBody = foreach ($accdom in ((Get-AcceptedDomain -ErrorAction SilentlyContinue))) { " "} $accdomEnd = @"
Name Domain Name Domain Type Default Domain
$($accdom.name) $($accdom.DomainName) $($accdom.DomainType) $($accdom.Default)


"@ ############################################################################################################################################################################################# ############################################################################################################################################################################################# #Format all into HTML ############################################################################################################################################################################################# ############################################################################################################################################################################################# ConvertTo-HTML -Body " $ReportHD $ServerHead $ServerBody $ServerEnd $DatabaseHead $DatabaseBody $DatabaseEnd $DBCopyHead $DBCopyBody $DBCopyEnd $DAGHead $DAGBody $DAGEnd $DAGNWHead $DAGNWBody $DAGNWEnd $OWAVDHead $OWAVDBody $OWAVDEnd $ECPVDHead $ECPVDBody $ECPVDEnd $OABVDHead $OABVDBody $OABVDEnd $EASVDHead $EASVDBody $EASVDEnd $EWSVDHead $EWSVDBody $EWSVDEnd $MAPIVDHead $MAPIVDBody $MAPIVDEnd $OAHead $OABody $OAEnd $CASHead $CASBody $CASEnd $RCONHead $RCONBody $RCONEnd $SCONHead $SCONBody $SCONEnd $TransportHead $TransportBody $TransportEnd $oabHead $oabBody $oabEnd $accdomHead $accdomBody $accdomEnd " -Title "Exchange Server Comprehensive Report" -Head $Header | Out-File $Attachment