Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

RegRead with spaces in keypath

Posted on 2010-09-16
3
Medium Priority
?
1,282 Views
Last Modified: 2012-05-10
Hey experts,

I am using RegRead in order to read a value from the registry from a VBScript. The problem is that the keypath that I am using has a key named VB and VBA Program Settings in it, obviously having spaces in it.  I keep getting the error "Invalid root in registry key". I tried my script with a keypath that did not have a space in any of the names and it worked successfully.  I have tried using literal quotes by putting """keypath""" but that still produces the same error.

Any ideas on how I can get this to work?
0
Comment
Question by:jonathan_hills
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
Procastin8or earned 2000 total points
ID: 33695393
I tried reading a registry key with a blank in it using a different method and it worked. I don't if this method would work for you or not. If not, you could try setting your path to a variable and using that variable with regread.


const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set StdOut = WScript.StdOut
 
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_ 
strComputer & "\root\default:StdRegProv")
 
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\Security"
strValueName = "SecurityLevel"
oReg.GetExpandedStringValue HKEY_LOCAL_MACHINE,strKeyPath,_
strValueName,strValue
 
wscript.echo  "The Windows logon UI host is: " & strValue

Open in new window

0
 
LVL 2

Expert Comment

by:Procastin8or
ID: 33695402
0
 

Author Comment

by:jonathan_hills
ID: 33695589
Thanks for the help it worked like a charm. I don't really know why mine before wasn't working, it was quite similar.
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome, welcome!  If you are new to the series and haven't been following along, please take a brief moment to review the first three installments: Part 1 (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/A_266-VBScri…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question