Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Workflow Get-EventlogRemote {
- InlineScript {
- $logger = "Application", "Security", "System"
- $username = "administrator"
- $password = "passord"
- $password = ConvertTo-SecureString -AsPlainText $password -Force
- $credentials = New-Object System.Management.Automation.PSCredential `
- -ArgumentList $username, $password
- $computers = "1.1.1.1", "2.2.2.2"
- For ($i = 0; $i -le $computers.Length - 1; $i++) {
- Write-Host "`n`n`n`t`tMASKIN $($computers[$i])`n" -ForegroundColor Yellow
- Invoke-Command `
- -ComputerName $computers[$i] `
- -Credential $credentials `
- -ScriptBlock {
- $logger = "Application", "Security", "System"
- For ($i = 0; $i -lt $logger.Length; $i++) {
- "`n`t`tEventlog for $($logger[$i])`n"
- Get-EventLog -LogName $logger[$i] `
- -Newest 10 `
- -ErrorAction SilentlyContinue
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement