Registry Find and Replace a DWORD value Script...

I am looking to create a batch file or something of the sort to do a find an replace on one particular DWORD value in a Windows 2003 registry.  I have tried using regfind.exe, but it keeps throwing exceptions and errors.  The DWORD value is in the HKCU-Software-Enterprise Vault-Client-(Folder that changes name per user).  The name of the value is OVRootDirectory.  I thought this would be rather simple, and am either missing something, or it truly isn't.  All help is always appreciated!!
LVL 3
fpcitAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

fpcitAuthor Commented:
Oh, and the value of the key is not the same per user either, so I can't find and replace based off of that value either...  
Bill PrewIT / Software Engineering ConsultantCommented:
Try the following at a command prompt and see if it gives you a list of the matches that you would then want to change.  If so we can work it into a BAT script.

reg query HKCU\Software\Enterprise Vault\Client /s /f "OVRootDirectory"

~bp
Bill PrewIT / Software Engineering ConsultantCommented:
Sorry, since there are spaces in the registry path we need to do:

reg query "HKCU\Software\Enterprise Vault\Client" /s /f "OVRootDirectory"

~bp
Announcing the Winners!

The results are in for the 15th Annual Expert Awards! Congratulations to the winners, and thank you to everyone who participated in the nominations. We are so grateful for the valuable contributions experts make on a daily basis. Click to read more about this year’s recipients!

fpcitAuthor Commented:
That query return an invalid syntax error.  I'm not familiar with the command, so if you have a further suggestion...  :-)
fpcitAuthor Commented:
OK, on the corrected syntax...  I received Error: The system was unable to find the specified registry key or value.  
Bill PrewIT / Software Engineering ConsultantCommented:
Can you do the following and then post the reg.txt file up here please:

reg query "HKCU\Software\Enterprise Vault\Client" /s

~bp
Bill PrewIT / Software Engineering ConsultantCommented:
Sorry, my bad, rushing a bit today, meant to do:

reg query "HKCU\Software\Enterprise Vault\Client" /s>reg.txt

~bp
fpcitAuthor Commented:
See what happens when you include ALL of the hive subfolders...  You get a valid response!  :-)  When I originally posted, I missed the subfolder KVS in my typing.  Shame on me.  Your original post did find 1 match.  :-)  Where do we go from here is the next question!!  Thanks again!

HKEY_CURRENT_USER\Software\KVS\Enterprise Vault\Client\F4FA290C1ED2014D9DD0D4DA1
F13E70F
    OVRootDirectory    REG_SZ    n:\

End of search: 1 match(es) found.
Bill PrewIT / Software Engineering ConsultantCommented:
Ah, great.

So, I assume you want to change the value of that key from something to something?  From what, to what?

~bp
fpcitAuthor Commented:
From whatever it is currently to n:\   The value changes from user to user, but for these two particular servers, they all need to read N:\  Is it possible to do this with that variable?
Bill PrewIT / Software Engineering ConsultantCommented:
Give this a try, I think it should do what you want.

~bp
@echo off
for /F "tokens=*" %%A in ('reg query "HKCU\Software\KVS\Enterprise Vault\Client" /s /f "OVRootDirectory" ^| find /I "Enterprise Vault"') do (
  reg add "%%~A" /v OVRootDirectory /t REG_SZ /d n:\ /f
)

Open in new window

fpcitAuthor Commented:
This was what was returned:

M:\>@echo off
for /F "tokens=*" %%A in ('reg query "HKCU\Software\KVS\Enterprise Vault\Client"
 /s /f "OVRootDirectory" ^| find /I "Enterprise Vault"') do (
%%A was unexpected at this time.
  reg add "%%~A" /v OVRootDirectory /t REG_SZ /d n:\ /f
ERROR: Invalid key name.
Type "REG ADD /?" for usage.
)
Bill PrewIT / Software Engineering ConsultantCommented:
Did you save that as a file, with a BAT extension, like maybe OVROOT.BAT, and then execute the BAT file from a command prompt like:

OVROOT

~bp

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
fpcitAuthor Commented:
LOL!!!  I'm sorry.  I am having one of those off days...  I've been looking at code and DOS prompts for WAY tool long today.  That worked beautifully!  Now I just have to piece everything else together, and I will have a permanent solution for our issue.  Your help has been invaluable!!!  Thank you for everything (especially your patience) bp!
fpcitAuthor Commented:
Fantastic work!  Exceptionally fast responses, and resolution to a problem that has been haunting me, and holding back a major project for weeks!  I wish I would have asked the question sooner!
Bill PrewIT / Software Engineering ConsultantCommented:
Great, glad we got something useful, my pleasure.

~bp
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Citrix

From novice to tech pro — start learning today.