Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


search registry and make change

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,31698
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> search registry and make change
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 search registry and make change - 3/1/2006 2:59:48 AM   
  ccoll52

 

Posts: 4
Score: 0
Joined: 10/30/2005
Status: offline
Im trying to get the string value of a key and then replace it with another value. I figured out how to enumerate the string value, but I need to change the value to "D" if it is equal to "E".
Any Ideas?

Thanks
 
 
Post #: 1
 
 RE: search registry and make change - 3/1/2006 3:02:25 AM   
  Country73


Posts: 712
Score: 8
Joined: 8/25/2004
From: USA
Status: offline
Post the script that you have put together and we'll see what we can do for you.

(in reply to ccoll52)
 
 
Post #: 2
 
 RE: search registry and make change - 3/1/2006 3:07:26 AM   
  ccoll52

 

Posts: 4
Score: 0
Joined: 10/30/2005
Status: offline
This properly displays the value of the key, but will not change value..

Thanks



Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
   strComputer & "\root\default:StdRegProv")

strKeyPath = "SOFTWARE\Smith Systems\Meditech"
strValueName = "DefaultConnection"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
Wscript.Echo "Current WSH Trust Policy Value: " & strValue
If strValue = E Then
strKeyPath = "SOFTWARE\Smith Systems\Meditech"
strValueName = "DefaultConnection"
strValue = "D"
oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
End If

(in reply to Country73)
 
 
Post #: 3
 
 RE: search registry and make change - 3/1/2006 10:03:45 AM  1 votes
  Country73


Posts: 712
Score: 8
Joined: 8/25/2004
From: USA
Status: offline
If you were to download / look at the Script56.chm (in my sig) you will be able to search for "RegWrite" and it will show you exactly how to write to the registry.
You can also find this information by checking out a few of the sites listed in Read me First

(in reply to ccoll52)
 
 
Post #: 4
 
 RE: search registry and make change - 3/8/2006 12:00:17 AM   
  XiaoAiWhc

 

Posts: 7
Score: 0
Joined: 11/10/2005
Status: offline
The following VBScript example shows you how to use the CheckAccess method to verify that the user has the right to read the values of the registry key:

      

The following VBScript example shows how to use the CreateKey method to create the MyKey and MySubKey subkeys under HKEY_CURRENT_USER\SOFTWARE.

      

The following VBScript example shows how to use the EnumKey method to enumerate the services listed as subkeys in the registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services
You can save the script as a file with a .vbs extension and send the output to a file by executing the command line in the folder that contains the script:
cscript Filename.vbs > output.txt

      

The following VBScript example shows how to use the DeleteKey method to delete the MySubKey subkey created in the CreateKey example.

      

The following VBScript example shows how to use the DeleteValue method. For purposes of the example, a new key and value are created then the value is deleted.

      

The following VBScript example shows how to enumerate the values under:
HKEY_LOCAL_MACHINE\SYSTEM\Current Control Set\Control\
   Lsa
You can save the script as a file with a .vbs extension and send the output to a file by executing the command line in the folder that contains the script:
cscript Filename.vbs > output.txt

      

The following VBScript example reads and displays the value in the DWORD registry value HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CrashControl\AutoReboot.

      

The following VBScript example reads the REG_EXPAND_SZ value located in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon. You can save the script as a file with a .vbs extension and send the output to a file by executing the command line in the folder that contains the script:
cscript Filename.vbs > output.txt

      

The following VBScript example reads the value of type REG_MULTI_SZlocated in the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\System\Sources and prints the list to the screen. You can save the script as a file with a .vbs extension and send the output to a file by executing the command line in the folder that contains the script:
cscript Filename.vbs > output.txt

      

The following VBScript example shows how to use the SetBinaryValue method.

      

The following VBScript example creates HKEY_LOCAL_MACHINE\SOFTWARE\NewKey\Example DWORD Value and writes a value of type REG_DWORD to it. If NewKey already exists then the value is added to it. You can use a registry editor such as regedt32 to view the results of the script.

      

The following VBScript example shows how to use the SetExpandedStringValue method. The script first creates a new key then creates a new expanded string value under the key.

      

The following VBScript example shows how to use the SetMultiStringValue method.

      

The following VBScript example calls the SetStringValue method to write a string value to a key. The script first creates the key.

      

The StdRegProv interface inherits the methods of the IUnknown interface.
In addition, StdRegProv defines the following methods.
Method Description
CheckAccess Verifies that the user has the specified access permissions.
CreateKey Creates a subkey.
DeleteKey Deletes a subkey.
DeleteValue Deletes a named value.
EnumKey Enumerates subkeys.
EnumValues Enumerates the named values of a key.
GetBinaryValue Gets the binary data value of a named value.
GetDWORDValue Gets the DWORD data value of a named value.
GetExpandedStringValue Gets the expanded string data value of a named value.
GetMultiStringValue Gets the multiple string data values of a named value.
GetStringValue Gets the string data value of a named value.
SetBinaryValue Sets the binary data value of a named value.
SetDWORDValue Sets the DWORD data value of a named value.
SetExpandedStringValue Sets the expanded string data value of a named value.
SetMultiStringValue Sets the multiple string values of a named value.
SetStringValue Sets the string value of a named value.


Edit for readability

< Message edited by Country73 -- 3/8/2006 1:26:39 AM >

(in reply to ccoll52)
 
 
Post #: 5
 
 RE: search registry and make change - 3/8/2006 4:13:28 AM   
  DiGiTAL.SkReAM


Posts: 1140
Score: 6
Joined: 9/6/2005
From: Florida, USA
Status: online
Whoa.  Now I'm too intimidated to post a reply to the original question!

_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to XiaoAiWhc)
 
 
Post #: 6
 
 RE: search registry and make change - 3/8/2006 4:50:41 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
XiaoAiWhc is nothin if not thorough. 

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to DiGiTAL.SkReAM)
 
 
Post #: 7
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> search registry and make change Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts