Kaseya Community

Script to find largest PST file

This question is answered
PSTOSTInfo.vbs.txt

JUST NEED HELP EDITING MY VBS...

If an outlook profile includes PST files it can cause problems if any are over 2 GB. In general by outlook keeping the PST open it causes outlook to run very slowly. Maybe simplest solution is to report largest PSTs that have modification date within last 7 days then most likely they are being opened by outlook profile.

I already have a VBS that searches a computer for PST and reports the details into a text file (attached). Problem is that im not so good with VBS.

Can someone help me make the following changes to my VBS:

1) Only output the the size of the largest PST. Only if modification date within 7 days.


Example.... if a computer has 3 PSTs. 

1) .5gb modified 2 days go.

2) 2.2gb modified 3 days ago

3) 2.5gb modified 30 days ago

txt file would just say "2.2gb"

Then i would put that info into a column in kaseya and i'd know which computers have large PSTs.

Verified Answer
All Replies
  • When i ran the VBS the way it is i got these results:

    File Path , File Size , Date Last Modified

    c:\documents and settings\administrator\local settings\application data\microsoft\outlook\outlook.ost -  - 3/1/2011 12:05:39 PM

    c:\documents and settings\xxxxx\local settings\application data\microsoft\outlook\archive.pst - 1.86 GB - 7/5/2012 1:03:59 PM

    c:\documents and settings\xxxxxx\local settings\application data\microsoft\outlook\older than nov 1 2011archive.pst - 1.1 GB - 7/5/2012 1:03:59 PM

    c:\documents and settings\xxxxxx\local settings\application data\microsoft\outlook\outlook.ost - 3.6 GB - 7/6/2012 1:17:27 PM

    I'd like to edit the script so in this example it would output "1.86 GB"

    It would show the largest PST. Exclude any OST files.

  • I'll see if I can help you out. But that sure is a slooow running script for a WMI Query. Actually, the query completes quickly but it's as if the "WHERE" clause doesn't do a bit of good and it's selecting all of the files in "CIM_DataFile" and then scrolling through them one by one in the "For Next" loop. Strange...

  • Never noticed that. Someone else i work with wrote the vbs and i didnt really question it because it was working...

    Any help would be appreciated

  • This might sound like a stupid question, but why not use CapturePST?

    technet.microsoft.com/.../hh781036

    This tool can be used to scan for PST files and has a console.

    All you have to do is install the software on the server and then run a kaseya script to scan the fileshares.

    Reports can also be created and sent via e-mail.

    Once you've finished scanning, you can also import the PST's into a mailbox. Why import them? PST's can not be managed, no decent backup/restore options (only restore the entire PST), you will lose control over your companies e-mail (god only knows where all the PST files are saved) and finally: Exchange 2007 and 2010 have much better capabilities for handling larger mailboxes than 2003.

  • Not sure why we didn’t use that to start but we already have this other script that works.

    Also you said it scans the fileshares from the server. Not all PSTs are on the fileshare, majority are on the local computer.

  • FindPSTFiles1.zip

    Hi etabush

    I think walteij  really has the best suggestion although I don't know your specific needs. You should check it out a little more before deciding. It looks to me like you can tell it where to search for PST files so you could just specify the "C" drive if you wanted and will automate the retrieval of the PST file. My experience, though, is that users often have their PST files located on their personal network shared folder as well (although Microsoft clearly says that that is a no no) and you'll want to grab those as well, I'd think.

    Anyway, I modified your VBScript to give you all the PST files on the "C" drive that have been opened within the last 7 days. If the user has opened two PST files within the last 7 days you will see both of them. If no PST files have been opened in the last 7 days then the file will be empty. If no PST files have been found the file will say so.

  • hi Etabush and Zippo.

    I've checked Capture PST once more and you can tell it to check the harddisks of the users computers.just be sure that the computers are online when scanning.

    The software does not have to be installed on the computers itself.

  • Zippo. This is what i got when running the vbs you edited.

    Can it be changed so the ONLY thing it outputs is "1.86 GB."  Then i will just take contents of that .txt, put it into a variable, then update a custom field/column in kaseya.

    File Path , File Size , Date Last Modified

    c:\documents and settings\....\local settings\application data\microsoft\outlook\archive.pst, 1.86 GB, 7/9/2012 6:43:05 PM

    c:\documents and settings\...\local settings\application data\microsoft\outlook\older than nov 1 2011archive.pst, 1.1 GB, 7/9/2012 6:43:05 PM

  • FindPSTFiles2.zip

    As you command...

  • Zippo,

    Didnt realize you attached the script in your last post, thought you were still working on it. Anyway i tested it and working perfectly (i just had to remove the headings from the output txt but that's about the extent of my vbs skills...). You're awesome!! thanks.  

  • Hi etabush

    Glad to hear that it's working for you and thanks for the update. If you were able to figure out how to remove the column headers then you're making a good start on your VBS skills - keep at it!

  • Try to use http://www.recoverytoolbox.com/repair_outlook.html scanning, identifying, recovering and saving corrupted Microsoft Outlook items as messages, contacts, attachments, notes, reminders, journals, meetings, etc.

    It must assist you