/build/static/layout/Breadcrumb_cap_w.png

VB script to delete key value then update it

HI folks

script should work in 2 steps.

1) It should delete values in Browser and Client_Name under HKEY_LOCAL_MACHINE\SOFTWARE\Veritas\NetBackup\CurrentVersion\Config

2) It should update values in  Browser and Client_Name as SERVERNAME under HKEY_LOCAL_MACHINE\SOFTWARE\Veritas\NetBackup\CurrentVersion\Config

 

I am a newbie in vbscript so need spoonfeeding at scripting level. Any help would be much appreciated.


1 Comment   [ + ] Show comment
  • thanks austin. Further addition how can script write logs\errors at location C:\Temp\nbuscript - rookie11 7 years ago

Answers (1)

Posted by: BHC-Austin 7 years ago
4th Degree Black Belt
0

You can use the RegRead,RegWrite,RegDelete methods of the WSCript.Shell object. For example:

Set WshShell = CreateObject("WScript.Shell")
SERVERNAME = "MYSERVER" WshShell.RegDelete "HKLM\SOFTWARE\Veritas\NetBackup\CurrentVersion\Config\Browser"
WshShell.RegDelete "HKLM\SOFTWARE\Veritas\NetBackup\CurrentVersion\Config\Client_Name" myKey = "HKLM\SOFTWARE\Veritas\NetBackup\CurrentVersion\Config\"
WshShell.RegWrite myKey & "Browser",SERVERNAME,"REG_SZ"
WshShell.RegWrite myKey & "Client_Name",SERVERNAME,"REG_SZ" Set WshShell = Nothing

Really, though, there's no need to use the RegDelete, as the RegWrite will overwrite the value. You could also include a RegRead to verify whether or not the values are already up to date

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