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?