Register
: :
Login
Home
News
Forums
Scripts
User Groups
Resources
About
Forums
Search
Members
Unanswered
Active Topics
Forums
>
Using PowerShell
>
General PowerShell
Get-Eventlog sloooooow.
Last Post 10 Sep 2010 01:07 AM by
pirrimanson
. 1 Replies.
Sort:
Oldest First
Most Recent First
Prev
Next
You are not authorized to post a reply.
Author
Messages
pirrimanson
New Member
Posts:2
10 Sep 2010 12:19 AM
Hi All!
I'm making a script to look for certain error events in remote servers. I'm following two paths. In the first one, I use something like this:
$events = get-eventlog application -computername $computer -newest 5
$errorevents = $events | where {$_.entryType -match "Error"}
This code is fast, but obviously it's quite far from to produce exact results.
The best code will be something like this:
$events = get-eventlog application -computername $computer -after $yesterday -EntryType "Error"
The problem: it's extremely slooooow. It seems that it's retreving through the network all the application log (it's quite big) to filter the results locally, isn't it?
Any ideas to improve speed?
Thanks in advance.
pirrimanson
New Member
Posts:2
10 Sep 2010 01:07 AM
I've been making some additional tests:
If I try this:
get-eventlog application -computername server01 -after (Get-Date).AddDays(-1) -EntryType "Error" -Source "Windows Server Update Services" -newest 1
It works quite fast ONLY if there are at least one error.
But this lasts almost infinite:
get-eventlog application -computername server02 -after (Get-Date).AddDays(-1) -EntryType "Error" -Source "Windows Server Update Services" -newest 1
The difference? In server02 there aren't errors.
It's there any way to set a timeout for get-eventlog?
You are not authorized to post a reply.
Using PowerShell
--General PowerShell
--Books, Tools, and Videos
--Exchange Server
--Active Directory
--System Center Family
--Non-Microsoft Products
--SharePoint
--SQL Server
--Working with .NET
--Peer Review
--Testing, Testing...
PowerShell Development
--Cmdlet Development
--PSDrive Provider Development
--Hosting the Shell
Looking Ahead
--Using PowerShell v2.0
--Developing for PowerShell v2.0
PowerShellCommunity.org
--Community Announcements and Assistance
--Completely Unrelated
--User Groups
--Community Business
----Suggestion Box
Forums
>
Using PowerShell
>
General PowerShell
Active Forums 4.3
Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2