Re: Reding a DWORD value with WMI

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Torgeir Bakken \(MVP\) (Torgeir.Bakken-spam_at_hydro.com)
Date: 06/15/04


Date: Wed, 16 Jun 2004 00:00:38 +0200

poget wrote:

> I have tried unsiccessfuly to find out the value of the ExplorerFlags key
> which can be 16 or 34 (decimal).
> Incidentally where can I find the Const values for the Registry Hives?
> TIA
> Phil
>
> Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &
> _ strComputer & "\root\default:StdRegProv")
>
> strKeyPath = "HKCR\Folder\shell\open"
> strValueName = "ExplorerFlags"
> oReg.GetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue
> WshShell.PopUp dwValue ' doesn't even show up!
Hi

Here is an updated/corrected version of your script
(returns the value 18 for me):

'--------------------8<----------------------
Const HKCR = &H80000000
Const HKCU = &H80000001
Const HKLM = &H80000002

strComputer = "." ' use "." for local computer"

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

strKeyPath = "Folder\shell\open" ' do not add the hive name in front here
strValueName = "ExplorerFlags"
oReg.GetDWORDValue HKCR, strKeyPath, strValueName, dwValue
WScript.Echo dwValue
'--------------------8<----------------------

-- 
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/community/scriptcenter/default.mspx


Relevant Pages

  • Re: Regular Expressions
    ... Const OpenAsASCII = 0 ... Set oFSO = CreateObject ... bCheckForG1AtNextLoop = False ' init value ... torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway ...
    (microsoft.public.inetsdk.programming.scripting.vbscript)
  • Re: Get & Set Services status per script ?
    ... Const OpenAsASCII = 0 ... sComputer = oWshNet.ComputerName ... On Error Goto 0 ... torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway ...
    (microsoft.public.scripting.vbscript)
  • Re: Disconnect user after closed IE
    ... ' will ' actually end up as a forced shutdown (a bug in the WMI ... use "Logoff" instead of "Logoff_Force". ... Const EWX_SHUTDOWN = 1 ... -- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.scripting.wsh)
  • Re: Remove Blank Line and/or Additional CRLF From End of File
    ... > per line Lawson extract file, so it can be imported into our check writing ... Const OverwriteIfExist = -1 ... Dim fso, strFiles, strSourceFile, strOutputFile, strOutputLine ... -- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.scripting.vbscript)
  • Re: Randomising a text file
    ... > it and overwrite the original? ... Const OpenAsASCII = 0 ... Dim arOut ... -- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.scripting.vbscript)