How to add several registry values via VBs using GPO

1050 pts.
Group Policy
Group Policy Objects
Windows Server 2003 Domain
Windows Server 2003 GPO
Our clients run XP pro and Office 2003 or 2007 and on server 2003 domain. We have a macro enabled document that pulls the user name from the registry and applies it to the bottom of that document, similar to a signature. The script below pulls the user name from AD and sets it in the registry in the correct location. We need to do that because some of the office installs were setup with "administrator" as the reg user and that is what shows up on the document. This script works well, but I need to set trusted locations in excel 2007 so that the user won't have the select "enable the macros" to get the document to run. The reg editor works well, but I wanted to combine them both into one script. I am having trouble with the "nested" values such as "path" allowsubfolders", etc. Plus I have not found the location of the reg settings to set macro security to low on 2003 so the user can select the enable the macros, otherwise the document won't run at all, or even prompt then to enable.

Maybe someone who is wiser at VB than me that can help me combine these two and set the macro security for 2003. Example below:

Sets username Set objSysInfo = CreateObject("ADSystemInfo") strUser = objSysInfo.UserName Set objUser = GetObject("LDAP://" & strUser) strName = objUser.FullName Dim objShell, Office2K7Key, Office2KKey, TrustedLocation, Path, Allow Set objShell = Wscript.CreateObject("WScript.Shell") Office2K7Key ="HKEY_CURRENT_USERSoftwareMicrosoftOfficeCommonUserInfoUsername" Office2KKey = "HKEY_CURRENT_USERSoftwareMicrosoftOffice9.0CommonUserInfoUsername" objshell.RegWrite Office2K7Key ,(strName),"REG_SZ" objshell.RegWrite Office2KKey ,(strName),"REG_SZ" 'end here to set username REGEDIT to allow macros for 2007 Windows Registry Editor Version 5.00 [HKEY_CURRENT_USERSoftwareMicrosoftOffice12.0ExcelSecurityTrusted LocationsLocation6] "Path"="\dell7z34241sales" "AllowSubfolders"=dword:00000001 "Description"="Location of document" "Date"="9/21/2009 2:42 PM" [!--[If !supportLineBreakNewLine]--] [!--[endif]--]


Answer Wiki

Thanks. We'll let you know when a new response is added.

Part One – Excel 2007 Trusted Folders</ul>

I think you need to call the


portion explicitly before each value.

Part Two – Excel 2003 Registry values


See here:

Discuss This Question: 2  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Ugauga
    You don't actually need vbs for this, you could use a logon cmd and run an exported registry keys with it.
    590 pointsBadges:
  • swinehart6803
    Thanks, I combined the regWrite with a reg editor script. That works much better and I can do a lot more that way with less coding.
    1,050 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: