[THIN] Re: Script to fix Office - TypeLib - Registry Entries


Just what i have been looking for !!!!
Thanks for your efforts Dennis.

regards

----- Original Message -----
From: "Parker, Dennis" <Dennis.Parker@xxxxxxxxxx>
To: <thin@xxxxxxxxxxxxx>
Sent: Friday, January 31, 2003 5:48 PM
Subject: [THIN] Script to fix Office - TypeLib - Registry Entries


>
> Perhaps some of you remember a post a while back about Q248658:  OFF2000:
Windows Hangs When You Log on to a Terminal Server Computer.  (See end of
the post for the full Q article if interested).  Basically, it says that the
registry will grow because of the way Terminal servers handle temp
directories.  For anybody that's interested (I did a search of the forums
and hadn't seen anything like this, but perhaps I missed it somewhere by not
searching properly) I modified a couple of scripts on the Internet and made
one that will search through the \HKEY_CLASSES_ROOT\TypeLib registry entries
for MSForms.EXD and remove the entries from the registry.  Seemed like a
much easier solution than the Microsoft solutions.
>
> The script requires RegObj.DLL from Microsoft, which can be obtained here:
http://msdn.microsoft.com/vbasic/downloads/addins/default.asp
>
> The script works best using CSCRIPT.EXE because of the use of
WSCRIPT.ECHO, which could be commented out of course.  Also, I commented out
the single line that actually does the removal of the registry key, so it
isn't destructive by default.
>
> I have successfully run this on my Terminal Servers (NT 4.0) here with out
issue, but of course I make no warranty that this will work in your shop.
Use at your own risk.
>
> I hope that someone out there finds it useful.  Of course I don't mind if
it gets posted to thethin.net either.
>
> '---copy between the lines and paste into your favorite text editor and
save as a .vbs file---
>
'---------------------------------------------------------------------------
-----------------
>
> Option Explicit
>
> 'This works best with CSCRIPT.EXE
>
> Dim strRet
> Dim Temp, TempSplit
> Dim strLIBS(), strLIBScount
> Dim i, strComputer
>
> strLIBScount = -1
> strComputer = "your terminal server name here"
>
> WScript.Echo enumerateSubKeys("\HKEY_CLASSES_ROOT\TypeLib", strComputer)
>
> WScript.Echo "-------------"
> For i = 0 To UBound(strLIBS)
> WScript.Echo strLIBS(i)
> Next
> WScript.Echo "-------------"
>
> For i = 0 To UBound(strLIBS)
> Temp = deleteKey(strLIBS(i), strComputer)
> Next
>
> Function enumerateValues(strKey, strComputerName)
> '
> ' strKey is the name of registry key to enumerate
> ' strComputerName is the computer from which registry is used
> '
>     Dim objRegObj
>     Dim objRootKey
>
>     Set objRegObj = WScript.CreateObject("RegObj.Registry")
>     'Choose the Registry Hive
>     If strComputerName = "" Then
>         Set objRootKey = objRegObj.RegKeyFromString(strKey)
>     Else
>         Dim objRemoteRegistry
>
>         Set objRemoteRegistry = objRegObj.RemoteRegistry(strComputerName)
>         Set objRootKey = objRemoteRegistry.RegKeyFromString(strKey)
>     End If
>
>     Dim oValue
>
>
>     For Each oValue In objRootKey.Values
>     If InStr(oValue.Value, "MSForms.EXD") Then
>     strLIBScount = strLIBScount + 1
>     ReDim Preserve strLIBS(strLIBScount)
> TempSplit = Split(strKey, "\")
> strLIBS(strLIBScount) = "\" & TempSplit(1) & "\" & TempSplit(2) & "\" &
TempSplit(3)
> strRet = strRet & TempSplit(3) & " " & oValue.Value & vbCrLf
>
>         End If
>     Next
>
>
>      enumerateValues = strRet
>
> End Function
>
> Function enumerateSubKeys(strKey, strComputerName)
> '
> ' strKey is the name of registry key to enumerate
> ' strComputerName is the computer from which registry is used
> '
>      Dim objRegObj
>      Dim objRootKey
>
>      Set objRegObj = WScript.CreateObject("RegObj.Registry")
>     'Choose the Registry Hive
>     If strComputerName = "" Then
>         Set objRootKey = objRegObj.RegKeyFromString(strKey)
>     Else
>         Dim objRemoteRegistry
>
>         Set objRemoteRegistry = objRegObj.RemoteRegistry(strComputerName)
>         Set objRootKey = objRemoteRegistry.RegKeyFromString(strKey)
>     End If
>
>      Dim objRegKey
>
>      For Each objRegKey in objRootKey.SubKeys
>          temp = enumerateSubKeys(strKey & "\" & objRegKey,
strComputerName)
>          temp = enumerateValues(strKey & "\" & objRegKey, strComputerName)
>      Next
>
>      enumerateSubKeys = strRet
>
> End Function
>
> Function deleteKey(strKey, strComputerName)
> '
> ' strKey is the name of registry key to enumerate
> ' strComputerName is the computer from which registry is used
> '
>      Dim objRegObj
>      Dim objRegParentKey
>      Dim objRootKey
>
>      Set objRegObj = WScript.CreateObject("RegObj.Registry")
>     'Choose the Registry Hive
>     If strComputerName = "" Then
>         Set objRootKey = objRegObj.RegKeyFromString(strKey)
>     Else
>         Dim objRemoteRegistry
>
>         Set objRemoteRegistry = objRegObj.RemoteRegistry(strComputerName)
>         Set objRootKey = objRemoteRegistry.RegKeyFromString(strKey)
>     End If
>
>     Set objRegParentKey = objRootKey.Parent
>
> ' Uncomment out the following to ACTUALLY do the delete.
> ' I'm not responsible for any damage.
> ' objRegParentKey.SubKeys.Remove(objRootKey)
>
> End Function
>
>
'---------------------------------------------------------------------------
> '----END COPY Section of VBS
code ------------------------------------------
>
> ----Q article----
> OFF2000: Windows Hangs When You Log on to a Terminal Server Computer
> Q248658
> --------------------------------------------------------------------------
--
> ----
> The information in this article applies to:
>
> Microsoft Office 2000
> Microsoft Office 97 for Windows
> Microsoft Windows NT Server version 4.0, Terminal Server Edition
>
> --------------------------------------------------------------------------
--
> ----
>
>
> SYMPTOMS
> When you log on to a Terminal Server computer either from a client
> workstation using the Terminal Server Client or directly from the console,
> Windows may appear to hang (showing an hourglass) for several minutes
after
> the desktop appears, and you cannot click the Start menu or double-click
any
> icon on the desktop until the hourglass disappears.
>
> Over time, this problem may become noticeably worse and may lead to an
> eventual crash of the Terminal Server computer.
>
>
>
> CAUSE
> When Windows loads the desktop, it scans the Windows registry. If the
> TypeLib key (HKEY_CLASSES_ROOT\TypeLib) in the Windows registry is
inflated,
> it will appear to slow down or hang Windows while the registry is scanned.
>
> When you run any of the Microsoft Office 97 or Microsoft Office 2000
> programs, the following new folders are created in the user session Temp
> folder:
>
> Excel9.0
>
>
> Ppt9.0
>
>
> Word8.0
>
>
> Vbe
>
>
> The first time you insert a control into a document or UserForm, the
Office
> program creates an .exd file for that control in the appropriate folder.
> After a program creates the .exd file for a specific control, it takes
less
> time to insert the same control again. This is because the .exd file
caches
> information for the control. However, at the same time, a unique class ID
> registry entry is made in the Windows registry for this .exd file.
>
> When each user logs off the Windows Terminal Server computer, their
session
> Temp folder is also deleted. The specified folders described earlier in
this
> article, along with the .exd files created in those folders, are deleted
> when this occurs. However, the registry entries created still remain. Over
> time, as the same and/or subsequent users log on and use form controls on
> the Windows Terminal Server computer, the Windows registry
> (HKEY_CLASSES_ROOT\TypeLib) will increase in size large enough to exhibit
> the behavior described in the "Symptoms" section of this article.
>
> For additional information about why .exd files are created and their use
in
> Microsoft Office applications, click the article number below to view the
> article in the Microsoft Knowledge Base:
> Q199830 OFF2000: EXD Files Are Created When You Insert Controls
>
>
>
> RESOLUTION
>
> Method 1
> Unfortunately, only way to resolve this issue with minimal problems is to
> backup all user data stored on the server, format the server, then
reinstall
> the Windows Terminal Server and all applications. You can then restore all
> user data from your backup once complete.
>
> This is the only method supported by Microsoft Technical Support.
>
> NOTE: Please see the Workaround section below for preventative steps that
> can be used to prevent this problem from reoccurring.
> Method 2
> WARNING: The following possible resolution is given only as an alternative
> to the supported method. It is not suggested that these steps be used, and
> any problems experienced as a result of performing these steps are to be
> taken at your own risk. THIS METHOD IS NOT SUPPORTED BY MICROSOFT
TECHNICAL
> SUPPORT. You may still have to resort to the solution given in Method 1 to
> completely resolve this problem.
>
> WARNING: USE THE FOLLOWING AT YOUR OWN RISK.
>
> IMPORTANT: This article contains information about editing the registry.
> Before you edit the registry, make sure you understand how to restore it
if
> a problem occurs. For information about how to do this, view the
"Restoring
> the Registry" Help topic in Regedit.exe or the "Restoring a Registry Key"
> Help topic in Regedt32.exe.
>
> WARNING: Using Registry Editor incorrectly can cause serious problems that
> may require you to reinstall your operating system. Microsoft cannot
> guarantee that problems resulting from the incorrect use of Registry
Editor
> can be solved. Use Registry Editor at your own risk.
>
> For information about how to edit the registry, view the "Changing Keys
and
> Values" Help topic in Registry Editor (Regedit.exe) or the "Add and Delete
> Information in the Registry" and "Edit Registry Data" Help topics in
> Regedt32.exe. Note that you should back up the registry before you edit
it.
> If you are running Windows NT, you should also update your Emergency
Repair
> Disk (ERD).
>
> To resolve this problem, you will need a second machine. Use the following
> steps below to resolve this issue:
>
>
> On a separate machine (designated in these steps as Machine-B) install
> Windows NT 4.0 Terminal Server Edition.
>
>
> On Machine-B install each application EXACTLY as it is installed on the
> original machine exhibiting the problems described in the Symptoms section
> (designated in these steps as Machine-A).
>
> NOTE: It is best for Machine-A and Machine-B to be 100% identical in
> hardware and drive configurations.
>
>
> On Machine-B, open the Windows Registry and export the TypeLib key:
>
>
> On the Windows Start menu, click Run.
>
>
> Type Regedit and click OK.
>
>
> Browse to and select the following key:
>
>
> HKEY_CLASSES_ROOT\TypeLib
> On the Registry menu, click Export Registry File, give the file a name and
> save it to a floppy disk.
>
>
> Exit the Registry Editor.
>
>
> On Machine-A, open the Windows Registry and delete the TypeLib key:
>
>
> On the Windows Start menu, click Run.
>
>
> Type Regedit and click OK.
>
>
> Browse to and select the following key:
>
>
> HKEY_CLASSES_ROOT\TypeLib
> On the Edit menu, click Delete.
>
>
> Exit the Registry Editor.
>
>
> Place the floppy disk created in step 3-d into the floppy drive of
> Machine-A.
>
>
> Browse to and double-click on the Registry file to import it into the
> Windows Registry of Machine-A.
>
>
> As a result the TypeLib key on Machine-A will be updated to reflect the
> clean state as seen on Machine-B. The problem described in the Symptoms
> section should no longer be seen.
>
> NOTE: Please see the Workaround section below for preventative steps that
> can be used to prevent this problem from reoccurring.
>
>
>
> WORKAROUND
> To prevent this problem, you can use flat temporary directories on your
> Windows NT Server 4.0 Terminal Server Edition.
>
> By default, flat temporary directories are turned off (disabled). This
means
> that the system creates a subdirectory under the directory specified by
the
> TEMP and TMP environment variables that corresponds to the hexadecimal
value
> of each user's logon ID.
>
> By using FLATTEMP to enable flat temporary directories, the system no
longer
> creates subdirectories under the directory specified by the user's TEMP
> environment variable. This could result in users using the same directory
to
> store temporary files. If flat temporary directories are enabled, make
sure
> each user is using his or her own specific temporary directory by setting
> the TEMP and TMP environment variables in the System icon in Control
Panel.
>
> For additional information about FLATTEMP, click the article number below
to
> view the article in the Microsoft Knowledge Base:
>
> Q186524 Using Terminal Server's FLATTEMP Command
>
>
>
> STATUS
> Microsoft has confirmed this to be a problem in Microsoft Office 2000 and
> Microsoft Office 97.
>
>
>
> MORE INFORMATION
> For additional information about this and related problems, click the
> article numbers below to view the articles in the Microsoft Knowledge
Base:
>
> Q189119 UserEnv Returns Corrupted Profile for All Failures Including RSL
> Exceeded
> Q223492 Registry Size Increases After Installing Outlook Express 5
>
> Additional query words: OFF2000
>
> Keywords : kbenv kbui kbdta kbgpf
> Version : WINDOWS:2000,97; winnt:4.0
> Platform : WINDOWS winnt
> Issue type : kbbug kbprb
>
>
>
> Last Reviewed: January 6, 2000
>
>
> ----boring signature...sorry----
>
> Dennis Parker, MCSE, CCA
> Senior Systems Analyst
> Fiserv EFT
> 4550 SW Macadam Ave, Ste 100
> Portland, Or. 97239
> Direct: 503-274-6785
> Fax:    503-274-6619
>
> This e-mail is confidential and may well be legally privileged.   If you
have received it in error, you are on notice of its status.   Please notify
us immediately by reply e-mail and then delete this message from your
system.   Please do not copy it or use it for any purposes, or disclose its
contents to any other person.   To do so could violate state and Federal
privacy laws.
> Thank you for your cooperation.   Please contact me if you need
assistance.
>
>
>
***************************************************************************
> This Week's Sponsor: New Wyse(R) Expedian(TM)software maximizes your
server capacity--cost-effectively. Now you can dramatically increase the
number of users on a server by as much as 40%--and reduce the number of
servers you have to manage. By optimizing memory usage, Wyse Expedian
software allows the terminal server to support more applications and more
concurrentusers. Download your 30-day free trial today at:
>
http://www.wyse.com/expedian/eval.cfm?promo=US-Ad-0103TheThinNetNewsletterEM
>
****************************************************************************
>
>
> For Archives, to Unsubscribe, Subscribe or
> set Digest or Vacation mode use the below link:
> http://thethin.net/citrixlist.cfm
>


***************************************************************************
This Week's Sponsor: New Wyse(R) Expedian(TM)software maximizes your server 
capacity--cost-effectively. Now you can dramatically increase the number of 
users on a server by as much as 40%--and reduce the number of servers you have 
to manage. By optimizing memory usage, Wyse Expedian software allows the 
terminal server to support more applications and more concurrentusers. Download 
your 30-day free trial today at:
http://www.wyse.com/expedian/eval.cfm?promo=US-Ad-0103TheThinNetNewsletterEM
****************************************************************************


For Archives, to Unsubscribe, Subscribe or 
set Digest or Vacation mode use the below link:
http://thethin.net/citrixlist.cfm

Other related posts: