PS - Exchange Configuration Dump

First thing to do is run and environment report which can be generated by running the script available at - https://gallery.technet.microsoft.com/office/Generate-Exchange-2388e7c9

This is what I normally use to export other details of the Exchange Configuration out to CSV file for reference. Please note that as some are string values these will not be populated in the output but you can use Out-Grid to view and copy and paste from there if required.



#region Check and create logfiles directory
IF (Test-Path D:\LogFiles) {Write-Host "LogFiles directory exists"} ELSE {New-Item -path D:\ -Name LogFiles -ItemType Directory}
#endregion


$LogfileDir = "D:\LogFiles"

Get-ExchangeServer | Get-MailboxStatistics | Sort totalitemsize-desc | select displayname,itemcount,{$_.TotalItemSize.Value.ToMB()} | Export-csv -Path $LogfileDir\UserMailboxSize.csv
Get-AcceptedDomain | Export-CSV $LogfileDir\AcceptedDomain.csv
Get-ExchangeCertificate -server EXC01 | Export-csv -Path $LogfileDir\Get-ExchangeCertificate.csv -Append
Get-ExchangeCertificate -server EXC02 | Export-csv -Path $LogfileDir\Get-ExchangeCertificate.csv -Append
Get-ExchangeCertificate -server EXC03 | Export-csv -Path $LogfileDir\Get-ExchangeCertificate.csv -Append
Get-AutodiscoverVirtualDirectory | select * | Export-CSV -Path $LogfileDir\Get-AutodiscoverVirtualDirectory.csv
Get-ClientAccessServer | select * | Export-CSV $LogfileDir\Get-ClientAccessServer.csv
Get-ClientAccessArray | select * | Export-CSV $LogfileDir\Get-ClientAccessArray.csv
Get-WebServicesVirtualDirectory -server EXC01 |  select * | Export-CSV -Path $LogfileDir\Get-WebServicesVirtualDirectory.csv -Append
Get-WebServicesVirtualDirectory -server EXC02 |  select * | Export-CSV -Path $LogfileDir\Get-WebServicesVirtualDirectory.csv -Append
Get-WebServicesVirtualDirectory -server EXC03 |  select * | Export-CSV -Path $LogfileDir\Get-WebServicesVirtualDirectory.csv -Append
Get-ExchangeServer | Select * | Export-CSV -Path $LogfileDir\ExchangeServer.csv
Get-DomainController | Select * | Export-CSV -Path $LogfileDir\DomainController.csv
Get-OutlookProvider | Select * | Export-CSV -Path $LogfileDir\OutlookProvider.csv
Get-OutlookAnywhere -server EXC01 | Select * | Export-CSV -Path $LogfileDir\Get-OutlookAnywhere.csv -Append
Get-OutlookAnywhere -server EXC02 | Select * | Export-CSV -Path $LogfileDir\Get-OutlookAnywhere.csv -Append
Get-OutlookAnywhere -server EXC03 | Select * | Export-CSV -Path $LogfileDir\Get-OutlookAnywhere.csv -Append
Get-PopSettings -server EXC01 | Select * | Export-CSV -Path $LogfileDir\Get-PopSettings.csv -Append
Get-PopSettings -server EXC02 | Select * | Export-CSV -Path $LogfileDir\Get-PopSettings.csv -Append
Get-PopSettings -server EXC03 | Select * | Export-CSV -Path $LogfileDir\Get-PopSettings.csv -Append
Get-ImapSettings -server EXC01 | Select * | Export-CSV -Path $LogfileDir\Get-ImapSettings.csv -Append
Get-ImapSettings -server EXC02 | Select * | Export-CSV -Path $LogfileDir\Get-Imapsettings.csv -Append
Get-ImapSettings -server EXC03 | Select * | Export-CSV -Path $LogfileDir\Get-ImapSettings.csv -Append
Get-OWAVirtualDirectory -server EXC01 | Select * | Export-CSV -Path $LogfileDir\Get-OWAVirtualDirectory.csv -Append
Get-OWAVirtualDirectory -server EXC02 | Select * | Export-CSV -Path $LogfileDir\Get-OWAVirtualDirectory.csv -Append
Get-OWAVirtualDirectory -server EXC03 | Select * | Export-CSV -Path $LogfileDir\Get-OWAVirtualDirectory.csv -Append
Get-OABVirtualDirectory -server EXC01 | Select * | Export-CSV -Path $LogfileDir\Get-OABVirtualDirectory.csv -Append
Get-OABVirtualDirectory -server EXC02 | Select * | Export-CSV -Path $LogfileDir\Get-OABVirtualDirectory.csv -Append
Get-OABVirtualDirectory -server EXC03 | Select * | Export-CSV -Path $LogfileDir\Get-OABVirtualDirectory.csv -Append
Get-ActiveSyncVirtualDirectory -server EXC01 | Select * | Export-CSV -Path $LogfileDir\Get-ActiveSyncVirtualDirectory.csv -Append
Get-ActiveSyncVirtualDirectory -server EXC02 | Select * | Export-CSV -Path $LogfileDir\Get-ActiveSyncVirtualDirectory.csv -Append
Get-ActiveSyncVirtualDirectory -server EXC03 | Select * | Export-CSV -Path $LogfileDir\Get-ActiveSyncVirtualDirectory.csv -Append
Get-MAPIVirtualDirectory -server EXC01 | Select * | Export-CSV -Path $LogfileDir\Get-MAPIVirtualDirectory.csv -Append
Get-MAPIVirtualDirectory -server EXC02 | Select * | Export-CSV -Path $LogfileDir\Get-MAPIVirtualDirectory.csv -Append
Get-MAPIVirtualDirectory -server EXC03 | Select * | Export-CSV -Path $LogfileDir\Get-MAPIVirtualDirectory.csv -Append
Get-Mailbox -ResultSize Unlimited | Select-Object DisplayName, SamAccountName, PrimarySmtpAddress, @{Name="EmailAddresses";Expression={$_.EmailAddresses | Where-Object {$_.PrefixString -ceq "smtp"} | ForEach-Object {$_.SmtpAddress}}} | Export-CSV $LogfileDir\SMTPAddresses.csv -NoTypeInformation -Encoding Unicode
Get-ExchangeServer | Get-MailboxStatistics | Sort totalitemsize-desc | select displayname,itemcount,{$_.TotalItemSize.Value.ToMB()} | Export-csv -Path $LogfileDir\UserMailboxSize.csv
Get-Mailbox -ResultSize Unlimited | Where {$_.EmailAddressPolicyEnabled -eq $False} | Export-csv -Path $LogfileDir\UserEmailAddressPolicyDisabled.csv
Get-ReceiveConnector | Select * | Export-CSV -Path $LogfileDir\Get-ReceiveConnector.csv -Append
Get-SendConnector  | Select * | Export-CSV -Path $LogfileDir\Get-SendConnector.csv -Append
Get-SendConnector -server EXC01 | Select * | Export-CSV -Path $LogfileDir\Get-SendConnector.csv -Append
Get-TransportConfig | Select * | Export-CSV -Path $LogfileDir\Get-TransportConfig.csv -Append
Get-ActiveSyncDevice | Select * | Export-CSV -Path $LogfileDir\Get-ActiveSyncDevice.csv -Append
Get-MobileDevice | Select * | Export-CSV -Path $LogfileDir\Get-MobileDevice.csv -Append
Get-MailboxDatabase | Select * | Export-CSV $LogfileDir\Get-MailboxDatabase.csv

