Solved

Scripting a registry key values

Posted on 2007-11-30
5
473 Views
Last Modified: 2010-04-21
Hi,

We've recently discovered that after installing service pack 3 for office 2003 some MS Word documents do not open any more. This is due to the fact that some other software used in our office creates a file with doc extension which updated Office doesn't want to read any more. Now, as I can add exceptions to the registry I'm now trying to write a script to add such exceptions automatically. I have troubles locating OLKXX directory from the script. Someone, please help me do that. Thanks!


Const HKEY_LOCAL_MACHINE = &H80000002
 
strComputer = "."
 
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _ 
    strComputer & "\root\default:StdRegProv")
 
strKeyPath = "SOFTWARE\Microsoft\Office\11.0\Common\OICEExemptions"
oReg.CreateKey HKEY_CURRENT_USER,strKeyPath
 
strKeyPath = "SOFTWARE\Microsoft\Office\11.0\Common\OICEExemptions"
strValueName = "ExemptionStr_01"
strValue = %userprofile% & "\Impostazioni Locali\Temporary Internet Files\" & OLKXX (THIS LINE IS MY TROUBLE)
 
oReg.SetExpandedStringValue _
    HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue

Open in new window

0
Comment
Question by:Zaurb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 7

Expert Comment

by:avatar-e
ID: 20386387
OLKXX for Word documents is

"Content.Word"

for other files, for example, misc attached files in Outlook comes and IE temps:

"Content.IE5"
0
 
LVL 12

Expert Comment

by:chandru_sol
ID: 20386894
Only some files are not opening or any of the word files are not opening
0
 
LVL 1

Author Comment

by:Zaurb
ID: 20390752
Hi, thanks for responses.

1. Only certain word files do not open. I know these files where created with the other software. That's the reason why after upgrading Office to SP3 such files are blocked. When I write OICEExemptions into registry I can open files.

2. My problem is that I have to write a script which would do this automatically (Insert OCEExemption key and other str values into the registry). T he thing is I don't know how to find out OLKxx from within the script so the script would write the correct path to OLKxx directory into the registry because xx in OLKxx is individual for various installations.

3. Other than that how do I make the script write the correct path into the str value when path should contain %userprofile% ?

Thank you.
0
 
LVL 12

Accepted Solution

by:
chandru_sol earned 125 total points
ID: 20391570
I think for the first question you have the script

To answer your other questions
2. The below script will find the OLK folder for different users from the registry key
Dim oShell, folderspec, oFS, f, sf, file, f1, count
Set oShell = CreateObject("Wscript.Shell")  
Set oFS = CreateObject("Scripting.FileSystemObject")
folderspec = oShell.RegRead("HKCU\Software\Microsoft\Office\11.0\Outlook\Security\outlooksecuretempfolder")

Set f = oFS.GetFolder(folderspec)
  wscript.echo f.path

3. For the userprofile, use the below script

'script starts here
Dim fso
Dim sFilePath
Dim objShell
Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
UserDataPath = ObjShell.ExpandEnvironmentStrings("%userprofile%")

wscript.echo userDatapath


regards
Chandru
0
 
LVL 1

Author Closing Comment

by:Zaurb
ID: 31411958
Thank you very much!
0

Featured Post

Manage your data center from practically anywhere

The KN8164V features HD resolution of 1920 x 1200, FIPS 140-2 with level 1 security standards and virtual media transmissions at twice the speed. Built for reliability, the KN series provides local console and remote over IP access, ensuring 24/7 availability to all servers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I will show you HOW TO: Perform a Physical to Virtual (P2V) Conversion the easy way from a computer backup (image).
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question