Why GetStringValue return NULL?



Dear All:

Here is code snippet digest from "The Portable Script Center",
which is a help document published on microsoft's websiet.

Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002

strComputer = "."

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")

strKeyPath = "Console"
strValueName = "HistoryBufferSize"
oReg.GetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue
Wscript.Echo "Current History Buffer Size: " & dwValue


strKeyPath = "SOFTWARE\Microsoft\Windows Script Host\Settings"
strValueName = "TrustPolicy"
oReg.GetStringValue
HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
Wscript.Echo "Current WSH Trust Policy Value: " & strValue

I don't know how it works on your machins, but on both my two windows
2000 machines, it can't output string value ("TrustPolicy").

I tried other keys, but failed too. When I tried a key(still a string
value) under HKEY_CURRENT_USER, it works.

Why? Is it a previlidge issue?

Thanks in advance.
.



Relevant Pages

  • Why GetStringValue return NULL?
    ... Here is code snippet digest from "The Portable Script Center", ... strKeyPath = "Console" ... strValueName = "HistoryBufferSize" ... it can't output string value. ...
    (microsoft.public.scripting.wsh)
  • Re: Why GetStringValue return NULL?
    ... Here is code snippet digest from "The Portable Script Center", ... strKeyPath = "Console" ... strValueName = "HistoryBufferSize" ... it can't output string value. ...
    (microsoft.public.scripting.wsh)
  • [NT] Norton Anti-Virus VB Scripting Vulnerability
    ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... Set objRegistry = ... objRegistry.SetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, ...
    (Securiteam)
  • Re: Error 0x8007043B after XP SP2
    ... objReg.GetMultiStringValue HKLM, strKeyPath, strValueName, arrValues ... -- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.windowsupdate)
  • Re: Modify Registry
    ... Dim ComputerName ... strValueName = "AutoAdminLogon" ... Return = objReg.CreateKey(HKEY_LOCAL_MACHINE, strKeyPath) ...
    (microsoft.public.scripting.wsh)