Link to home
Start Free TrialLog in
Avatar of EEK2
EEK2

asked on

Replace Registry (REG_SZ) keys at first login with current OS name?

Hello,

I need to have a script run (at first login) after a new OS is built that does the following:

1)  Delete the following two REG_SZ keys (located here):

HKLM\Software\VERITAS\NetBackup\CurrentVersion\Config

Keys are:

'Browser' and
'Client_Name'

^^ These two keys contain a text value for the 'old' pre-image OS name

2)  I then need to re-add these keys with the 'new' current system (OS) name (guessing by passing in %COMPUTERNAME% somehow)?

If there is a way to replace the current value of these keys instead of deleting / re-adding that works as well.

Operating Systems this will be used on:

Windows 2003 Server Standard (32-bit and 64-bit)
Windows 2003 Server Enterprise (32-bit and 64-bit)

Thank you in advance!!
Avatar of Gastone Canali
Gastone Canali
Flag of Italy image

:: *** delreg.cmd
@echo off
setlocal
set w=echo.^>^>%temp%\delreg.tmp
if exist %temp%\delreg.tmp del %temp%\delreg.tmp
::registry file creation
%w% Windows Registry Editor Version 5.00
%w%
%w% [HKEY_LOCAL_MACHINE\Software\VERITAS\NetBackup\CurrentVersion\Config]
%w% "Browser"=-
%w% "Client_Name"=-
regedit /s %temp%\delreg.tmp
::end delreg.cmd


:: *** setreg.cmd
@echo off
setlocal
set w=echo.^>^>%temp%\setreg.tmp
if exist %temp%\setreg.tmp del %temp%\setreg.tmp
::registry file creation
%w% Windows Registry Editor Version 5.00
%w%
%w% [HKEY_LOCAL_MACHINE\Software\VERITAS\NetBackup\CurrentVersion\Config]
%w% "Browser"="%COMPUTERNAME%"
%w% "Client_Name"="%COMPUTERNAME%"
regedit  /s %temp%\setreg.tmp
::end setreg.cmd

ASKER CERTIFIED SOLUTION
Avatar of Gastone Canali
Gastone Canali
Flag of Italy image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of EEK2
EEK2

ASKER

Perfect solutions, Canali -- thank you very much.

In terms of the two different options -- would you recommend one as being more resilient than another (i.e. more portable between W2K and W2K3) or is it a wash?

I personally liked the last one because it seemed to achieve the result with less complexity...

Thanks, again.