powershell 檢索日誌信息

$strlog="c:\log\applog.txt";$e=$i=$w=0app

$tpath=Test-Path $strlogide

if(!$tpath)orm

{it

    New-Item -Path "c:\log" -ItemType dirio

    New-Item -Path $strlog -ItemType fileform

}class

Get-EventLog -LogName Application | Out-File $strlogfile

switch -Wildcard -File $strlog {error

    "*error*" {$e++}di

    "*info*"{$i++}

    "*warn*"{$w++}

}

Write-Output "

    $strlog contains the following:

    errors $e

    informations $i

    warnings $w

"

相關文章
相關標籤/搜索