PoshCode Archive  Artifact [3974f59220]

Artifact 3974f59220ca44a922161f3fca01770a7bce2f05ff3f56174aa4d7dd80cd734d:

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

# encoding: ascii
# api: powershell
# title: 
# description: Count-CachedMode.ps1
# version: 0.1
# type: script
# license: CC0
# x-poshcode-id: 3409
# x-archived: 2012-05-13T17:01:57
#
# 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
#
# 
# 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
$Cleints = @{}

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)