Want to access the UserCount for the File - VBScript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • madankarmukta
    Contributor
    • Apr 2008
    • 308

    Want to access the UserCount for the File - VBScript

    Hi All,

    I am interested in knowing Users Count who all are Currently accessing the File File1.txt. I wrote a Vb Script to get the user Count. I am running the script on XP professional Edition.After some investigation I found the value of the oFile.InUseCoun t on XP coming to be null everytime.

    Is there any other WMI class from which I'll get the list of Files in use by SYSTEM/User ?

    Here is the VBScript -

    Code:
    Option Explicit
    
    Dim oWMI, oFile, strFilePath
    strFilePath = "C:\Program Files\Internet Explorer\iexplore.exe"
    
    Set oWMI = GetObject("winmgmts:\\.\root\cimv2")
    Set oFile = oWMI.Get("CIM_DataFile.Name='" & strFilePath & "'")
    
    WScript.Echo "CIM_DataFile.Name='" & strFilePath & "'"
    
    REM : In Xp it seemed to be NULL most of the time
    
    WScript.Echo oFile.InUseCount  --> returning NULL Every Time.
    Please Let Me know If you have any solution over this.

    Thanks!
Working...