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

Posted on 2004-04-16
Last Modified: 2010-04-13
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.
Question by:chrismichalczuk

Expert Comment

ID: 10845482
You can do this using ONLY native commands using NTCmdLib.cmd, the Expert NT/2K/XP/K3 Command Library from

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 (
LVL 83

Accepted Solution

oBdA earned 50 total points
ID: 10846598
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

Expert Comment

ID: 10846813
at the command prompt type reg /?

you could use reg delete in a standard dos batch script.
LVL 95

Expert Comment

by:Lee W, MVP
ID: 12295337
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
LVL 83

Expert Comment

ID: 12332000
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

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Loss of RDP via 4 218
P2V Windows NT/2000 SP4 3 1,812
Remote Desktop Software 6 440
windows 2000 image 3 121
NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
In this article, I show you step by step with screenshots to assist you - HOW TO: Deploy and Install the VMware vCenter Server Appliance 6.5 (VCSA 6.5), with some helpful tips along the way.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now