I am using the below script to query the event log of remote computers and spit out a specific event. The script works pretty much perfectly, but it doesn’t display the computer name an event is from. This is obviously problematic when checking against 100 host. I am struggling considerably to correct this behavior, can anyone help me achieve this?
$ServerName = Get-Content "Computers.txt" $time = (Get-Date) - (New-TimeSpan -Day 120) $currnet = (Get-Date) foreach ($Server in $ServerName) { Get-WinEvent @{logname='Application'; level=2,3;starttime=$time;providername='IAStorDataMgrSvc'} -ErrorAction SilentlyContinue -ComputerName $Server }