Editing Registry with VBS

Reply

Join Date: Jan 2004
Posts: 468
Reputation: TKS will become famous soon enough TKS will become famous soon enough 
Solved Threads: 18
TKS's Avatar
TKS TKS is offline Offline
Posting Pro in Training

Editing Registry with VBS

 
0
  #1
May 3rd, 2007
I need to add registry keys and replace registry keys inside a vbs script...I started one...and it executes fine. However, I want to append "M:\MLS\bin" portion to the end of the existing key...as you may guess, I don't want to overwrite all my PATH environmental variables...but that is what is happening here:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Dim WSHShell
  2. On Error Resume Next
  3. Set WSHShell = WScript.CreateObject("WScript.Shell")
  4. WSHShell.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters\EnableOpLocks", 0, "REG_DWORD"
  5. WSHShell.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters\EnableOpLockForceClose", 1, "REG_DWORD"
  6. WSHShell.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MRxSmb\Parameters\OpLocksDisabled", 1, "REG_DWORD"
  7. WSHShell.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\Path", "M:\MLS\bin" , "REG_EXPAND_SZ"
  8. WSHShell.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\STATION", 70, "REG_DWORD"
  9. WScript.Quit


So, how does one append to the existing key in this script? Please understand that this is at the very end of a longer vbs script. If this is posted in the wrong forum, please let me known.
Last edited by TKS; May 3rd, 2007 at 5:13 pm. Reason: changed code
My Home Away from Home: Yet Another Linux Blog
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC