-
May 10th, 2017, 08:16 AM
#1
Thread Starter
Junior Member
Issue with amending HKLM Value
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
-
May 10th, 2017, 09:29 AM
#2
Re: Issue with amending HKLM Value
First guess: Permissions. You are the user, so you can alter the Current User hive all you want; it's your sandbox. the LM Hive though... affects all users and the system so you need to have the appropriate admin permissions to make changes to it.
-tg
-
May 10th, 2017, 09:31 AM
#3
Thread Starter
Junior Member
Re: Issue with amending HKLM Value
Originally Posted by techgnome
First guess: Permissions. You are the user, so you can alter the Current User hive all you want; it's your sandbox. the LM Hive though... affects all users and the system so you need to have the appropriate admin permissions to make changes to it.
-tg
Hi,
thanks for this
it will be running from a SYSTEM account so should have the relevant permissions to do so, it also doesn't run from an elevated command prompt either?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|