Advertisement
Guest User

Untitled

a guest
Oct 16th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. Workflow Get-EventlogRemote {
  2.  
  3. InlineScript {
  4. $logger = "Application", "Security", "System"
  5. $username = "administrator"
  6. $password = "passord"
  7. $password = ConvertTo-SecureString -AsPlainText $password -Force
  8. $credentials = New-Object System.Management.Automation.PSCredential `
  9. -ArgumentList $username, $password
  10. $computers = "1.1.1.1", "2.2.2.2"
  11.  
  12. For ($i = 0; $i -le $computers.Length - 1; $i++) {
  13. Write-Host "`n`n`n`t`tMASKIN $($computers[$i])`n" -ForegroundColor Yellow
  14.  
  15. Invoke-Command `
  16. -ComputerName $computers[$i] `
  17. -Credential $credentials `
  18. -ScriptBlock {
  19. $logger = "Application", "Security", "System"
  20.  
  21. For ($i = 0; $i -lt $logger.Length; $i++) {
  22.  
  23. "`n`t`tEventlog for $($logger[$i])`n"
  24. Get-EventLog -LogName $logger[$i] `
  25. -Newest 10 `
  26. -ErrorAction SilentlyContinue
  27.  
  28. }
  29. }
  30. }
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement