'Report location and size of PST files on C: 'by Sebastian Tennant - Last Updated: 10/05/2011 'The following script uses WMI to search for PST files Function ConvertSize(Size) Do While InStr(Size,",") 'Remove commas from size CommaLocate = InStr(Size,",") Size = Mid(Size,1,CommaLocate - 1) & _ Mid(Size,CommaLocate + 1,Len(Size) - CommaLocate) Loop Suffix = " Bytes" If Size >= 1024 Then suffix = " KB" If Size >= 1048576 Then suffix = " MB" If Size >= 1073741824 Then suffix = " GB" If Size >= 1099511627776 Then suffix = " TB" Select Case Suffix Case " KB" Size = Round(Size / 1024, 1) Case " MB" Size = Round(Size / 1048576, 1) Case " GB" Size = Round(Size / 1073741824, 1) Case " TB" Size = Round(Size / 1099511627776, 1) End Select ConvertSize = Size & Suffix End Function strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colFiles = objWMIService.ExecQuery _ ("Select * from CIM_DataFile Where Extension = 'pst' AND Drive = 'C:'") For Each objFile in colFiles Wscript.Echo objFile.Drive & objFile.Path Wscript.Echo objFile.FileName & "." & objFile.Extension Wscript.Echo "Size: " & ConvertSize(objFile.FileSize) Wscript.Echo Next