How can I query NTFS disk quotas in C#?

*爱你&永不变心* 提交于 2019-12-24 00:27:06

问题


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.)

  • 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.)

回答1:


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

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



来源:https://stackoverflow.com/questions/1771968/how-can-i-query-ntfs-disk-quotas-in-c

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!