Using system.management;
A summary description of Namespace Diskquota {/// /// Class1. /// summary> class class1 {/// /// The primary entry point of the application. /// summary> [STAThread] static void Main (string [] args) {try {ManagementClass c = new ManagementClass ( "Win32_DiskQuota"); ManagementObject quota = c.CreateInstance (); quota [ "Limit"] = 400000000 ; quota [ "WarningLimit"] = 200000000; // Get user account object ManagementObject account = new ManagementObject ( "Win32_Account.Domain = TODAY20040216, Name = ASPNET"); account.Get (); // get disk object ManagementObject disk = new ManagementObject ("Win32_LogicalDisk.DeviceID = 'f:'"); Disk.get (); quota ["quotavolume"] = disk; quota ["user"] = account; quota.put (); // commit managementClass C = New ManagementClass ("Win32_Diskquota"); console.writeline (C.SystemProperties); Foreach ()) Console.Writeline ("Next: {0}", O.Path);} catch (Exception E ) {Console.writeline ("Error:" E);
}
}
Description: Use the .NET's management component.