Cheers Jens,
I am really struggling to try to manipulate CIM_DataFile.
Am I doing it correctly?
Here is my code...
code:
Dim $strFileName, $strComputer
Dim $objWMIService, $colFiles, $objFile
CLS
$strFileName = "e:\\apakds\\apak\\sas\\action.ldb"
$strComputer = "."
$objWMIService = GetObject("winmgmts:" + "{impersonationLevel=impersonate}!\\" + $strComputer + "\root\cimv2")
$colFiles = $objWMIService.ExecQuery ("SELECT * FROM CIM_DataFile WHERE Name = '" + $strFileName + "'")
For Each $objFile in $colFiles
? "Name: " + $objFile.Name
? "File name: " + $objFile.FileName
? "InUseCount: '" + $objFile.InUseCount + "'"
Next
If I look in Computer Management (Windows 2000)..."System Tools\Shared Folders\Open Files" I can see that this particular file has "4" locks.
However, when I run this code it returns the following...
code:
InUseCount: ''
Why doesn't it return "4". I would have expected a numerical value to be returned.
Can anyone help me?
Lee