This is an update to this: https://www.mnscug.org/blogs/sherry-kissinger/249-pstfinder . The reason for the update is the old method (from 2013) worked for older versions of Outlook; but not for 2013 or newer.
With some clever scripting from different people, notably https://social.technet.microsoft.com/Forums/en-US/7ff6821c-b7cc-46e0-bc5a-342cfd9c0bf9/display-outlook-pst-file-location-on-remote-machines?forum=winserverpowershell , John Marcum and Sherry Kissinger, and we've got a routine that will, for the most part, answer those three questions. The basics of how it works is this. There are two vbscripts that run. One runs as SYSTEM, and it's only purpose is to create a custom namespace in WMI, and grant permissions to all of your domain users to that custom namespace--so they can populate it with the results of script #2. Script #2 runs, only when a user is logged in, with user rights. That's because the majority of what the script needs to do is read information about that specific logged-in users Outlook configuration, and (potentially) any mapped drive information which may be referenced by the PST file location.
The results of the 2nd script end up in that custom WMI namespace, and will have the following information:
DateScriptRan = the exact date and time that the script ran to gather this user-specific information.
FileSizeinMB = If it could be detected, and the file size was 1mb or larger, the size of the PST. If it's less than 1mb, or for whatever reason could not be detected, the value will be 0.
PSTFile = The DisplayName in Outlook
PSTLocation = The location as known to Outlook
Type = If it could figure out that Q: was a mapped network drive, it'll say 'Remote', otherwise it'll say local
UserDomain = whomever is logged in, what their domain is.
UserName = whomever is logged in, what their username is.
Location = This will either be a drive letter, or if it was possible to determine if that drive letter was really a mapped drive to a network location, the \\Server\Share will be populated.
End result: After deploying these two scripts, you will be able to answer those pesky questions from your Exchange team about who, where, and how large, are referenced PST files. Of course, the main limitation is this is per-user information. If you have a lot of shared machines, or the same user has multiple computers (and connects to the same PST files on those multiple computers) you'll have to do some creative reporting to ensure you don't double-count the same PST files.
Ok, enough of how it works. You really want to know *exactly* what to do, right? Let's start!
Your Source folder for the package will contain 2 things:
The .ps1 files are at this -->link<--.
You will need to make 1 change to "CreateCustomCMClasses-RunAsSystem.ps1", this line:
[String]$Account = 'YourDomainHere\Domain Users',
Modify that to be your domain (the domain your users are in that will be logging in and running script #2).
Create two programs; the first runs Powershell.exe -ExecutionPolicy Bypass -File CreateCustomCMClasses-RunAsSystem.ps1, whether or not a user is logged in, with Administrator rights. The second runs Powershell.exe -ExecutionPolicy Bypass -File PopulateWMI-RunAsUser.ps1, only when a user is logged in, with user rights. The 2nd one; you want to "run another program first", and have it run the first one. It only needs to run the 1st program once, per computer; it doesn't need to re-run.
Advertise the 2nd program to a collection (I recommend a test/pilot first), and confirm that it works as you expect. If you want to confirm the data is there, look in root\CustomCMClasses (not root\cimv2) for cm_PSTFileInfo, that there are instances there for any Outlook-attached PST files for that user.
If you are satisfied it's there locally, import the below into Default Client Agent Settings, Hardware Inventory
class cm_pstfileinfo : SMS_Class_Template
[SMS_Report(TRUE)] string DateScriptRan;
[SMS_Report(TRUE)] uint32 FileSizeinMB;
[SMS_Report(TRUE)] string Location;
[SMS_Report(TRUE)] string PSTFile;
[SMS_Report(TRUE),key] string PSTLocation;
[SMS_Report(TRUE)] string Type;
[SMS_Report(TRUE)] string UserDomain;
[SMS_Report(TRUE)] string UserName;
sit back, relax for a bit... then invoke a hardware inventory on your test boxes, and see if the data shows up in your database in v_gs_pstfileinfo0. If so, deploy the advert to your real target collection of users or computers, and wait for the data to show up. Depending upon your need for this information; you may or may not want to have the advert run on a recurring basis (weekly? monthly?) or just gather it for a week or so (just enough to answer the question) then delete the advert and change the Inventory from TRUE to FALSE (until the next time they ask).
Here's a potential sql report to get you started:
select sys.Name0 as [Computer Name],
pst.UserName0 as [User],
pst.PSTFile0 as [File Name],
pst.PSTLocation0 as [File Location],
pst.Type0 as [Local/Remote],
pst.Location0 as [Location],
pst.FileSizeinMB0 as [Size in MB],
pst.DateScriptRan0 as [Date Collected]
from v_R_System sys
Inner Join v_GS_PSTFileInfo0 pst on sys.ResourceID = pst.ResourceID
order by sys.Name0
- Created on .