Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Bug with CIM_DataFile?

Closed Thread
 
Thread Tools Display Modes
Old 09-26-2007   #1 (permalink)
Kuma
Guest


 

Bug with CIM_DataFile?

So I was looking at a way with WMI to check the number of open
connections to a file in a server share. I know it can be done other
ways but I want to use WMI. I can check the number of connections to
the share that have open files but I can't see which files the
connections are to by using the Win32_Share, Win32_ServerSession, or
Win32_ServerConnections classes. After looking around MSDN for a few
hours I found the CIM_Datafile class which has a property called
InUseCount.
Quote:

>From MSDN:
InUseCount
Data type: uint64
Access type: Read-only
Number of "file opens" that are currently active against the file.
This property is inherited from CIM_LogicalFile.

I used the following line:
Get-WmiObject -Query {Select * From CIM_Datafile Where Name="C:\
\install.log"}|Select-Object *

Which returns all kinds of information about the file. But the
InUseCount is always Null. Even if I have several instances of the
file open its Null. I've looked around quite a bit and several other
people have noticed this but I can't figure out if I'm doing something
wrong, if the property isn't implemented, if its a bug. Does anyone
know anything about this property or another way to check the number
of connections to a file using WMI?

Old 09-26-2007   #2 (permalink)
Bob Landau
Guest


 

RE: Bug with CIM_DataFile?

My advice to Kuma as well as *anyone* else which is attempting to use WMI is
to get to know "wmic". This command based tool is invaluable for determining
whether the problem has something to do with Powershell or not.

btw Powershell does have significant problems with impersonation which was
been noted a number of times in this forum. My suggestion is not to use it.

But back to the issue if you run the below command at the prompt you'll see
that "inusecount" is blank

wmic datafile where "path='\\'" list full

Sorry to have to tell you the bad news but you'll need to try a different way.

bob

"Kuma" wrote:
Quote:

> So I was looking at a way with WMI to check the number of open
> connections to a file in a server share. I know it can be done other
> ways but I want to use WMI. I can check the number of connections to
> the share that have open files but I can't see which files the
> connections are to by using the Win32_Share, Win32_ServerSession, or
> Win32_ServerConnections classes. After looking around MSDN for a few
> hours I found the CIM_Datafile class which has a property called
> InUseCount.
>
Quote:

> >From MSDN:
> InUseCount
> Data type: uint64
> Access type: Read-only
> Number of "file opens" that are currently active against the file.
> This property is inherited from CIM_LogicalFile.
>
> I used the following line:
> Get-WmiObject -Query {Select * From CIM_Datafile Where Name="C:\
> \install.log"}|Select-Object *
>
> Which returns all kinds of information about the file. But the
> InUseCount is always Null. Even if I have several instances of the
> file open its Null. I've looked around quite a bit and several other
> people have noticed this but I can't figure out if I'm doing something
> wrong, if the property isn't implemented, if its a bug. Does anyone
> know anything about this property or another way to check the number
> of connections to a file using WMI?
>
>
Old 09-26-2007   #3 (permalink)
Brandon Shell
Guest


 

Re: Bug with CIM_DataFile?

or scriptomatic.hta
"Bob Landau" <BobLandau@xxxxxx> wrote in message
news:5298880C-EBC5-45F0-AC53-C5C896D04A28@xxxxxx
Quote:

> My advice to Kuma as well as *anyone* else which is attempting to use WMI
> is
> to get to know "wmic". This command based tool is invaluable for
> determining
> whether the problem has something to do with Powershell or not.
>
> btw Powershell does have significant problems with impersonation which was
> been noted a number of times in this forum. My suggestion is not to use
> it.
>
> But back to the issue if you run the below command at the prompt you'll
> see
> that "inusecount" is blank
>
> wmic datafile where "path='\\'" list full
>
> Sorry to have to tell you the bad news but you'll need to try a different
> way.
>
> bob
>
> "Kuma" wrote:
>
Quote:

>> So I was looking at a way with WMI to check the number of open
>> connections to a file in a server share. I know it can be done other
>> ways but I want to use WMI. I can check the number of connections to
>> the share that have open files but I can't see which files the
>> connections are to by using the Win32_Share, Win32_ServerSession, or
>> Win32_ServerConnections classes. After looking around MSDN for a few
>> hours I found the CIM_Datafile class which has a property called
>> InUseCount.
>>
Quote:

>> >From MSDN:
>> InUseCount
>> Data type: uint64
>> Access type: Read-only
>> Number of "file opens" that are currently active against the file.
>> This property is inherited from CIM_LogicalFile.
>>
>> I used the following line:
>> Get-WmiObject -Query {Select * From CIM_Datafile Where Name="C:\
>> \install.log"}|Select-Object *
>>
>> Which returns all kinds of information about the file. But the
>> InUseCount is always Null. Even if I have several instances of the
>> file open its Null. I've looked around quite a bit and several other
>> people have noticed this but I can't figure out if I'm doing something
>> wrong, if the property isn't implemented, if its a bug. Does anyone
>> know anything about this property or another way to check the number
>> of connections to a file using WMI?
>>
>>
Closed Thread

Thread Tools
Display Modes









Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50