<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"
时间: 2024-12-17 01:56:51