Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 926661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:43:14+00:00 2026-05-15T19:43:14+00:00

Caveat: Without spiking the cpu while a Get-WmiObject call parses the whole event log

  • 0

Caveat: Without spiking the cpu while a Get-WmiObject call parses the whole event log to match my specified filter.

Situation: I am working on a script that remotely runs some checks, then reboots a pc. I want it to check the health once the server reboots (after sleeping for some time) to make sure services that were supposed to start did. I’ve been running into “Automatic” services that start and then shut down (as intended) but then my current version picks them up as failed if they’ve already run. It was suggested that I check the event log for “Service Control Manager” errors, and report on those, the only problem now is that with the below script, we have servers who’s event log can range anywhere from 20K to several hundred thousand events, and on a 2k server with 20K, this takes roughly 20 seconds to complete, and the cpu pegs near 100% while it’s running.

I’m still learning powershell/wmi, so any advice would be appreciated.

function Check_Startup_Events {
    BEGIN {
        $time = [System.Management.ManagementDateTimeConverter]::ToDmtfDateTime((Get-Date).AddMinutes(-15))
    }
    PROCESS { 
        $results = Get-WmiObject Win32_NTLogEvent -computername $_ -Filter "LogFile='System' and SourceName='Service Control Manager' and TimeGenerated>='$time' and EventType=1" |
            Format-Table -Autosize EventCode, Message
        $results
    }

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T19:43:15+00:00Added an answer on May 15, 2026 at 7:43 pm
    $results = Get-EventLog -ComputerName w2kserver -LogName System -After $time
    foreach ($result in $results){
    if ($result.Source -eq "Service Control Manager" -and $result.EntryType -eq "Error"){
    Write-Host $_.Description}}
    

    I ran this against a 60k big event log on a W2K server in our environment. It takes a while to run but runs locally and does not tax the server. Not sure how you would want to output the data but I think Get-EventLog will do what you want.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Caveat: I'm relatively new to coding as well as TextMate , so apologies if
How do you tell if caps lock is on using JavaScript? One caveat though:
How do you re-size a black and white image without any smoothing affect? I
Will this robots.txt file only allow googlebot to index my site's index.php file? CAVEAT,
I'm building a Silverlight application and one of my caveats from last time was
I know Java well. Which caveats and resources will help me cross to the
The title pretty much says it all. Some caveats are: I need to be
The GNU Scientific library has a multi-dimensional function minimization framework. However, its caveats explicitly
I'm looking for a way to determine if a Flash movie is visible within
I have a SVN structure like this: /Projects /Project1 /Project2 /someFolder /Project3 /Project4 I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.