0
votes

Hello i have got a little problem i want to read out the followin reg_key

"hklm\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\"

  1. I try this with the example from microsoft:

    const HKEY_LOCAL_MACHINE = &H80000002
    strComputer = "."
    Set StdOut = WScript.StdOut
    Set oReg=GetObject( _
    "winmgmts:{impersonationLevel=impersonate}!\\" &_ 
    strComputer & "\root\default:StdRegProv")
    strKeyPath = "SYSTEM\CurrentControlSet\Control\CrashControl"
    strValueName = "AutoReboot"
    oReg.GetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
    WScript.Echo "SYSTEM\CurrentControlSet\Control\" _
    & "CrashControl\AutoReboot" _
    & " = " & dwValue
    
  2. Finally changed the keypath "and" value name, when i start the vbs it shown nothing.

  3. Here is my code

    const HKEY_LOCAL_MACHINE = &H80000002
    strComputer = "."
    Set StdOut = WScript.StdOut
    Set oReg=GetObject( _
    "winmgmts:{impersonationLevel=impersonate}!\\" &_ 
    strComputer & "\root\default:StdRegProv")
    strKeyPath = "Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\"
    strValueName = "AUOptions"
    oReg.GetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
    WScript.Echo "AUOptions: " &dwValue
    

can someone help me or give me a tip please ?

Thanks!

Info: OS Win7 x64

1
Evaluate the return code of the WMI method (rc = oReg.GetDWORDValue(HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue)). What is the value of the variable rc after running that statement?Ansgar Wiechers
How is this Windows-Installer related?Christopher Painter

1 Answers

0
votes

That's the difficult way. Even though you don't say what you are doing. Here's an example.

Set Sh = WScript.CreateObject("WScript.Shell")
strNamet1=Sh.RegRead("HKLM\Software\Microsoft\Windows\CurrentVersion\RegisteredOwner")