I've created an internal web page for my company that lists open files via ADSI objects and while it works well, it takes time to load and is difficult and time-consuming to filter, if the filter works at all.
The core of this PHP script follows.
$lms=new COM('WinNT://file-server/LanmanServer');
$files=array();
foreach ($lms->Resources as $key => $value) {
try {
$files[$value->Path]=$value->User;
} catch (Exception $e) {
echo '<!-- ', $e->getMessage(), ' -->',"\n";
}
}
My question is this - is there a WMI object equivalent to this method? One that lists the full file (not just the share, so Win32_ServerConnection is not the answer here!) and who opened it, same as the Shared Folders snapin and the ADSI object used above? If there is, I'd like to use a notification event to put that data into a SQL database table where it can be queried and filtered quickly.