Skip to content

Instantly share code, notes, and snippets.

@ochoto
Created June 19, 2014 12:09
Show Gist options
  • Save ochoto/1cec5db23668708fdd98 to your computer and use it in GitHub Desktop.
Save ochoto/1cec5db23668708fdd98 to your computer and use it in GitHub Desktop.
Trabajo con log de eventos y sesiones remotas
$maquinas = (1..10).ForEach{ "CURSOPS" + "{0:D2}" -f $_ }
$hace24h = (get-date).AddHours(-24)
Get-EventLog -LogName System -After $hace24h -EntryType Error,Warning -ComputerName $maquinas|select *|Out-GridView
$mexc = "CURSOPS02","CURSOPS03"
$sess = New-PSSession -ComputerName ($maquinas.Where{$mexc -notcontains $_})
$sess.ForEach{ Invoke-Command -Session $_ -ScriptBlock { dir c:\ } } |sort PSComputerName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment