PST Finder v.1
Just a quick script that will search drive/location of choice and finder a certain file type.
In this example we wanted to find all the pst files on all workstations within the company. I packaged the script within SCCM and pushed the following vbscript out to the masses.
‘ Package History:
‘ Date Packager Notes
‘======================================================
‘ 27-02-2012 PST Tracker v.1
‘*************************************************************************************
‘Find all Outlook pst files on C and report them
strComputer = “.”
‘ on error resume next
set wshnetwork=createobject(“wscript.network”)
scomputername=wshnetwork.computername
Set objNetwork = CreateObject(“WScript.Network”)
Const OverwriteExisting = True
Set objWMIService = GetObject(“winmgmts:\\” & strComputer & “\root\cimv2″)
Set colFiles = objWMIService.ExecQuery _
(“Select * from CIM_DataFile Where Extension = ‘pst’ AND (Drive = ‘C:’)”)
‘OR Drive = ‘D:’)”) Can add other Drive locations if need
If colFiles.Count = 0 Then
Wscript.Quit
End If
Set objFSO = CreateObject(“Scripting.FileSystemObject”)
‘ Change CreateFolder to your location of choice – Example a network drive.
Set objFolder = objFSO.CreateFolder(“C:\PST Finder\pstlog”)
Set objTextFile = objFSO.CreateTextFile(“C:\PST Finder\pstlog\pst_files_on_” & scomputername & objNetwork.UserName & “.txt ” , True)
For Each objFile in colFiles
objTextFile.Write(objFile.Drive & objFile.Path & “”)
objTextFile.Write(objFile.FileName & “.” & objFile.Extension & “, Size “)
objTextFile.Write(objFile.FileSize /1024 & “kb” & vbCrLf)
Next
objTextFile.Close
‘Destroy objects
set wshnetwork=nothing