You just need to create a new instance of a win32_quotadisk class. Something like this should do... (error checking omitted!) ..... 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=domainName,Name=someUsername"); account.Get(); // get disk object ManagementObject disk = new ManagementObject("Win32_LogicalDisk.DeviceId='d:'"); disk.Get(); quota["QuotaVolume"] = disk; quota["User"] = account; quota.Put(); // commit Willy. "Nikolaj Pedersen via .NET 247" <anonymous@dotnet247.com> wrote in message news:eKYSgqCLEHA.2388@TK2MSFTNGP09.phx.gbl...
利用WMI进行磁盘配额
最新推荐文章于 2024-11-01 10:42:19 发布