开发者

C# How can i find connections to resources in a windows share and drop some of them

I want to get the result I am able to get by typing "net file" in console.

I have tried to fi开发者_高级运维nd a way to get the information I need through WMI Win32 Classes, but it seams to me that I can't list the actual resources in use. The closest I have come is to use Win32_ServerSession, where i can list the shares that has connections, but not the resource itself.

Is there something I have missed, how can I get my result?

Edit:

I can't use "net file", because the strings are being truncated if the path is long.

Example:

D:\shares\files\photo\image.jpg will be listed as D:\share\...\image.jpg

The same list of files, but with full path, can be found under Computer Management -> System Tools -> Shared Folders -> Open Files


Thanks to Manfred, i got this working. If you got the same problem, Get the code from here.


That's right, just another lack of basic features MS offers within WMI ... :-( like many other exciting things like providers or WQL 2.0 [only SMS!!!!] - BUH!

Just use the Net API to do this. I have a sample, but it is too long to post it here [and I would not take any guarentee for it ;-) ].

If you are interested, contact me directly.

br++mabra

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