Skip to content

Instantly share code, notes, and snippets.

@tostka
Created March 29, 2018 22:18
Show Gist options
  • Save tostka/c04641027baef9c65e1d6e0180be472e to your computer and use it in GitHub Desktop.
Save tostka/c04641027baef9c65e1d6e0180be472e to your computer and use it in GitHub Desktop.
# comma-delimited server name array,
# foreach into logparser command
# Note: edit/update the logname string, to specify variant dates
# one-line follows (manually wrapped for clarity)
$CASs="US-HUBCAS1","US-HUBCAS2","US-HUBCAS3" ;
foreach ($CAS in $CASs){
write-host ("`n" + $CAS) ;
.\logparser.exe "SELECT cs(User-Agent) as Client, count(*) as Hits INTO $CAS-EWS-ALLClients.csv FROM '\\$CAS\e$\Weblogs\W3SVC1\ex130919*.log' WHERE cs-uri-stem LIKE '%/EWS/%' GROUP BY Client ORDER BY Hits DESC" -o:csv ;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment