(imported topic written by SystemAdmin)
My organization has been attempting to locate PST files on client devices. We’ve tried several approaches with varying degrees of success.
One approach is using “dir” to output a result to a file.
runhidden {pathname of system folder}\cmd.exe /C dir /s /b /a /o:gn c:*.PST >“c:\PST.txt”
This works to some degree. However, we’ve found instances where is does not completely work. This example is copied from an XP machine where dir works in the specific folder, but not down through the entire tree. The results are the same if Bigfix runs it or a local admin runs it interactively.
C:>dir “C:\DOCUME~1<username>\My Documents\archive.pst” /s
Volume in drive C has no label.
Volume Serial Number is 9ED0-639E
Directory of C:\DOCUME~1<username>\My Documents
02/20/2012 05:07 PM 271,360 archive.pst
1 File(s) 271,360 bytes
Total Files Listed:
1 File(s) 271,360 bytes
0 Dir(s) 56,690,081,792 bytes free
C:>dir c:*.pst /s
Volume in drive C has no label.
Volume Serial Number is 9ED0-639E
File Not Found
So I searched to forum and found this basic search syntax and tried a variation of it.
delete __appendfile
delete findpstfiles.bat
appendfile @echo off
appendfile del “{pathname of parent folder of regapp “BESClient.exe”}\pstfiles.txt”
appendfile echo “{”" & concatenation "" of pathnames of descendants whose (name of it as lowercase ends with “.pst”) of folders “” of drives whose (type of it=“DRIVE_FIXED”) & “**”}" > “{pathname of parent folder of regapp “BESClient.exe”}\pstfiles.txt”
move __appendfile findpstfiles.bat
waithidden findpstfiles.bat 1>NUL 2>NUL
This action seems to work completely and consistently on Win7 x86 and x64. However it fails on XP with the following note in the agent log:
Command failed (Relevance substitution failed) appendfile echo “{”" & concatenation "" of pathnames of descendants whose (name of it as lowercase ends with “.pst”) of folders “” of drives whose (type of it=“DRIVE_FIXED”) & “**”}" > “c:\pstfiles.txt”