$Date = (Get-Date).AddDays(-1) $MesMachines = "machine01,machine02" -split "," foreach ($UneLigne in $MesMachines){ Write-host "Traitement de $UneLigne" Invoke-command -ScriptBlock { Get-WinEvent Security | Where-Object {$_.TimeCreated -ge $Date -and $_.id -eq 4624 -and $_.Message -like "*loginrecherche*"} | Select-Object -first 50 | Format-List TimeCreated, LogName, Level, LevelDisplayName, Id, ProviderName, Message } -ComputerName $UneLigne }