'######################################################## '### Reads a key/value in NT/W2k Registry ### '### ### '### (c) Dirk Pelzer 2004 ### '######################################################## Option Explicit Dim iRet, strValue iRet = ReadReg("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentVersion", strValue) if iRet = 0 Then wscript.echo "Value = " & strValue Else wscript.echo "Error Code: " & iRet end If Function ReadReg (strKey, strValue) ' Returns 0 on success and 1 on error Dim WshShell Set WshShell = WScript.CreateObject("WScript.Shell") On error resume next strValue = WshShell.RegRead(strKey) If err.number <> 0 Then ReadReg = 1 ' Could not read Registry entry Else ReadReg = 0 ' Registry entry read successfully End If On error goto 0 End Function