Solved

Scripting a registry key values

Posted on 2007-11-30
5
468 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
  • 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

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

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

Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

770 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