Re: Please help: Getting REGISTRY info w/ StdRegProv
From: Michael Harris \(MVP\) ("Michael)
Date: 05/20/04
- Next message: Michael Harris \(MVP\): "Re: Windows Script Host"
- Previous message: alanb: "Windows Script Host"
- In reply to: UNoHu: "Please help: Getting REGISTRY info w/ StdRegProv"
- Next in thread: UNoHu: "Re: Please help: Getting REGISTRY info w/ StdRegProv"
- Reply: UNoHu: "Re: Please help: Getting REGISTRY info w/ StdRegProv"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 19 May 2004 19:39:28 -0700
> I'm building a script for software inventory purposes. I've use
> Torgeir's script to get "DisplayName"s from the registry with no
> problems and needed to get more info so, after a lot of digging, the
> resulting script is below. The output is confusing me. I'm thinking
> that 'aryValueNames' and 'aryValueTypes' are either not being created
> properly or not being read properly (out of sync). I'm not exactly
> sure what is going on as I am fairly new to vbscript and wmi. Below
> the script is a small portion of the results.
Here's a generic working example that I posted to the NGs back in May 2002.
I'll leave it to you to determine how what you are doing is different from
the example ;-)...
const HKCR = &H80000000 'HKEY CLASSES ROOT
const HKCU = &H80000001 'HKEY CURRENT USER
const HKLM = &H80000002 'HKEY LOCAL MACHINE
set reg = getobject("winmgmts:root\default:StdRegProv")
hive = HKLM
'key = "software\microsoft\windows script host\settings"
key = "software\microsoft\windows nt\currentversion"
rc = reg.enumvalues(hive,key,valuenames,valuetypes)
for n = 0 to ubound(valuenames)
vname = valuenames(n)
vtype = valuetypes(n)
select case vtype
case 1 'reg sz
vtype = "[reg_sz]"
reg.getstringvalue hive,key,vname,vvalue
case 2 'reg expand sz
vtype = "[reg_expand_sz]"
reg.getexpandedstringvalue hive,key,vname,vvalue
case 3 'reg binary
vtype = "[reg_binary]"
reg.getbinaryvalue hive,key,vname,vvalue
for x = 0 to ubound(vvalue)
vvalue(x) = "0x" & right("0" & hex(vvalue(x)),2)
next
case 4 'reg dword
vtype = "[reg_dword]"
reg.getdwordvalue hive,key,vname,vvalue
case 7 'reg multi sz
vtype = "[reg_multi_sz]"
reg.getmultistringvalue hive,key,vname,vvalue
case else 'unsupported type
vtype = "[unsupported type]"
vvalue = ""
end select
if isarray(vvalue) then
wscript.echo vname,vtype,"=",join(vvalue,"; ")
else
wscript.echo vname,vtype,"=",vvalue
end if
next
-- Michael Harris Microsoft.MVP.Scripting Sammamish WA US
- Next message: Michael Harris \(MVP\): "Re: Windows Script Host"
- Previous message: alanb: "Windows Script Host"
- In reply to: UNoHu: "Please help: Getting REGISTRY info w/ StdRegProv"
- Next in thread: UNoHu: "Re: Please help: Getting REGISTRY info w/ StdRegProv"
- Reply: UNoHu: "Re: Please help: Getting REGISTRY info w/ StdRegProv"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|