There are times during deployments when you may need to manage the registry. For example, finding out what Internet Explorer version the machine is using. Or also, creating keys to run programs at start-up etc. Fortunately, there is a utility class in the ztiUtility.vbs called the oUtility class that can access pre-written functions to help with these issues.
To begin with, create an MDT Scripting Template (as per previous blogs). Then add the custom code below. The code has clever routines to determine the type of data(eg.REG_SZ, REG_DWORD).
To Read a Registry Key.
Dim sRegValue, sRegKey sRegKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Version" sRegValue=oUtility.regread(sregkey) oLogging.CreateEntry "IE Version is " & sRegValue, LogTypeInfo
To Write a Registry Key.
Dim sRegValue, sRegKey, sNewRegValue sRegKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\New Program" sNewRegValue = "C:\Windows\Notepad.exe" sRegValue=oUtility.regWrite(sregkey, sNewRegValue)