4 Replies Latest reply on Oct 11, 2008 5:38 PM by rsterling

    Number and size of PST files

    TFBA Apprentice


      I found this on dropped packates but I think I am not doing it correctly; Help please.



      I was able to copy the files to the client machine using a batch file. When I tried to execute Step # 2 using another batch file I got an error message stating under the result column "incorrect function"









      How to find the number and size of PST files in the organization.



      This script is an excellent example of how LANDesk Management Suite can be extended with VBSscript to gather and query just about any random chunk of data.


      1. Distribute the contents of findpst.zip to your client's c:\program files\landesk\ldclient directory (if that's not your %LDCLIENTDIR%, you'll want to edit these two files appropriately).

      2. Send a managed script to execute the script: REMEXEC00="wscript.exe C:\Progra~1\LANDesk\LDClient\FindPST.vbs", SYNC ought to do.

      3. Force an inventory scan.

      4. Query on machines where Custom Data - Total PST Size is larger than you like.

      Since this is using an LDSCNHLP.INI extension, you'll want to manually edit that file if you plan on using findpst.vbs in addition to any other scripts that are launched from within that file.

        • 1. Re: Number and size of PST files

          did you put the remexec line in the machines section? At any rate, ldms_client is the recommended way to get this information. You still have to go through the process of getting ldiscnhlp.ini configured properly, but you only have to do it once.

          1 of 1 people found this helpful
          • 2. Re: Number and size of PST files
            TFBA Apprentice

            So basically I have to run this little app on the core server?

            • 3. Re: Number and size of PST files

              1. Run the downloaded ldms_client_setup.exe installer program; this will install ldms_client.exe, ldms_client_regreader.exe, ldms_client_core.exe, a modified LDSCNHLP.INI, and ldms_client.bat to your core. If you edit the LDSCNHLP.INI file, be careful about numbering... DATA lines and DATANOPREPEND lines are numbered separately, and if both lists don't begin with 1, the .dat files won't be consumed.

                 2. Run ldms_client_core.exe for initial configuration. Make your choices and click OK to save the configuration file at
              $CORENAME\ldlogon\ldms_client.ini. Additional changes can be made by running Start > All Programs > Monkeynoodle > Configure ldms_client.

                 3. Use LANDesk Management Suite to distribute ldms_client.exe to your clients. You may also want to distribute ldms_client_regreader.exe to your clients; this is used to gather information from the HKCU registry hive. An example ldms_client.bat file is included in the %Program Files%/Monkeynoodle directory for use with LANDesk software distribution, and an example vulnerability file (V_INTL_ldms_client installation.xml) is included in the same directory for use with LANDesk patch management. Both examples default to distributing the registry reader tool as well as the ldscnhlp.ini. The vulnerability needs work to be complete, while the batch is probably good to go.

                 4. Distribute a modified ldscnhlp.ini to your clients. This file should call ldms_client.exe and read ldms_client.dat. An example file is included in the %Program Files%/Monkeynoodle directory.

              • 4. Re: Number and size of PST files

                Modified the script a bit by combining several across the Internet.  This one runs almost instantly, although doesn't search for all PST files, per se', it looks for all PST files in the default Outlook profile.  Because it runs so fast, this will probably be enough for us.  Hope it helps.



                Option Explicit
                On Error Resume Next

                Const HKCU = &H80000001
                Dim oFSO, oReg, sWMSS, sDefProf, aKeys
                Dim sKey, aVal, sPSTPath, sPSTSize, sTotalPSTSize
                Dim strPath, strFile, filetxt
                strPath = "C:\Progra~1\LANDesk\LDClient\"
                strFile = strPath & "pstfiles.dat"

                '<*> Create WMI Registry Object
                Set oReg = GetObject("winmgmts:\\.\root\default:StdRegProv")
                Set oFSO = CreateObject("Scripting.FileSystemObject")

                '<*> Find current user's default profile
                sWMSS = "Software\Microsoft\Windows NT\Current" _
                & "Version\Windows Messaging Subsystem\Profiles"
                oReg.GetStringValue HKCU, sWMSS, "DefaultProfile", sDefProf
                sDefProf = sWMSS & "\" & sDefProf

                'Enumerate the default profile registry folder
                oReg.EnumKey HKCU, sDefProf, aKeys

                If oFSO.FileExists(strFile) = False Then
                   If NOT oFSO.FolderExists(strPath) Then
                   End If
                End If

                Set filetxt = oFSO.OpenTextFile(strFile, 8, True)

                '<*> Walk the array of keys looking for 'Personal Folders'
                For Each sKey in aKeys
                oReg.GetBinaryValue HKCU,sDefProf & "\" & sKey, "001f3006", aVal
                If VarType(aVal) And 8192 Then
                  If Bin2Str(aVal) = "Personal Folders" Then
                   oReg.GetBinaryValue HKCU,sDefProf & "\" & sKey, "001f6700", aVal
                   sPSTPath = Bin2Str(aVal)
                '<*> If the PST file exists, get it's size
                   If oFSO.FileExists(sPSTPath) Then
                    sPSTSize = oFSO.GetFile(sPSTPath).Size
                    sTotalPSTSize = sTotalPSTSize + sPSTSize
                    sPSTSize = 0
                   End If
                   MsgBox "Path: " & sPSTPath & vbCr & "Size: " & sPSTSize
                   filetxt.WriteLine("Email - PST File Location = " & sPSTPath)
                   filetxt.WriteLine("Email - PST File Size = " & sPSTSize)
                  End If
                End If

                filetxt.WriteLine("Email - PST Total Disk Size = " & sTotalPSTSize)


                Function Bin2Str(ByVal aBin)
                Dim iChr
                For Each iChr in aBin
                  If iChr Then Bin2Str = Bin2Str & Chr(iChr)
                End Function