Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1276
  • Last Modified:

How to find the largest PST files on our network.

What is the best way to scan our network and find a list of all PST files and what pc's there on?  I am not a programmer or scripter so I may need some help. :)

Thanks!
0
goneal
Asked:
goneal
2 Solutions
 
Raheem05Commented:
Do you have romaing profiles at all?
0
 
Raheem05Commented:
Roaming*
0
 
gonealAuthor Commented:
No roaming profiles.
0
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

 
Raheem05Commented:
OK there is a script which has been published before see below:

http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Windows/XP/Q_24665478.html?sfQueryTermInfo=1+network+pst+scan

Hopefully this is what you are looking for
0
 
Satya PathakLead Technical ConsultantCommented:
Yes you can do it jost go through user profile and C:\Documents and Settings\username\Local Settings\Application Data\Microsoft\Outlook.

0
 
Shift-3Commented:
Paste the script below into a text file with a .vbs extension.  Customize the contents of the arrContainers array on line 6 with the distinguished names of the OUs to search under.  Running the script will search each local drive on each computer and report the location of the largest .pst file on each one in a comma-delimited text file.

It should be noted that this is not terribly efficient and will necessarily take a very long time to run.  If you could narrow down the location to search on each drive, the script's performance could be considerably improved.


Const ADS_SCOPE_SUBTREE = 2
Const intMB = 1048576
 
On Error Resume Next
 
arrContainers = Array("ou=workstations,dc=yourdomain,dc=com")
strExt = "PST"
strReport = "report.csv"
strQuery = "SELECT DeviceID FROM Win32_LogicalDisk WHERE DriveType = 3"
 
Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objReport = objFSO.CreateTextFile(strReport, True)
objReport.WriteLine "Computer,Online,Largest " & strExt & " File,Size (MB)"
 
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
 
For Each strContainer in arrContainers
    Set objCommand.ActiveConnection = objConnection
    objCommand.CommandText = _
        "Select Name,distinguishedName From 'LDAP://" & strContainer & _
        "' Where objectCategory='computer'"  
    objCommand.Properties("Page Size") = 1000
    objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
    Set objRecordSet = objCommand.Execute
    objRecordSet.MoveFirst
 
    Do Until objRecordSet.EOF
        strComputer = objRecordSet.Fields("Name").Value
        strLargestFile = ""
        intLargestSize = 0
 
        If PingCheck(strComputer, 1, 500) Then
            Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
            Set colItems = objWMIService.ExecQuery(strQuery)
 
            For Each objItem In colItems
                strDrive = Left(objItem.DeviceID, 1)
                
                strCommand = "cmd /c @echo off & dir " & Chr(34) & "\\" & strComputer & _
                    "\" & strDrive & "$\*." & strExt & Chr(34) & " /a:-d /b /s"
 
                Set objWshScriptExec = objShell.Exec(strCommand)
                Set objStdOut = objWshScriptExec.StdOut
 
                Do Until objStdOut.AtEndOfStream
                    strFile = objStdOut.ReadLine
                    Set objFile = objFSO.GetFile(strFile)
                    intSize = objFile.Size
                    
                    If intSize > intLargestSize Then
                        intLargestSize = intSize
                        strLargestFile = strFile
                    End If
                Loop
            Next
            
            objReport.WriteLine strComputer & ",True," & Chr(34) & strLargestFile & Chr(34) & _
                "," & Round(intLargestSize/intMB, 1)
        Else
            objReport.WriteLine strComputer & ",False"
        End If
        
        objRecordSet.MoveNext
    Loop
Next
 
objReport.Close
 
Function PingCheck(strTarget, strPings, intPause)
    Const ForReading = 1
    
    Set objShell = CreateObject("WScript.Shell")
    strTempDir = objShell.ExpandEnvironmentStrings("%temp%")
    strTempFile = strTempDir & "\script-" & strTarget & ".txt"
 
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    
    objShell.Run "%comspec% /c ping -n " & strPings & " -w 100 " & _
        strTarget & ">" & strTempFile, 0, True
        
    WScript.Sleep intPause
    
    objShell.Run "%comspec% /c ping -n " & strPings & " -w 100 " & _
        strTarget & ">>" & strTempFile, 0, True
    
    Set objTempFile = objFSO.OpenTextFile(strTempFile, ForReading)
    strOutput = objTempFile.ReadAll
    objTempFile.Close
    objFSO.DeleteFile strTempFile, True
 
    If InStr(strOutput, "bytes=32") > 0 Then
        PingCheck = True
    Else
        PingCheck = False
    End If
End Function

Open in new window

0

Featured Post

Evaluating UTMs? Here's what you need to know!

Evaluating a UTM appliance and vendor can prove to be an overwhelming exercise.  How can you make sure that you're getting the security that your organization needs without breaking the bank? Check out our UTM Buyer's Guide for more information on what you should be looking for!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now