Jump to content
MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. ×

removing registry keys using a batch file


stinkywea
 Share

Recommended Posts

Here's the situation...

My company is upgrading to symantec client security 2.0. This includes SAV 9.X. Here's the problem. We have around 115 machines that run SAV 8.X and when we try to upgrade we get an error message and the installation kicks. We are doing our installs via a logon script in W2K server active directory situation. After talking with Symantec's tech support they gave me two registry keys that need deleted. So what I need to know how to do is to remotely remove registry keys via a batch file. I'll put what code I think will work. Please give me some feedback.

REM == CHECKS TO SEE IF TEXT FILE HAS BEEN COPIED TO STOP LOOP OF INSTALLATION

IF EXIST c:\stop.txt GOTO END

REM == COPIES TEXT FILE TO PREVENT INSTALLATION LOOPS

copy \\be_exch_rke\software\stop.txt C:\

REM == REMOVE EXISTING SYMANTEC VERSION 8.X TO ALLOW UPGRADE TO 9.X

\windows\regedit.exe /D "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products\497CA84818B8A04418EA464733D75B72"

\windows\regedit.exe /D "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\UpgradeCodes\20A7FB42A06BB49448A397B3CB77ED4D"

REM == INSTALLS SYMANTEC CLIENT SECURITY VERSION 9.0.1.1000

msiexec /fvamus "\\be_exch_rke\Software\scs201_mr1a_scf_b1007_cd4\CD4\SCSClnt\symantec client security.msi"

Link to comment
Share on other sites


I think that you'll need to switch user (runas) at that point because users don't have rights to delete reg keys. Maybe you should also check "REG DELETE /?" because you can force deletion of reg keys without prompt.

Also that errors maybe were generated because users doesn't have administrative rights on system.

Also runas prompts for enter password... Try to find advanced version of runas.

Maybe this hints would help you,

JaCro

Link to comment
Share on other sites

Also, I had similar problems at work. REG DELETE and REG ADD was very helpful for me. Also I updated Office XP SP1 to SP3 with batch file all workstations at work (around 1000 PCs) with modified vbscript that I previously posted.

JaCro

Link to comment
Share on other sites

After talking with Symantec's tech support they gave me two registry keys that need deleted.  So what I need to know how to do is to remotely remove registry keys via a batch file.  I'll put what code I think will work.  Please give me some feedback.

easy job:

to import a string:

REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla]
"CurrentVersion"="1.6"

to delete a string

REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla]
"CurrentVersion"=-

to delete a key

REGEDIT4

[-HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla]

but works only with regedit4-format of reg-files.

to silently use them, type:

regedit /s sample.reg

Link to comment
Share on other sites

what are regedit4 reg files? I was more of a hardware guy that got threw into this...that's why some of it doesn't make too much sense to me. Could you use the code statement that I have posted above to show me the correct syntax.

Thanks!!

Link to comment
Share on other sites

what are regedit4 reg files?  I was more of a hardware guy that got threw into this...that's why some of it doesn't make too much sense to me.  Could you use the code statement that I have posted above to show me the correct syntax. 

Thanks!!

open up your regedit registry-editor, navigate to the appropriate key or string and choose EXPORT. switch file-type to "Win9x/NT4 Regfiles" and click SAVE.

now, you've got a regedit4-file :-)

the first line in these type of reg-files says always "REGEDIT4"

the new w2k-type shows "Windows Registry Editor Version 5.00"

don't ask me what is the difference :-))

Link to comment
Share on other sites

...or you could use this nifty FREEWARE:

http://www.nirsoft.net/utils/nircmd.html

http://www.nirsoft.net/utils/nircmd2.html#using

regdelval 

regdelval [key][value]

Deletes a value from the Registry.

Example:

regdelval "HKEY_CURRENT_USER\Software\Test" "Value1"

To people who already used NirComline, this Nircmd is the new version with MUCH more features.

jaclaz

Link to comment
Share on other sites

...or you could use this nifty FREEWARE:

http://www.nirsoft.net/utils/nircmd.html

http://www.nirsoft.net/utils/nircmd2.html#using

regdelval 

regdelval [key] [value]

Deletes a value from the Registry.

Example:

regdelval "HKEY_CURRENT_USER\Software\Test" "Value1"

To people who already used NirComline, this Nircmd is the new version with MUCH more features.

jaclaz

will that work in a network environment with UNCs?

Link to comment
Share on other sites

will that work in a network environment with UNCs?

No, I don't think so, but I can't see why you can't deploy the .bat file and nircmd to each station and execute it locally.

All in all it is just a matter to pack 'em in a self extracting file and send it across the net.

Another way is to load the HIVE remotely from your PC woth regedit32 and execute it on your PC.

jaclaz

Link to comment
Share on other sites

No, if you deploy the batch file, the file remains the same, but you have to execute it 115 times from 115 different computers.

On the other hand, loading 115 times a hive to your registry, running the bat file, unloading the hive could be more work, but you do not move from your desktop.

I would go for the first option, as it gives you a possibility, while you are actually sitting at one of the 115 to make any needed supplemental check.

jaclaz

Link to comment
Share on other sites

  • 2 weeks later...
open up your regedit registry-editor, navigate to the appropriate key or string and choose EXPORT. switch file-type to "Win9x/NT4 Regfiles" and click SAVE.

now, you've got a regedit4-file :-)

the first line in these type of reg-files says always "REGEDIT4"

the new w2k-type shows "Windows Registry Editor Version 5.00"

don't ask me what is the difference :-))

The difference is that the V5 file is saved in UNICODE whereas the V4 file is saved in ASCII. Makes a difference because some programs cannot handle UNICODE.

Link to comment
Share on other sites

I just found this tool, that could be what you need:

http://hem.passagen.se/zeela/mhsoftware/apps/remreg.html

Remote Registry 1.0

  Download    Register for source 

Copyright © 2000, 2001 Mikael Holm

Remote registry is a program that can insert a .reg file into the registry of any computer in your network. You can use it in two ways, either as a command line utility or as a application with a GUI.

Command line

RemReg [targetcomputer]regfile

If you don't specify a computer the program assumes that it is the local computer you want to use as target. If something goes wrong when the program tries to insert the .reg file it creates a logfile named after the target computer and a timestamp (i.e. MyComputer_2001-01-01_090915.log).

GUI

Start with RemReg without parameters. Then you get a nice little dialog that helps you to enter a computername and choose a .reg file.

jaclaz

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...