Solved

Adding Registry Key via VBS

Posted on 2004-08-16
1
464 Views
Last Modified: 2008-02-26
I am trying to add a "mydomain" registry key under HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\INTERNET SETTINGS\ZONEMAP\DOMAINS
however the following code does not seem to work. Can  anyone point me in the right direction?

sComputer      = "."
sMethod            = "CreateKey"
hTree            = HKEY_LOCAL_MACHINE
sKey            = "SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\INTERNET SETTINGS\ZONEMAP\DOMAINS\mydomain"


Set oRegistry      = GetObject("winmgmts:{impersonationLevel=impersonate}//" & _
            sComputer & "/root/default:StdRegProv")

Set oMethod      = oRegistry.Methods_(sMethod)
Set oInParam      = oMethod.inParameters.SpawnInstance_()

oInParam.hDefKey       = hTree
oInParam.sSubKeyName      = sKey

Set oOutParam      = oRegistry.ExecMethod_(sMethod, oInParam)
0
Comment
Question by:gbarrientos
[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
1 Comment
 
LVL 6

Accepted Solution

by:
microbolt earned 500 total points
ID: 11814908
Add this line to the top of your VBS script and it should work :)

HKEY_LOCAL_MACHINE = &H80000002
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
groupSum6 challenge 6 114
Apps blocked by Java 9 97
Output in PHP throwing alignment of data off issue 12 55
Documenting and diagramming code flow within a VBA Excel project 5 49
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…

761 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