Invalid root in registry error

Posted on 2013-10-18
Medium Priority
Last Modified: 2013-10-30

Some machines at my location have dhcp configured but their DNS servers are static.  I found a script this is trying to read which network interfaces have dynamic dns servers set verses staticly configured ones by drilling down to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\ and iterating through the keys looking for "nameserver" values.

This script runs as expected on my local machine. When I enter a remote system I get the "invalid root in registry" error.

 The interesting thing is that the error message give me the path on the remote system.  I can tell because the output shows the remote systems NIC GUID.

Here is the script:

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set WshShell = WScript.CreateObject("WScript.Shell")
DNSserv= ""
Regkey = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\"

Set IPDevSet = objWMIService.ExecQuery _
("Select SettingID from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")

For Each IPDev in IPDevSet

str =  Regkey & IPDev.SettingID & "\NameServer"

out= WshShell.RegRead(str)
wscript.echo out

Any thougths?

Question by:mcalo1
LVL 65

Accepted Solution

RobSampson earned 400 total points
ID: 39584358
Hi, you need to use the StdRegProv WMI namespace. The RegRead method doesn't support remote systems, so it's trying to read the remote path on your computer.  Look up the GetStringValue method on MSDN for an example.



Author Closing Comment

ID: 39611642
thanks for the help Rob.


Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Script to copy or move mouse-selected collection of files plus targets referenced by shortcuts (.lnk) The purpose of this article is to help illuminate the real challenges and options available (where they may exist) for utilizing simple scriptin…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
When you have multiple client accounts to manage, it often feels like there aren’t enough hours in the day. With too many applications to juggle, you can’t focus on your clients, much less your growing to-do list. But that doesn’t have to be the cas…

607 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