views:

20

answers:

1

A system I have come across, that uses active directory, and has disk quotas, does not have the quotas tranparent to the user. All the users displays in windows (my computer etc.) and calls to GetDiskFreeSpaceEx always return the free space of the volume, and yet the user can never fill this free space because of the quotas. I have not been able to figure out anyway to know the size of the quota, and on the users PC's we have not been able to achieve anything to get these values.

It seems like somehow the quotas are applied on a directory level - and then users are limited to writing to certain directories. So the users quotas always show up as the free space on the disk, even though they cannot really write anything near this amount to any of the directories they have access to.

Has anyone come across something like this and know a winapi/msdn article about this. I am trying to write my program to figure out what free space a mapped active directory drive has for the user.

A: 

If you need to do anything to do with administration on Windows the place to start looking is usually WMI. There's a class called Win32_DiskQuota that has a Limit property.

This Technet blogpost have some sample code for calling this method from VBScript, which wouldn't be that hard to translate to C# or VB.Net (look at System.Management), or if you prefer C++, here's some samples showing how to use WMI from C++.

ho1