PoshCode Archive  Artifact [3ff32f698a]

Artifact 3ff32f698a421a5addc342744285b863d0726b684333cd196d78acf277aa519d:

  • File Count-CachedMode-ps1.ps1 — part of check-in [6060c30928] at 2018-06-10 13:25:16 on branch trunk — Count-CachedMode.ps1 (user: unknown size: 1433)

# encoding: ascii
# api: powershell
# title: 
# description: Count-CachedMode.ps1
# version: 0.1
# type: script
# license: CC0
# x-poshcode-id: 3410
# x-archived: 2012-05-16T21:39:03
#
# Simple example using a hash to parse CAS Connect Logs
# After using the get-CASConnectLogEntries.ps1 to collect the log information
# This script runs thru those files and counts Cached vs Classic
# Corrected typo
#
# 
# simple example using a hash to parse CAS Connect Logs
#
# after using the get-CASConnectLogEntries.ps1 to collect the log information
# this script runs thru those files and counts Cached vs Classic
#
#


# the directory where you keep these "cas connect logs" - change to fit your needs
$Script:CasLogUNCDir   ='\\<server>\<drv>\Web\Data\CASConnectLogs'

# Hast Table to hold results : LegacyExchangeDN-Clientversion, Mode
$Clients = @{}

foreach ($Line in (gci $Script:CasLogUNCDir | gc) ) {
    #legacyExchangeDN
    $LEDN = $Line.Split(",")[3]
    
    #Outlook version
    $OLVER = $Line.Split(",")[6]
    
    #ClientMode
    $Mode = $Line.Split(",")[7]

    if(-not ($Clients.ContainsKey($LEDN+'-'+$OLVer))) {
        $Clients.Add($($LEDN+'-'+$OLVer),$MODE)
    }
}

"Total Clients [ {0} ]; Cached [ {1} ]; Classic [ {2} ]"-f ($Clients.Count),(($Clients.getenumerator() | ?{$_.value-match'Cached'}).Count),(($Clients.getenumerator() | ?{$_.value-notmatch'Cached'}).Count)