首页 > 系统服务 > 详细

powershell 检索日志信息

时间:2015-05-07 12:41:48      阅读:238      评论:0      收藏:0      [点我收藏+]

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

$tpath=Test-Path $strlog

if(!$tpath)

{

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

    New-Item -Path $strlog -ItemType file

}

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

switch -Wildcard -File $strlog {

    "*error*" {$e++}

    "*info*"{$i++}

    "*warn*"{$w++}

}

Write-Output "

    $strlog contains the following:

    errors $e

    informations $i

    warnings $w

"


本文出自 “加速器” 博客,请务必保留此出处http://3544640.blog.51cto.com/3534640/1643686

powershell 检索日志信息

原文:http://3544640.blog.51cto.com/3534640/1643686

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!