将服务器上的某些特定日志统一保存至XPS文件

<APACHost.CSV>
Hostname,IP,OSType
srv1,10.103.22.22,Win2003
srv2,10.103.22.37,Win2008
 
Import-Csv -Path F:\chgpwd\APACHost.CSV | ForEach-Object {
    "**************" + $_.Hostname + "**************"
    if($_.OSType -eq 'Win2003') { Get-EventLog -ComputerName $_.hostname -LogName Security -InstanceId 538 -Newest 1 | fl * }
    else { Get-EventLog -ComputerName $_.hostname -LogName Security -InstanceId 5447 -Newest 1 | fl * }
} | Out-Printer -Name "Microsoft XPS Document Writer"

 

posted @ 2015-05-11 09:55  dongdonggeorge  阅读(281)  评论(0编辑  收藏  举报