![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | WMI - Services Good evening! I am back! I am having an issue with the following need (I really need to sit down and learn ADSI and WMI....): Connect to each server in the domain (okay...can do that part all day long!) Look at all of the services on each server (okay...can do that all day long as well) Look for (here comes the problem...) services that have a STARTUP = 'Auto' but a STATE <> 'Paused' and STATE <> 'Started' For any service meeting that criteria restart it (or resume it..) I have absolutely no issues writing the script that meets one of the requirements. The issue is when I put in both... We are trying to accomplish the following: We have management software that monitors services. So, with this management software we can monitor all services which have a startup of 'Auto'. However, this management software is a bit in its infancy and anytime that any of these monitored services finds itself in a 'State' other than 'running' it creates a ticket within our ticketing system. Well, this creates a lot of unnecessary tickets and pretty much floods our system. Additionally, the client - in most cases - can see these tickets. What we are trying to do is to write a WMI script as described at the beginning of this post that will manage this software a bit better. I think that our logic is a bit askew anyway! Let's start with the basics: The State of a Service can be one of the following: Running Stopped Paused Unknown Start Pending Stop Pending Continued Pending Paused Pending So, if we do not want to monitor the services that are running and we do not want to monitor the services that are paused that pretty much leaves Stopped and Unknown and "whatever" pending. Stopped: that we can handle! Unknown: uh, I guess that we could try to restart it...if that does not work then we could try to resume it (those are the only two commands that I know...) What do we do with the others? Me thinks that this is a little bit more involved and that a simple "If it is not started or not paused then restart it" will not suffice? That handles only one, possibly two of six potential situations. Is there anything that we can do for the four "whatever Pending" states? I know that when I manually deal with this (say, for example, after a reboot....) the "Start pending" or "Stop pending" either takes care of itself or doesn't (usually the "doesn't" is what happens and this requires me to kill it!!!!!!!!). I know that this is rather long - winded (go figure) but I hope that (A) many people learn from this post and (B) someone can help me. Again, I am not asking anyone to write this for me (Richard......I really do appreciate it when you do this, but I do need to loose the training wheels at some point!) and would greatly appreciate any and all comments on my thought process and maybe a nudge here and there to get me going! Thanks all! Cary |
My System Specs![]() |
![]() |
| Thread Tools | |
| |