我怎么能查询在C#中的NTFS磁盘配额?配额、磁盘、我怎么能、NTFS

2023-09-06 07:49:12 作者:致命的伤、

我需要能够发现,对于给定的远程计算机,这些用户的磁盘配额和实际的磁盘使用情况上的所有用户。我需要能够做到这一点的报告在C#应用程序。 (嗯,技术上是一个DLL插件的应用程序,我已经建立。但是这无关紧要这里)

I need to be able to find, for all users on a given remote machine, those users' disk quotas and actual disk usage. I need to be able to do this reporting in a C# application. (Well, technically a DLL plugin for an app I've already built; but that's irrelevant here.)

在远程机器是不一样的网络上,但是,在执行应用程序的应用程序能够提供的凭据。 在WMI是完全可以接受的;我只是无法找到所需的确切咒语(现在找了3小时)。 (我也没有一个WMI亲;。如果你发布一个WMI的解决方案,请在必要的C#/。这架网 System.Management * 对象) The remote machine is not on the same network, however, the application executing the app is able to supply the credentials. WMI is perfectly acceptable; I just cannot find (after looking for over 3 hours now) the exact incantation needed. (I'm also not a WMI pro; if you post a WMI solution, please frame it in the requisite C#/.NET System.Management.* objects.)

推荐答案

该WMI类的 Win32_DiskQuota 。 编辑:的我发现了一个 VB.NET示例这可以帮助你。

The WMI class is Win32_DiskQuota. I found a VB.NET sample which may help you.

或者你可以尝试做到这一点使用的P / Invoke (链接进入到P / Invoke的维基,在那里你可能会发现一些签名)。 指针开始与配额如下$ C $的CProject文章: HTTP:/ /www.$c$cproject.com/KB/system/DiskQuota.aspx

Or you can try to do this using P/Invoke (link goes to the P/Invoke wiki, where you may find some of the signatures). A pointer to start with quotas is the following CodeProject article: http://www.codeproject.com/KB/system/DiskQuota.aspx