Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RegRead and \device\video0

Status
Not open for further replies.

warrendlr

IS-IT--Management
May 28, 2002
7
0
0
GB
Hi !

I am trying to read the registry key "\Device\Video0" located in "HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\VIDEO", but, as it begins with a "\", the command

oWSHShell.RegRead("HKLM\HARDWARE\DEVICEMAP\VIDEO\\Device\Video0")

produces an error "Invalid root in registry key ..."

I tried almost all variations (with one, two or three "\") with no success.

Anyone can help ?
 
The problem appears to be that REGREAD thinks that Device is a key, you could try running the regedit command to export it to a file and then read it from there

Regedit /e c:\temp.reg Hkey_Local_Machine\Hardware\DeviceMap\Video

All of the above is on one line

this will give you a .reg file that you could read in.
Regards
Steve Friday
 
Finally I found the code that does it, it was available on Technet scripting.

const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set StdOut = WScript.StdOut

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

strKeyPath = "HARDWARE\DEVICEMAP\VIDEO"
strValueName = "\Device\Video0"
oReg.GetExpandedStringValue HKEY_LOCAL_MACHINE,strKeyPath,_
strValueName,strValue

msgbox "The Video0 Valueis : " & strValue

Regards
Steve Friday
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top