I am trying to get a powershell script to reach out to a batch of domain computers and pull the specific information from them and put the information back into a .csv file. The challenge is that I think I need 'permissions' to log into each computer to get that information but I am not sure how that would work with the system names sitting in a txt file. Any suggestions would be appreciated.
$C = Get-Credential
-credential $C
$computernames = Get-Content -Path "c:\scripts\test.txt"
Get-EventLog -ComputerName $computernames -LogName System | Where-Object {$_.EventID -eq "1074" -or $_.EventID -eq "6008" -or $_.EventID -eq "1076"} | sort TimeWritten | ft Machinename, TimeWritten, UserName, EventID, Message | Export-Csv -Path "c:\scripts\appevents.csv"
Andrew