• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 150
  • Last Modified:

Working -- Script for Automatically delete a registry key when someone logs on

we have ghosted 60 HDDs with XP and rolled out to users. We have a windows 2k server and have one domain called VBI
Unfortunately our CA - Etrust virus software needed a seperate SID to work correctly via the anti virus admin console so we have to go round to each machine and delete a particular registry key

I thought there must be a better way. If we set up a group in Active Directory called "ETRUST" and add users to this group can we write a script ( i cant) that will delete the key in the registry of the computer that they log onto). I'd remove the people once they've done this.

Can anyone help with the script. I've heard of something called kixscripts but wouldn't know how to put this together.
Chris Michalczuk
Chris Michalczuk
1 Solution
You can do this using ONLY native commands using NTCmdLib.cmd, the Expert NT/2K/XP/K3 Command Library from TheSystemGuard.com.

This library provides three commands for Registry Keys.


The syntax, in a shell script, would be

   CALL \\Server\ReadOnlyShareName\NTCmdLib.cmd /Init /Quiet
   SET "DeleteKey=HKEY_LOCAL_MACHINE\Software\YourKey"
   %.Call% /Unload


Replace "\\Server\ReadOnlyShareName\" with a commonly available share point for all the subject machines.
Replace "HKEY_LOCAL_MACHINE\Software\YourKey" with the complete registry path to the key you want to delete.


            This is a VERY DANGEROUS command!  Be careful and
             MAKE SURE that you have set the DeleteKey variable to
             the correct key.  The subject key, including any subkeys
             and all data will be immediately and irrevocably deleted.


The Expert Library provides over 400 such commands using ONLY what is available in a default installation of Windows NT4SP6a, 2000, XP and Server 2003.

More info at (http://NTCmdLib.com)
Do yourself a *big* favor and leave that registry patching path you're on. Your machine deployment was wrong from the very beginning, and you need to correct this as soon as possible. That will clear out the business with your antivirus software as well.
After ghosting a machine for deployment, you *have* to run Sysprep, if you don't want to run into further problems like you're experiencing now. In your case, go to each machine, remove it from the domain, run sysprep, reboot, finish the mini setup wizard (or provide an answer file).

How to Use Sysprep: An Introduction

Windows XP Service Pack 1 Deployment Tools
at the command prompt type reg /?

you could use reg delete in a standard dos batch script.
Lee W, MVPTechnology and Business Process AdvisorCommented:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
I will leave the following recommendation for this question in the Cleanup topic area:
Accept dean_dodd's comment as answer

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

EE Cleanup Volunteer
First off, I don't want to step on anyone's toes here, and this is certainly not about the points either (as far as I'm concerned, this question can be PAQed with no points refunded), but even though dean_dodd's and jzanette's answer might have been what chrismichalczuk asked for, this is definitely not what he needs.
Manipulating the registry to get a software running that wouldn't work due to an *incorrectly* *installed* operating system is treating a symptom, not the cause; talk about applying heavy make-up to treat measles. Ghosting an NT4/W2k/XP installation without running sysprep will not only lead to software issues like the one described, it will in addition lead to a complete loss of Microsoft's support for these machines.

The Microsoft Policy Concerning Disk Duplication of Windows XP Installations
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

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now