Scripting Blog

A place to learn about PowerShell and share stories of automation

Hey, Scripting Guy! Can I Start an Event Based on When a Registry Value Is Changed?

  Hey, Scripting Guy! I need to be notified when a particular registry key value gets changed. The registry value is in the HKEY_LOCAL_MACHINE hive. What I am trying to accomplish is this: I am using a script to install software. After the first piece of software is successfully installed, I want to install a subsequent piece of ...

Hey, Scripting Guy! Can I Format a Portable Drive When It Is Inserted Into a Computer?

  Hey, Scripting Guy! I work with portable USB drives all the time. These are used for backup purposes, for temporary storage, for Sneakernet, and as a means to work with extremely large files that I do not want cluttering up the small hard disk drive on my corporate standard desktop. The problem is that I now have more than a dozen ...

Hey, Scripting Guy! Can I Be Informed When a Portable Drive Is Added by My Computer?

  Hey, Scripting Guy! I would love to be able to write a Windows PowerShell script that will inform me when a portable drive is added to my computer. Do you have ideas you could suggest? -- RC Hello RC, Microsoft Scripting Guy Ed Wilson here. Well it has already been a rather interesting week. I bought a new computer and loaded ...

Hey, Scripting Guy! How Can I Write an Event-Driven Script?

  Hey, Scripting Guy! I have a problem at work. It is not with the pointy-headed boss, but I believe the problem is probably related to him anyway. There is this application that runs on a workstation in our computer room. It is not a client server application, and of course the workstation is not really a server—it is ...

Hey, Scripting Guy! How Can I Back Up a Database’s Data Folder While the Database Is Running?

Hey, Scripting Guy! I have a problem. I am trying to script the backup of a data folder used by our database application. The problem is that as long as the database service is running, the files that are used are locked, and I am unable to copy them. I have found the service that runs the database, and when I use WMI to stop the service, ...