I recently (and about time too!) put together a tutorial for my WMI module. Naturally enough, I thought I’d tested all the examples. Until Alexander Ludogovski pointed out a flaw in the method example. The example I had (now changed) looped over processes with the name “notepad.exe” and terminated each one. At least that was the idea. As Alexander pointed out, however, what it actually did was to kill the first and bomb out on a error with the second. Unsure of what was going on, I replaced it with a different example (also now changed), this one to restart all autostart services which had stopped. That also failed in a similar way.
For now, since the purpose of the exercise was to illustrate the use of WMI methods, I’ve put an example in place which stops one named service. But I need to track down the cause of the other problems which don’t occur, by the way, if you use “raw” WMI. I’m fairly sure I know where to look, but that’s not necessarily going to make it easy.