Get-ADServerSettings | Select * | Export-CSV -Path $LogfileDir\Get-ADServerSettings.csv -Append


Get-Mailbox -ResultSize Unlimited | Select * | Export-CSV -Path $LogfileDir\UserMailboxDetails.csv 

Get-CASMailbox -ResultSize Unlimited | Select * | Export-CSV -Path $LogfileDir\UserCASMailboxDetails.csv 


Export Message Tracking Logs


Get-MessageTrackingLog -Server SERVERNAME -ResultSize Unlimited -Start "02/14/2016 01:00:00" -End "02/16/2016 15:00:00"| Select {$_.Recipients}, {$_.RecipientStatus}, * | Export-Csv .\MessageTrackingLogExport.csv -NoType 


Get Outlook client versions - https://gallery.technet.microsoft.com/office/Determine-all-outlook-d43bd71f


#############################################################################
#                                          #
#   This Sample Code is provided for the purpose of illustration only       #
#   and is not intended to be used in a production environment.  THIS       #
#   SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT    #
#   WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT    #
#   LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS     #
#   FOR A PARTICULAR PURPOSE.  We grant You a nonexclusive, royalty-free    #
#   right to use and modify the Sample Code and to reproduce and distribute #
#   the object code form of the Sample Code, provided that You agree:       #
#   (i) to not use Our name, logo, or trademarks to market Your software    #
#   product in which the Sample Code is embedded; (ii) to include a valid   #
#   copyright notice on Your software product in which the Sample Code is   #
#   embedded; and (iii) to indemnify, hold harmless, and defend Us and      #
#   Our suppliers from and against any claims or lawsuits, including        #
#   attorneys' fees, that arise or result from the use or distribution      #
#   of the Sample Code.                                                     #
#                                          #
#############################################################################


