I need a script which will add a certain registry key to my test computer.

S

Spin

Experts,

I need a script which first deletes a certain registry key, then adds a new
key into it's place. I am an administrator of this computer. Running
Windows Server 2003 SP1. Path to key is below. The key name is
MSExchangeDSAccess.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSExchangeDSAccess

While I know how to import/merge a new key silently onto a computer using
regedit /s, I do not know how to delete a just specific key only (which is
the first part of my script.
 
N

Nightowl

Spin said:
Experts,

I need a script which first deletes a certain registry key, then adds a new
key into it's place. I am an administrator of this computer. Running
Windows Server 2003 SP1. Path to key is below. The key name is
MSExchangeDSAccess.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSExchangeDSAccess

While I know how to import/merge a new key silently onto a computer using
regedit /s, I do not know how to delete a just specific key only (which is
the first part of my script.

Hello Spin

To delete a key you put a minus sign in front of the key name, like
this:

[-HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSExchangeDSAccess]

This will delete that key and all its sub-keys.

To delete a value, you put a minus sign after the equals sign, like
this:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSExchangeDSAccess]
"ThisValueWillBeDeleted"=-

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top