Scripting Blog

A place to learn about PowerShell and share stories of automation

How Can I Monitor Changes to a Registry Key?

Hey, Scripting Guy! Is it possible to use a script to monitor changes to a registry key? I’d like to be notified any time someone makes changes to the HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run key.-- SB Hey, SB. And by the way, thanks for wording the question the way you did: it’s actually pretty easy to receive ...

How Can I Launch Two Applications, Wait Until One Program Ends, and Then Close the Other?

Hey, Scripting Guy! Here’s what I’d like to do: I want a script that will launch two executable files. After the first application closes I’d like the script to close the second application and then quit. How can I do that?-- MK Hey, MK. You know, this is the kind of question we like. Why? Because it sounds really ...

Why Does My Performance Monitoring Script Keep Returning the Same Incorrect Values?

Hey, Scripting Guy! I’m using a script to monitor process performance, but every time I run the script the percent processor time for all the processes comes out as 0. What am I doing wrong?-- JL Hey, JL. We’ve simplified your script a bit to better illustrate the problem you’re running into. (And don’t feel bad: this is a very ...

How Can I Monitor for Different Types of Events With Just One Script?

  Hey, Scripting Guy! Is there any way to monitor a folder for file creations and deletions, all with just one script? -- HA Hey, HA. By the way, thanks for the question: you temporarily saved us from answering a different question, one that was proving a bit difficult thanks to some surprising differences between Windows XP Service ...

How Can I Be Notified Any Time a Network Cable Gets Unplugged?

Hey, Scripting Guy! Is there a way I can be notified any time a network cable gets unplugged on a computer?-- DD Hey, DD. A lot of people, when growing up, had a grandmother or an aunt or someone somewhere who had a house with a big attic, an attic overflowing with stuff. Admittedly, most of the time you had no idea what you were looking at...

Feedback usabilla icon