Working with the Windows Registry in WSH - Other Value Types
(Page 4 of 4 )
As I’ve mentioned, each registry value type has its own read (Get) and write (Set) method. I’ll show you each of those methods now. Let’s take a look at their syntax.
object.GetExpandedStringValue Root, Path, Value, Variable
object.SetExpandedStringValue Root, Path, Value, Variable
object.GetMultiStringStringValue Root, Path, Value, Array
object.SetMultiStringValue Root, Path, Value, Array
object.GetDWORDStringValue Root, Path, Value, Integer
object.SetDWORDStringValue Root, Path, Value, Integer
The attributes are the same as we’ve been using except for the following: Array is the variable that refers to an array containing each of the multiple strings in order, and Integer is the variable containing an integer.
Conclusion
You can now read, write, and delete from the registry using either the WSH method or the WMI method depending on your needs. No matter what type of scripts you write, being able to work with the Windows Registry can come in pretty handy at times.
These methods may seem a little tough in the beginning, but try using them a little and you’ll pick up on them in no time at all. I use these methods quite frequently in most of my scripts. These are great techniques when creating scripts for multiple systems. The registry can be used to determine all kinds of useful information such as user names and install directories that may be different from one computer to the next.
So have fun with these techniques. Build your scripts with better compatibility and more power. Until next time, keep coding!
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |