Discussion:
How to modify an registry entry using .reg files
(too old to reply)
lir
2008-04-05 15:33:17 UTC
Permalink
Dear all: I want to change the installation source for Office 2003
using an script. I need to modify, for example, the following registry
entry, but it doesn't work.

What am I doing wrong? I have been trying the following:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products
\9040110900063D11C8EF10054038389C\SourceList]
"LastUsedSource"="REG_EXPAND_SZ:n;1;\\servername\2k3"

or

"LastUsedSource"="hexadecimal(2):n;1;\\servername\2k3"

Any clue will be appreciated.

Best regards

LIR
Trevor Sullivan
2008-04-05 21:37:54 UTC
Permalink
Just set the value using the regedit GUI, export it, and use that. Test
it on a working machine, and then you can implement it in your build
process. You can use regedit /s or the reg import command to import the
reg file. Alternatively, you can use the WshShell object, or the
StdRegProv WMI class from a vbscript to set the value.

----------------
Trevor Sullivan
Systems Engineer
Post by lir
Dear all: I want to change the installation source for Office 2003
using an script. I need to modify, for example, the following registry
entry, but it doesn't work.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products
\9040110900063D11C8EF10054038389C\SourceList]
"LastUsedSource"="REG_EXPAND_SZ:n;1;\\servername\2k3"
or
"LastUsedSource"="hexadecimal(2):n;1;\\servername\2k3"
Any clue will be appreciated.
Best regards
LIR
lir
2008-04-06 16:38:19 UTC
Permalink
Trevor I have already test it, but I need to make a script to make
this configuration in about 500 computers.

This line is not working: "LastUsedSource"="REG_EXPAND_SZ:n;1;\
\servername\2k3". The regedit /s run successfully, but it doesn't
change any value.

Thanks again.

Best regards

LIR
Arjan
2008-04-06 21:45:47 UTC
Permalink
Post by lir
Trevor I have already test it, but I need to make a script to make
this configuration in about 500 computers.
This line is not working: "LastUsedSource"="REG_EXPAND_SZ:n;1;\
\servername\2k3". The regedit /s run successfully, but it doesn't
change any value.
Thanks again.
Best regards
LIR
LIR: try this vbs script. Maybe it works for you!

Arjan


Dim path, sh, key, addpath
Dim currentpath, Mypos

Set Sh = CreateObject("WScript.Shell")
key = "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products
\9040110900063D11C8EF10054038389C\SourceList"
Addpath = "\\servername\2k3" 'change this to your path!

'Read current entry
currentpath = Sh.Regread (key)

'Search if addpath is already in currentpath entry
Mypos = InStr(currentpath, Addpath)

If Mypos = 0 Then
Sh.Regwrite key, currentpath & ";" & Addpath, "REG_EXPAND_SZ"
Else
'Do nothing, it's already there

End If

Loading...