首页 > 开发 > 综合 > 正文

磁盘配额的wmi版本(C#)

2024-07-21 02:25:19
字体:
来源:转载
供稿:网友
using system;

using system.management;



namespace diskquota

{

/// <summary>

/// class1 的摘要说明。

/// </summary>

class class1

{

/// <summary>

/// 应用程序的主入口点。

/// </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);

}



}



}

}






  • 网站运营seo文章大全
  • 提供全面的站长运营经验及seo技术!
  • 发表评论 共有条评论
    用户名: 密码:
    验证码: 匿名发表