使用Powershell访问IIS日志?

Mik*_*keJ 5 iis shell powershell logging

我知道你可以使用powershell来使注册表成为驱动器号.在PowerShell中还有其他对象以这种方式处理其他对象.有谁知道任何cmd-lets以这种方式访问​​IIS日志?

小智 1

一个快速而肮脏的脚本会起作用吗?W3c日志文件头(IIS默认保存)的第三行有一个#Header行...将以下内容保存为Import-W3CLog.ps1

param ($logfile)
import-csv -Delimiter " " -Header "date","time","s-ip","cs-method","cs-uri-stem","cs-uri-query","s-port","cs-username","c-ip","csUser-Agent","sc-status","sc-substatus","sc-win32-status","time-taken" -path $logfile | where { !($_.Date.StartsWith('#')) }
Run Code Online (Sandbox Code Playgroud)