Using System;
Using System.Management;
Namespace DiskQuota
{
<summary>
Summary description of the CLASS1.
</summary>
Class Class1
{
<summary>
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);
foreach (ManagementObject o in C.getinstances ())
Console.WriteLine ("Next: {0}", O.path);
}
catch (Exception e)
{
Console.WriteLine ("Error:" + E);
}
}
}
}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.