I am trying to run the following script
$citrixServers = @('server1', 'server2' , 'server3')
$time = (get-date).AddDays(-16)
foreach ($citrixServer in $citrixServers) {'System' , 'Security' , 'Application'| ForEach-Object {Get-WinEvent -computerName $citrixServer –FilterHashtable @{logname= $_; starttime=$time}} | Export-Csv -Path 'd:\scripts\$citrixServer'EventLogs'}
This is creating the first csv file with server1's names and logs but is not moving on to the second servers name. The script does not stop running however it just seems like it stalls out.
Ideally the script will create individual csv files with the event logs for each server. I feel like I am missing something simple here