#region Import Modules and Check needed apps
#Modules are required otherwise information is not retrieveable

        If (Test-Path "HKLM:\SOFTWARE\Microsoft\Exchange\v8.0")
        {
        Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin -EA SilentlyContinue
        Write-Host "Exchange 2007 is not supported and NO information will be retrieved from 2007 Exchange servers" -ForegroundColor Red

        }
        ElseIf ((Test-Path "HKLM:\SOFTWARE\Microsoft\ExchangeServer\v14") -or (Test-Path "HKLM:\SOFTWARE\Microsoft\ExchangeServer\v15"))
        {
         Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 -EA SilentlyContinue
}
        Else
        {Write-Host "No Exchange Console install could be found!" -ForegroundColor Red}
#endregion Import Modules


#Create an Empty Array to store the results of each file in.
$Data = @()

#Function Filter Data out of each RPC Client Access Log file
Function Filter-Data
{Param($FullFilePath)
If (Test-Path $FullFilePath)
    {
$Results = @(Get-Content -path $FullFilePath  | ConvertFrom-Csv -Header date-time,session-id,`
seq-number,client-name,organization-info,client-software,client-software-version,client-mode,client-ip,server-ip,protocol,application-id,`
operation,rpc-status,processing-time,operation-specific,failures | `
?{($_."client-software" -eq 'OUTLOOK.EXE') -and ($_."client-name" -ne $null)} |`
 Select client-software,client-software-version,client-mode,@{Name='client-name';Expression={($_."client-name")}} -Unique)
Return $Results
   }
}


$Servers = @(Get-ExchangeServer |?{(($_.IsClientAccessServer -eq '$true') -and (($_.AdminDisplayVersion).major -eq '14')) `
-or (($_.IsMailboxServer -eq '$true') -and (($_.AdminDisplayVersion).major -ge '15')) } | `
Select Name,@{Name='Path';Expression={("\\$($_.fqdn)\" + "$($_.Datapath)").Replace(':','$').Replace("Mailbox","Logging\RPC Client Access")}} )

ForEach ($Item in $Servers)
{
$Thefile = @(GCI -Path $Item.Path -Filter *.log | ?{$_.LastWriteTime -gt (Get-Date).AddDays(-2)} | Select @{Name='File';Expression={("$($Item.Path)" + "\$($_.Name)")}})
    Foreach ($F in $Thefile)
    {
    Write-Host "Working with file $($F.File)" -ForegroundColor DarkYellow
    $Data += (Filter-Data $F.File)
    }
}
$Data | Select * -Unique | Export-Csv .\Report.csv
$Data |Group-Object -Property "client-software-version" | Select @{Name='Version';Expression={$_.Name}},Count |Export-Csv .\breakdown.csv



Comments