<# .SYNOPSIS Auflistung aller Outlook-Client-Verbindungen zum Exchange Server als HTML Report .DESCRIPTION PowerShell Skript zur automatischen Auswertung der RPC-Log-Dateien auf einem oder mehreren Exchange Servern inkl. Erstellung von einem übersichtlichen HTML Report .EXAMPLE C:\Scripts\Outlook_Version.ps1 .NOTES Date: 12.12.2018 Author: Jan Kappen Website: https://www.zueschen.eu Twitter: @JanKappen Thanks to Mike F Robbins for his cool function, for more informations have a look at his description #> #Requires -Version 3.0 function Get-MrRCAProtocolLog { <# .SYNOPSIS Identifies and reports which Outlook client versions are being used to access Exchange. .DESCRIPTION Get-MrRCAProtocolLog is an advanced PowerShell function that parses Exchange Server RPC logs to determine what Outlook client versions are being used to access the Exchange Server. .PARAMETER LogFile The path to the Exchange RPC log files. .EXAMPLE Get-MrRCAProtocolLog -LogFile 'C:\Program Files\Microsoft\Exchange Server\V15\Logging\RPC Client Access\RCA_20140831-1.LOG' .EXAMPLE Get-ChildItem -Path '\\servername\c$\Program Files\Microsoft\Exchange Server\V15\Logging\RPC Client Access\*.log' | Get-MrRCAProtocolLog | Out-GridView -Title 'Outlook Client Versions' .INPUTS String .OUTPUTS PSCustomObject .NOTES Author: Mike F Robbins Website: http://mikefrobbins.com Twitter: @mikefrobbins #> [CmdletBinding()] param ( [Parameter(Mandatory, ValueFromPipeline)] [ValidateScript({ Test-Path -Path $_ -PathType Leaf -Include '*.log' })] [string[]]$LogFile ) PROCESS { foreach ($file in $LogFile) { $Headers = (Get-Content -Path $file -TotalCount 5 | Where-Object {$_ -like '#Fields*'}) -replace '#Fields: ' -split ',' Import-Csv -Header $Headers -Path $file | Where-Object {$_.operation -eq 'Connect' -and $_.'client-software' -eq 'outlook.exe'} | Select-Object -Unique -Property @{label='User';expression={$_.'client-name' -replace '^.*cn='}}, @{label='Version';expression={Get-MrOutlookVersion -OutlookBuild $_.'client-software-version'}}, client-software-version, client-ip } } } function Get-MrOutlookVersion { param ( [string]$OutlookBuild ) switch ($OutlookBuild) { # Outlook 2016 / Outlook 365 / Outlook 2019 {$_ -ge '16.0.11001.20097'} {'Outlook 2016 / 365 / 2019'; break} {$_ -ge '16.0.4229.1003'} {'Outlook 2016 / 365 / 2019'; break} # Outlook 2013 {$_ -ge '15.0.4569.1506'} {'Outlook 2013 SP1'; break} {$_ -ge '15.0.4420.1017'} {'Outlook 2013 RTM'; break} # Outlook 2010 {$_ -ge '14.0.7015.1000'} {'Outlook 2010 SP2'; break} {$_ -ge '14.0.6025.1000'} {'Outlook 2010 SP1'; break} {$_ -ge '14.0.4734.1000'} {'Outlook 2010 RTM'; break} # Outlook 2007 {$_ -ge '12.0.6606.1000'} {'Outlook 2007 SP3'; break} {$_ -ge '12.0.6423.1000'} {'Outlook 2007 SP2'; break} {$_ -ge '12.0.6212.1000'} {'Outlook 2007 SP1'; break} {$_ -ge '12.0.4518.1014'} {'Outlook 2007 RTM'; break} # Outlook 2003 {$_ -ge '11.0.8303.0'} {'Outlook 2003 SP3'; break} {$_ -ge '11.0.8000.0'} {'Outlook 2003 SP2'; break} {$_ -ge '11.0.6352.0'} {'Outlook 2003 SP1'; break} {$_ -ge '11.0.5604.0'} {'Outlook 2003'; break} # Noch älter Default {'Älter als Outlook 2003...'} } } # Prüfung auf benötigtes Modul if (-not (Get-Module -ListAvailable -Name ReportHTML)) { Write-Host -ForegroundColor Red 'Benötigtes Modul "ReportHTML" nicht vorhanden, Abbruch!'`n Write-Host -ForegroundColor Green 'Installation muss mir "Install-Module -Name ReportHTML" durchgeführt werden' Write-Host -ForegroundColor Green 'Weitere Infos unter "https://www.powershellgallery.com/packages/ReportHTML/"' # Hilfe und Anleitung: https://azurefieldnotesblog.blob.core.windows.net/wp-content/2017/06/Help-ReportHTML2.html exit } $cas1 = Get-ChildItem -Path 'C:\Temp\RPC Client Access\cas1\*.log' | Get-MrRCAProtocolLog | Sort-Object -Property User -Unique $cas2 = Get-ChildItem -Path 'C:\Temp\RPC Client Access\cas2\*.log' | Get-MrRCAProtocolLog | Sort-Object -Property User -Unique # Bau den Report, Bob! $rpt = @() $rpt += Get-HTMLOpenPage -TitleText "Exchange 2010 - Client Verbindungen" -HideLogos # cas1 $rpt += Get-HtmlContentOpen -BackgroundShade 3 -HeaderText "Client Verbindungen Exchange 2010" $rpt+= get-HtmlColumn1of2 $rpt+= Get-HtmlContentOpen -BackgroundShade 2 -HeaderText 'CAS1' $rpt+= Get-HtmlContentTable $cas1 $rpt += Get-HTMLContentClose $rpt+= get-htmlColumnClose # cas2 $rpt+= get-HtmlColumn2of2 $rpt+= Get-HtmlContentOpen -BackgroundShade 2 -HeaderText 'CAS2' $rpt+= Get-HtmlContentTable $cas2 $rpt += Get-HTMLContentClose $rpt+= get-htmlColumnClose $rpt += Get-HTMLClosePage $rpt | set-content -path "c:\temp\exchange_connections.html" # Set-Content -Value $rpt -path "c:\temp\exchange_connections.html"