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

  • Home
  • SEARCH
  • 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 945295
In Process

The Archive Base Latest Questions

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

As an exercise in both writing Windows Services and communicating with them, I’ve decided

  • 0

As an exercise in both writing Windows Services and communicating with them, I’ve decided I want to try and write a service to monitor hardware performance on my machine, record it and report on it daily. I want to be able to query the service remotely and from researching this a little, I think I could embed a ServiceHost in there.

How does a service actually run? The examples I’ve found have all been, OnStart..OnStop, ServiceHost.Run( ) and that’s it. Does a process run indefinitely, do I have to write a loop somewhere that constantly checks things?

Also, is it realistic to monitor windows machines using WMI through a service to report on disk space, IO and memory usage? From what I’ve read they’re not the fastest and as I see it, my service would have a polling interval and check certain statistics every couple of minutes or so. Would this adversely affect a machine?

  • 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-15T22:43:47+00:00Added an answer on May 15, 2026 at 10:43 pm

    Have a look at this for an example (and explanation) of how to write a service very similar to what you’re doing (ie repeatedly invoking some functionality).

    To answer your question, you are responsible for doing something to make sure your code runs periodically. You can do this by registering a callback on a timer, or starting a thread that runs in a loop until the OnStop method is called.

    As for monitoring the machine through WMI — the volume of statistics you’re collecting at an interval of every few minutes shouldn’t cause a problem. I’ve seen cases where a lot of data was collected, relatively often, without significant impact.

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

Sidebar

Related Questions

I've been working through Practical Common Lisp and as an exercise decided to write
How do I exercise an action to ensure it redirects to the correct action
This is an exercise for the CS guys to shine with the theory. Imagine
As an exercise for myself, I was translating a sample program into various languages.
As a programming exercise, I've written a Ruby snippet that creates a class, instantiates
As an exercise, I'm translating parts of our large and battle-hardened Delphi-framework to C#.
This is a shameless information gathering exercise for my own book. One of the
I do more and more exercise with Lambda but I do not figure out
The Dragon Book includes an exercise on converting integers to roman numerals using a
I vaguely remember reading about a programming exercise where objects are drawn on the

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.