Disk quota with WMI

xiaoxiao2021-03-06  102

YOU JUST NEED TO CREATE A New Instance of a Win32_quotadisk Class.

Something Like this kind of ... (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 Wrote in Message

News: ekysgqcleha.2388@tk2msftngp09.phx.gbl ...

转载请注明原文地址:https://www.9cbs.com/read-104333.html

New Post(0)