Advertisement
guyrleech

Count IIS log file lines from computers for number of days

Aug 18th, 2020
704
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ## Count non-comment lines from IIS logs for specific days (here 10-14th August 2020). Useful for checking load balancing
  2. ## Needs PowerShell 3.0 or above
  3.  
  4. [string[]]$computers = 'Computer1','Computer2','Computer3'
  5.  
  6. 10..14|%{ $day=$_.ToString('00'); invoke-command -compute $computers -scriptBlock {  gc c:\inetpub\logs\LogFiles\W3SVC1\u_ex2008$using:day.log|sls -NotMatch '^#'|measure|select -Property @{n='day';e={$using:day}},@{n='Lines';e={$_.Count}} }|sort lines}|select * -exclude runspaceid|ft -auto
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement