[THIN] Re: NT 4 Registry size

  • From: "Mack, Rick" <RMack@xxxxxxxxxxxxxx>
  • To: "'thin@xxxxxxxxxxxxx'" <thin@xxxxxxxxxxxxx>
  • Date: Thu, 20 Mar 2003 21:37:30 +1100

Hi Michael,

Maximum registry size on an NT 4 system is 80% of the paged pool. The
maximum functional registry size is variously quoted to be from 118 to 153
MB. Setting the maximum registry to be greater than this is pointless though
I guess it does achieve the theoretical maximum.

Cprofile only prunes user profiles by deleting HKCU\Software\classes. 

Check the size of the software hive under %systemroot%\system32\config. If
its bigger than about 35 MB (absolute maximum) then you've found your
problem.

A couple of significant culprits in registry size creep are
HKLM\Software\Microsoft\Windows NT\CurrentVersion\terminal
server\install\machine, and ..\install\software\classes. 

Another problem can arise from Office 97 or 2000 causing growth in HKCR (see
Q248658). The fix for that is a vbscript posted by Dennis Parker (copied
below). 

Backup your registry first with regback from the NT resource kit, or better
yet, use robocopy and regback to make a copy of %systemroot%. The modify
boot.ini so you can boot into it in case things go wrong.

'---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 ------------------------------------------

It's a good idea to run regcompact after either deleting the ..\install\..
Keys or running the above script. It should trim your software hive down.

Regards,

Rick

Ulrich Mack
rmack@xxxxxxxxxxxxxx
Volante Systems
18 Heussler Terrace, Milton 4064
Queensland Australia
tel +61 7 32467704



-----Original Message-----
From: Dannhorn, Michael IZ/HZA-IN3 [mailto:dannhmch@xxxxxxxxxx] 
Sent: Thursday, 20 March 2003 7:10 PM
To: 'thin@xxxxxxxxxxxxx'
Subject: [THIN] NT 4 Registry size



Hi,

Our TS are running now for about 3 years.
During this time used registry size has 
reached 90% (max. registry size is set to 256 MB)

        users   used registry szie      in %
2000:    ~130   low                     low
2003:   ~   80  118 MB                  90

We used 'RegCompact' and 'cprofile' to free registry.
It freed some registry memory but not enough.

Anyone had the same problem or know tools or hacks
to free more memory?

Michael




*********************************************************
This Week's Sponsor - RTO Software / TScale
TScale increases terminal server capacity. 
Get 30-40% more users per server to save $$$ and time. 
Add users now! - not more servers. If you're using Citrix, 
you must learn about TScale!  Free 30-day eval:
http://www.rtosoft.com/Enter.asp?ID=79
**********************************************************

For Archives, to Unsubscribe, Subscribe or 
set Digest or Vacation mode use the below link:
http://thethin.net/citrixlist.cfm
--------------------------------------------------------------------------------------------------------------------
The information contained in this e-mail is confidential and may be subject
to legal professional privilege.  It is intended solely for the addressee.
If you receive this e-mail by mistake please promptly inform us by reply
e-mail and then delete the e-mail and destroy any printed copy.  You must
not disclose  or use in any way the information in the e-mail. There is no
warranty that this email or any attachment or message is error or virus free. 
It may be a private
communication, and if so, does not represent the views of Volante group Limited.


*********************************************************
This Week's Sponsor - RTO Software / TScale
TScale increases terminal server capacity. 
Get 30-40% more users per server to save $$$ and time. 
Add users now! - not more servers. If you're using Citrix, 
you must learn about TScale!  Free 30-day eval:
http://www.rtosoft.com/Enter.asp?ID=79
**********************************************************

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

Other related posts: