PDA

View Full Version : Using batch or script to remove reg values


Brad
November 1st 04, 04:53 AM
Hello, I am looking for a way to batch or script the removal of Registry
values (not keys) in the registry. I need to do it to many desktop PCs. Is
there a good way to do it
Thanks

Shenan Stanley
November 1st 04, 05:59 AM
Brad wrote:
> Hello, I am looking for a way to batch or script the removal of
> Registry values (not keys) in the registry. I need to do it to many
> desktop PCs. Is there a good way to do it

use reg files and put minue (-) in front of the key you want to remove.

--
<- Shenan ->
--
The information is provided "as is", it is suggested you research for
yourself before you take any advice - you are the one ultimately
responsible for your actions/problems/solutions. Know what you are
getting into before you jump in with both feet.

Brad
November 1st 04, 06:34 AM
Thanks I have tried this
REGEDIT4
["hkey_local_machine\software\odbc\odbc.ini\odbc data sources"]
"FMProd"=-
With no luck. FMProd is the value name (of the string?) I do not want to
actually delete the key "odbc data sources"
Have I got this command right?

"Shenan Stanley" wrote:

> Brad wrote:
> > Hello, I am looking for a way to batch or script the removal of
> > Registry values (not keys) in the registry. I need to do it to many
> > desktop PCs. Is there a good way to do it
>
> use reg files and put minue (-) in front of the key you want to remove.
>
> --
> <- Shenan ->
> --
> The information is provided "as is", it is suggested you research for
> yourself before you take any advice - you are the one ultimately
> responsible for your actions/problems/solutions. Know what you are
> getting into before you jump in with both feet.
>
>
>

David Candy
November 1st 04, 10:51 AM
Key names don't have inverted commas.

--=20
----------------------------------------------------------
http://www.uscricket.com
"Brad" > wrote in message =
...
> Thanks I have tried this
> REGEDIT4
> ["hkey_local_machine\software\odbc\odbc.ini\odbc data sources"]
> "FMProd"=3D-
> With no luck. FMProd is the value name (of the string?) I do not want =
to=20
> actually delete the key "odbc data sources"
> Have I got this command right?
>=20
> "Shenan Stanley" wrote:
>=20
>> Brad wrote:
>> > Hello, I am looking for a way to batch or script the removal of
>> > Registry values (not keys) in the registry. I need to do it to many
>> > desktop PCs. Is there a good way to do it
>>=20
>> use reg files and put minue (-) in front of the key you want to =
remove.
>>=20
>> --=20
>> <- Shenan ->
>> --=20
>> The information is provided "as is", it is suggested you research for
>> yourself before you take any advice - you are the one ultimately
>> responsible for your actions/problems/solutions. Know what you are
>> getting into before you jump in with both feet.=20
>>=20
>>=20
>>

Alex Nichol
November 1st 04, 03:21 PM
Brad wrote:

>Hello, I am looking for a way to batch or script the removal of Registry
>values (not keys) in the registry. I need to do it to many desktop PCs. Is
>there a good way to do it

Example registry .reg file to do this:

REGEDIT4

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contro l\Class\{4D36E965-E325-11CE-BFC1-08002BE10318}]
"UpperFilters"=-
"LowerFilters"=-

That deletes the two values UpperFilters and LowerFilters from that key
- setting as =- is taken to imply deletion

Make sure that there is a blank line at the end of the file


--
Alex Nichol MS MVP (Windows Technologies)
Bournemouth, U.K. (remove the D8 bit)

Torgeir Bakken \(MVP\)
November 1st 04, 05:02 PM
Brad wrote:

> Thanks I have tried this
> REGEDIT4
> ["hkey_local_machine\software\odbc\odbc.ini\odbc data sources"]
> "FMProd"=-
> With no luck. FMProd is the value name (of the string?) I do
> not want to actually delete the key "odbc data sources"
> Have I got this command right?
Hi

1)
This should work better:

--------------------8<----------------------
REGEDIT4

[HKEY_LOCAL_MACHINE\software\odbc\odbc.ini\odbc data sources]
"FMProd"=-

--------------------8<----------------------
(note blank line at end)


2)
You can use reg.exe as well (comes builtin with WinXP):

REG.exe DELETE "HKLM\software\odbc\odbc.ini\odbc data sources" /v FMProd /f


3)
With a VBScript:

'--------------------8<----------------------
Set oShell = CreateObject("WScript.Shell")
On Error Resume Next
oShell.RegDelete "HKLM\software\odbc\odbc.ini\odbc data sources\FMProd"
'--------------------8<----------------------




--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx

Brad
November 2nd 04, 01:51 AM
Thanks
That works great

"Torgeir Bakken (MVP)" wrote:

> Brad wrote:
>
> > Thanks I have tried this
> > REGEDIT4
> > ["hkey_local_machine\software\odbc\odbc.ini\odbc data sources"]
> > "FMProd"=-
> > With no luck. FMProd is the value name (of the string?) I do
> > not want to actually delete the key "odbc data sources"
> > Have I got this command right?
> Hi
>
> 1)
> This should work better:
>
> --------------------8<----------------------
> REGEDIT4
>
> [HKEY_LOCAL_MACHINE\software\odbc\odbc.ini\odbc data sources]
> "FMProd"=-
>
> --------------------8<----------------------
> (note blank line at end)
>
>
> 2)
> You can use reg.exe as well (comes builtin with WinXP):
>
> REG.exe DELETE "HKLM\software\odbc\odbc.ini\odbc data sources" /v FMProd /f
>
>
> 3)
> With a VBScript:
>
> '--------------------8<----------------------
> Set oShell = CreateObject("WScript.Shell")
> On Error Resume Next
> oShell.RegDelete "HKLM\software\odbc\odbc.ini\odbc data sources\FMProd"
> '--------------------8<----------------------
>
>
>
>
> --
> torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
> Administration scripting examples and an ONLINE version of
> the 1328 page Scripting Guide:
> http://www.microsoft.com/technet/scriptcenter/default.mspx
>

Google