Questions tagged [get-eventlog]

Get-EventLog is a powershell cmdlet that gets the events in an event log, or a list of the event logs, on the local or remote computers.

Get-EventLog is a powershell cmdlet that gets the events in an event log, or a list of the event logs, on the local or remote computers. Get-EventLog only works against the 'classic' event logs - it is compatible with Windows XP and 2003. It is deprecated.

According to get-eventlog

Get-EventLog uses a Win32 API that is deprecated. The results may not be accurate. Use the Get-WinEvent cmdlet instead.

See also

49 questions
0
votes
2 answers

Powershell Get-EventLog from computers.txt and save data

I have some problems getting EventLog and save data. I am able to get my EventLogs but not logs from network computers. Here is the code I am running: $logFileName = "Application" $path = $MyInvocation.MyCommand.Path +"\Output\" $path =…
cnecrea
  • 1
  • 1
  • 3
0
votes
1 answer

powershell get-eventlog add if more than 5 times

I am using: "%windir%\system32\WindowsPowerShell\v1.0\powershell.exe" $log=Get-EventLog -LogName Security -InstanceID 4625 -After (Get-Date).AddDays(-60); if (($log)) {Write-Output $log[0].Message} ELSE {Write-Output 'WARNING-NoEventFound'} This…
0
votes
1 answer

Export Windows Logs with Precise Time

I am attempting to export Windows logs using the Get-WinEvent Powershell cmdlet. The following will get me the time precision I am looking for, but this only gets me the timestamp. I need to join the timestamp to other columns that include the…
0
votes
2 answers

Storing EventViewerLogs in Excel spreadsheet from Powershell

I want to store the output of: $Application = Get-EventLog -LogName Application | Where-Object {($_.EntryType -like 'Error' -or $_.EntryType -like 'Warning')}; in an excel spreadsheet. I tried doing : $Application | Out-File E:\app.csv; I'm getting…
B21
  • 37
  • 1
  • 9
0
votes
1 answer

Filter EventLog based on date

I am trying to pull out some information from the eventlog through PowerShell based on the date today. So far I have the code below: $today = (Get-Date).ToString("dd/MM/yyyy") Get-EventLog Security | where {$_.EventID -eq 4624} | where…
Mr I
  • 23
  • 6
0
votes
1 answer

Powershell Windows Forms onClick event

I have a Windows forms (in PowerShell), and the form has a button with onclick event but the command in the onclick isn't run. I don't know why, because it can be run sepratley. My sciptblock is…
Norbert Kiss
  • 13
  • 1
  • 4
0
votes
3 answers

Powershell Get-EventLog output issue when logging

I am having an issue with the writing of a get-eventlog function when I'm writing to a TXT file. This is my LogWrite function: #Log Function $Logfile = "..\Logs\$(gc env:computername)_Outlook.log" $Stamp = (Get-Date).toString("yyyy/MM/dd…
0
votes
1 answer

Get-Eventlog - To monitor specific event ID

I have requirement to monitor specific event ID for specific set of workstations. Event ID Monitor : To monitor Specific event ID for specific set of workstations $Workstations = gc c:\NotBackedUp\Workstation.txt foreach ($Workstation in…
M.Mehta
  • 21
  • 1
  • 6
0
votes
1 answer

Powershell Get-EventLog how to strip out Caller Computer Name into a variable

I want to grab the value listed under "Caller Computer Name" and put it in a variable so that I can use it to get the IP address of the computer in another command. This is the code I am using to pull the data: $event= Get-EventLog -LogName Security…
Todd Welch
  • 1,776
  • 2
  • 17
  • 23
0
votes
1 answer

Event Log by date

I am trying to capture log files from a specific date and I am not getting any results no matter how many days I go back. Get-EventLog -LogName Application -EntryType Warning -Source MicrosoftDynamicsNAVClientWebClient | Select Message…
JRN
  • 269
  • 1
  • 3
  • 19
0
votes
1 answer

Powershell Get_EventLog for multiple servers

I'm a SQL DBA, n00b to Powershell, tasked with sysadmin duties at the moment I need to query error logs across my servers for Errors and Warnings. Using my own Google-fu and help from this thread I was able to get this working: $computers =…
Kevin3NF
  • 113
  • 1
  • 8
0
votes
1 answer

Add Filter to Get-EventLog (server side), returning only newest N records

Is there any way to filter event log entries using PowerShell before retrieving them? i.e. Instead of: [string[]]$IgnoredSources = 'SomeValue','SomeOtherValue' Get-Eventlog -LogName $MyLog -ComputerName $MyComputer ` | ?{$IgnoredSources…
JohnLBevan
  • 22,735
  • 13
  • 96
  • 178
0
votes
1 answer

PowerShell - Output Message substring from Event-log after specific character

I need to display the last line from the Event Log message in PowerShell (pretty much everything after the ":". I wasn't able to do this, so the alternative I have is to output the message and a substring. The ":" in my messages is at position…
Peter
  • 378
  • 2
  • 7
  • 20
0
votes
2 answers

Try/Catch block does not actually execute the get-eventlog cmdlet

For some reason, when I try to use the security option, it does not actually execute the get-eventlog cmdlet, but writes it to the screen as though it were quoted. The other logs work without the try catch block, but whenever I set them up with the…
Davidw
  • 127
  • 1
  • 1
  • 10
0
votes
2 answers

Powershell: Split Array to Pairs and Discard if Not Alternating

I've got a Powershell script that uses Get-EventLog to search for events 6005, 6006, and 6008 on remote servers; after a little manipulation, it returns the results in an array. $eventData += Get-EventLog -computerName $server_name -LogName system…
kiwisan
  • 449
  • 6
  • 16