Using system;
Using system.management;
Namespace Diskquota
{
///
/// Class1 summary description.
/// summary>
Class class1
{
///
/// The main entry point for 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);
ManagementObject O IN C.GetInstances ())
Console.WriteLine ("Next: {0}", O.Path);
}
Catch (Exception E)
{
Console.writeline ("Error:" E);
}
}
}
}