Multi Users Write Key Register

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
giovanniroi
Junior Coder
Posts: 21
Joined: Fri Jul 03, 2009 4:36 pm
Location: Milan,Italy

Multi Users Write Key Register

Post by giovanniroi » Fri Jul 08, 2011 8:09 am

Dear Support,

I need to write this Key in the Windows Register for all the user available (Administrator and also normal User).

The Key is:

[HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Access\Security\Trusted Locations\Location0]
"Path"="C:\\GR&A_Trend\\"
"AllowSubfolders"=dword:00000001

How can I make the script to execute with the Administrator profile to write the Key for all the PC User?

Thank's for the support.

Giovanni Roi

Okapi
Junior Coder
Posts: 28
Joined: Wed Dec 29, 2010 1:22 am

Post by Okapi » Mon Aug 01, 2011 5:51 pm

You should write the values in HKEY_LOCAL_MACHINE instead of HKEY_CURRENT_USER :

Code: Select all

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

strKeyPath = "Software\Microsoft\Office\12.0\Access\Security\Trusted Locations\Location0"
strValueName1 = "Path"
strValueName2 = "AllowSubfolders"
strValue = "C:\\GR&A_Trend\\"
dwValue = &H00000001

oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName1,strValue
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName2,dwValue
VBEND

giovanniroi
Junior Coder
Posts: 21
Joined: Fri Jul 03, 2009 4:36 pm
Location: Milan,Italy

Thank's for the solution

Post by giovanniroi » Tue Aug 02, 2011 9:16 am

Dear Support,
thank's for the solution.
Regards

Giovanni Roi

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts