Reading, Writing, Deleting and Renaming Registry Keys in VBScript

Manipulating the registry is one of the most common tasks a Windows system administrator runs into. It can often become a time consuming task. When you have to change a registry setting on hundreds or even thousands of computers, manipulating a particular key or setting can be next to impossible if you had to do it all manually.

So here are a series of subs and functions to help you manipulate the registry from VBScript. It uses “regedit.exe” and it’s “/s” switch to read and write text files formatted as “.reg” files from and to the registry silently. So, obviously, you’ll need to have the regedit.exe in the path system variable (or in the same directory as this script).

One drawback you may encounter about the “RegRead” function is that it pulls registry key recursively throughout the whole key. So if you specify a root key, or a key farther up in the folder structure you could pull back massive amounts of data that you hadn’t intentionally meant to capture. So when you pass the registry key, be as specific as possible when you’re deciding on which key to read with this function.

 

Leave a Comment