Quantcast
Channel: VBForums - ASP, VB Script
Viewing all articles
Browse latest Browse all 686

Issue with amending HKLM Value

$
0
0
Good afternoon
I have the below script which should amend values in HKLM
it should read the value from strvaluename and then this is the oldvalue, then set a new string value which prefixes with the strvalue

Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Wow6432Node\Interwoven\Worksite\Client\FileSite\Commands\Workspace\"
strValueName = "Commands"
strValue = ",-,printBarcode.printBC@Print Barcode"
objRegistry.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, oldValue
newValue = oldValue & "," & strValue
objRegistry.SetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, newValue

This works fine as HKCU as shown in the below script
Const HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\Microsoft\Internet Explorer\International\"
strValueName = "AcceptLanguage"
strValue = "en-GB;Q=0.5"
objRegistry.GetStringValue HKEY_CURRENT_USER, strKeyPath, strValueName, oldValue
newValue = oldValue & "," & strValue
objRegistry.SetStringValue HKEY_CURRENT_USER, strKeyPath, strValueName, newValue


Can anyone advise why when I alter the path to HKLM it no longer works please?
Regards

Viewing all articles
Browse latest Browse all 686

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>