Partager via


Disk Quota and .net (WMI and Microsoft.DiskQuota.1)

Today I had a con-call to talk about disk quota and how to automate the setting and reading of Quota.  So i thought that I would post a little about Disk quota stuff.

There are 2 okay options. 

#1 WMI (way to slow for a lot of things (https://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/disk_quota_provider.asp))

#2 Microsoft.DiskQuota.1

So my team needed a way to enumerate a users current quota limits and then + or - from them.  WMI was very slow to do this.  But DiskQuota.1 is quite fast.  It is not well documented that it works on remote servers either.  So I wrote a little something up.

So here is some cs (let me know if you want it in VB) that has functions on how to get and set quota info with Microsoft.diskquota.1

(2/5/2012) updated location of code.

CSharp: https://dl.dropbox.com/u/3275573/blog/QuotaFunctions.cs.txt
VB.NET: https://dl.dropbox.com/u/3275573/blog/QuotaFunctions.vb.txt