Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatic Option Setup

Status
Not open for further replies.

meagain

MIS
Nov 27, 2001
112
0
0
CA
Hi All,

We need a way to automatically set up the MSAccess options for each workstation, so they are consistent. Options like trusted locations and Enable all macros are very important for the applications to run properly and IT finds it taxing to manually perform this per workstation.

Office 16 or 19 on Windows 10 for 50 users coming soon.

If you have a solution to this, please bring it forth.

Thank you,
Lori
 
Most of these settings are in the registry. I believe the following needs to be run from the folder you want to make trusted. I expect you could change [highlight #FCE94F]Wscript.ScriptFullName[/highlight] to another folder. The script will affect only the current user since changing this for all users would typically require elevated rights. The Office version might need updating. I think this script handles two versions. Apparently this is an old script since we are now on 16.0.

You can open regedt32.exe to review other settings.

Code:
Const HKEY_CLASSES_ROOT = &H80000000
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_USERS = &H80000003
Const HKEY_CURRENT_CONFIG = &H80000005

'--------------------------------------------------------------------------------------------
'----------------------------Do not modify above this line! ---------------------------------

'Enter Program name here: (Excel, Access, PowerPoint or Word)
strProgram = "Access"

'Get Path to current folder
strPath = [highlight #FCE94F]Wscript.ScriptFullName[/highlight]

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objFile = objFSO.GetFile(strPath)
strFolder = objFSO.GetParentFolderName(objFile) 

'Enter Description of Trusted Location here:
strDescription = "[highlight #FCE94F][Enter value here][/highlight]"

'Enter one word description of Trusted Location here:
strName = "[highlight #FCE94F][Enter value here][/highlight]"

'If subfolders are also trusted enter "True" here:
blnAllowSubFolders = True

'----------------------------Do not modify below this line! ---------------------------------
'--------------------------------------------------------------------------------------------
 
strParentKey = "Software\Microsoft\Office\[highlight #FCE94F]12.0[/highlight]\" & strProgram & "\Security\Trusted Locations"
strNewKey = strParentKey & "\" & strName
 
Set objRegistry = GetObject("winmgmts:\\.\root\default:StdRegProv")
 
objRegistry.CreateKey HKEY_CURRENT_USER, strNewKey
objRegistry.SetStringValue HKEY_CURRENT_USER, strNewKey, "Path", strFolder
objRegistry.SetStringValue HKEY_CURRENT_USER, strNewKey, "Description", strDescription
objRegistry.SetStringValue HKEY_CURRENT_USER, strNewKey, "Date", cstr(Now())
 
If blnAllowSubFolders Then
    objRegistry.SetDWORDValue HKEY_CURRENT_USER, strNewKey, "AllowSubFolders", 1
End If

strParentKey = "Software\Microsoft\Office\[highlight #FCE94F]14.0[/highlight]\" & strProgram & "\Security\Trusted Locations"
strNewKey = strParentKey & "\" & strName
 
Set objRegistry = GetObject("winmgmts:\\.\root\default:StdRegProv")
 
objRegistry.CreateKey HKEY_CURRENT_USER, strNewKey
objRegistry.SetStringValue HKEY_CURRENT_USER, strNewKey, "Path", strFolder
objRegistry.SetStringValue HKEY_CURRENT_USER, strNewKey, "Description", strDescription
objRegistry.SetStringValue HKEY_CURRENT_USER, strNewKey, "Date", cstr(Now())
 
If blnAllowSubFolders Then
    objRegistry.SetDWORDValue HKEY_CURRENT_USER, strNewKey, "AllowSubFolders", 1
End If

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016
 
> IT finds it taxing to manually perform this per workstation.

Er … why don't they use Group Policies?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top