CaussyR
asked on
Windows Event Logs
Hi everyone,
I am trying to return events in the Application log from 00:01 to 02:00 on the same day I run the script below :
Get-WinEvent -ComputerName homePC -FilterHashtable @{LogName='application'; starttime=([datetime]::tod ay.AddDays (-1)); endtime=([datetime]::Today ); id=1007} | format-list * | select MachineName, ID, TimeCreated, Message
The problem I have is I can only get the last 24 hours rather than running the script on the same days and only list the event id:1007 in the past 24 hours rather than just between 00:00 and 02:00.
Can anyone help, please.
I am trying to return events in the Application log from 00:01 to 02:00 on the same day I run the script below :
Get-WinEvent -ComputerName homePC -FilterHashtable @{LogName='application'; starttime=([datetime]::tod
The problem I have is I can only get the last 24 hours rather than running the script on the same days and only list the event id:1007 in the past 24 hours rather than just between 00:00 and 02:00.
Can anyone help, please.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Not sure if I read about it first, or just saw it as an available method for datetime objects (it's been a while). You can use Get-Member to see the properties and methods for an object. Here's a couple examples.
[datetime]::now | gm
get-date | gm
In the first example, a static property is also used. A static method or property is referenced by the type, then a double colon, followed by the property or method. You can see what static methods and properties are available with something like the following.
get-date | gm -static
[datetime]::now | gm
get-date | gm
In the first example, a static property is also used. A static method or property is referenced by the type, then a double colon, followed by the property or method. You can see what static methods and properties are available with something like the following.
get-date | gm -static
ASKER
Thank you for all your help FooTech.
ASKER