All,

I am trying to get the registry value for a key that has REG_NONE value
(HKCU\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\EXPLORER\ICONUNDERLINE).
I have tried using regread and wmi's stdRegProv and both gave me an
error when running it. Anyone with a code that will read this value
and display it? TIA!!

Re: REG_NONE by Scott

Scott
Wed May 25 19:39:18 CDT 2005

I don't think that this is supported currently in WMI. You can obtain the
type of these values (0 for the REG_NONE data type) via the EnumValues
method though.

--
Scott McNairy
Microsoft MVP - Windows Server Management Infrastructure


<tolam1@gmail.com> wrote in message
news:1117041368.608553.298660@g44g2000cwa.googlegroups.com...
> All,
>
> I am trying to get the registry value for a key that has REG_NONE value
> (HKCU\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\EXPLORER\ICONUNDERLINE).
> I have tried using regread and wmi's stdRegProv and both gave me an
> error when running it. Anyone with a code that will read this value
> and display it? TIA!!
>



Re: REG_NONE by Torgeir

Torgeir
Thu May 26 15:16:07 CDT 2005

tolam1@gmail.com wrote:

> I am trying to get the registry value for a key that has REG_NONE value
> (HKCU\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\EXPLORER\ICONUNDERLINE).
> I have tried using regread and wmi's stdRegProv and both gave me an
> error when running it. Anyone with a code that will read this value
> and display it? TIA!!
Hi,

Script below works for me (using HKEY_LOCAL_MACHINE instead of
HKEY_CURRENT_USER because I had the IconUnderline value only under
HKEY_LOCAL_MACHINE).


'--------------------8<----------------------

Const OpenAsASCII = 0
Const FailIfNotExist = 0
Const ForReading = 1

sKeyPath = _
"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer"

sTextToLookFor = """IconUnderline""=hex(0):"

Set oShell = CreateObject("WScript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")

' get a temporary registry file name
sTempFile = oFSO.GetSpecialFolder(2).ShortPath & "\" & oFSO.GetTempName

' export the registry key to a file
sCmd = "regedit.exe /S /E:A """ & sTempFile & """ " & """" & sKeyPath & """"
oShell.Run sCmd, 0, True

Set fFile = oFSO.OpenTextFile(sTempFile, ForReading, _
FailIfNotExist, OpenAsASCII)

sValue = ""

'Parse the text file
Do While Not fFile.AtEndOfStream
sLine = fFile.Readline

If LCase(Left(sLine, 71)) = LCase("[" & sKeyPath & "\") Then
' we have reached a subkey, time to bail out
Exit Do
End If

If LCase(Left(sLine, 23)) = LCase(sTextToLookFor) Then
sValue = Mid(sLine, 24)
Exit Do
End If

Loop

fFile.Close

' delete temp file
oFSO.DeleteFile sTempFile

If sValue <> "" Then
WScript.Echo "Value is: " & sValue
Else
WScript.Echo "No value found"
End If

'--------------------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/scriptcenter/default.mspx