{"id":69213,"date":"2005-08-09T04:08:00","date_gmt":"2005-08-09T04:08:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2005\/08\/09\/how-can-i-modify-a-disk-quota-entry-under-windows-2000\/"},"modified":"2005-08-09T04:08:00","modified_gmt":"2005-08-09T04:08:00","slug":"how-can-i-modify-a-disk-quota-entry-under-windows-2000","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/how-can-i-modify-a-disk-quota-entry-under-windows-2000\/","title":{"rendered":"How Can I Modify a Disk Quota Entry Under Windows 2000?"},"content":{"rendered":"<p><H2><IMG class=\"nearGraphic\" title=\"Hey, Scripting Guy! Question\" border=\"0\" alt=\"Hey, Scripting Guy! Question\" align=\"left\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" width=\"34\" height=\"34\"> <\/H2>\n<P>Hey, Scripting Guy! How can I modify a disk quota entry under Windows 2000?<BR><BR>&#8212; CL<\/P><IMG border=\"0\" alt=\"Spacer\" src=\"https:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2019\/05\/spacer.gif\" width=\"5\" height=\"5\"><IMG class=\"nearGraphic\" title=\"Hey, Scripting Guy! Answer\" border=\"0\" alt=\"Hey, Scripting Guy! Answer\" align=\"left\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" width=\"34\" height=\"34\"><A href=\"http:\/\/go.microsoft.com\/fwlink\/?linkid=68779&amp;clcid=0x409\"><IMG class=\"farGraphic\" title=\"Script Center\" border=\"0\" alt=\"Script Center\" align=\"right\" src=\"http:\/\/img.microsoft.com\/library\/media\/1033\/technet\/images\/scriptcenter\/ad.jpg\" width=\"120\" height=\"288\"><\/A> \n<P>Hey, CL. We have some good news and some bad news for you. The bad news is that we\u2019re doing one of those good news-bad news things that nobody ever likes. The good news is that you actually <I>can<\/I> modify a disk quota entry on a Windows 2000 computer. You can\u2019t do this remotely: the script has to run on the same computer as the disk quota entry. But at least it will do what you ask it to.<\/P>\n<P>For example, here\u2019s a script that changes the quota threshold (the point at which a low disk space warning is issued) and the actual disk quota limit. This script changes the quota entry for user kenmyer on drive C of a computer; on Windows 2000 you have to manage quota entries user-by-user, and disk-by-disk. (In other words, no queries that grab all the disk quota entries for all the users on all the disks.)<\/P>\n<P>Here\u2019s the script:<\/P><PRE class=\"codeSample\">Set colDiskQuotas = CreateObject(&#8220;Microsoft.DiskQuota.1&#8221;)\ncolDiskQuotas.Initialize &#8220;C:\\&#8221;, True\nSet objUser = colDiskQuotas.FindUser(&#8220;kenmyer&#8221;)<\/p>\n<p>objUser.QuotaThreshold = 90000000\nobjUser.QuotaLimit = 100000000\n<\/PRE>\n<P>The script begins by creating an instance of the <B>Microsoft.DiskQuota.1<\/B> object. This object is actually part of the so-called Shell Objects for Scripting, which is why the script must run locally: the Shell objects can\u2019t be created on remote computers. Why? That\u2019s like asking why is the grass green or why is the sky is blue: no one knows.<\/P>\n<P>Well, OK, maybe they <I>do<\/I> know why the grass is green and the sky is blue. Nevertheless, don\u2019t try to create the Microsoft.DiskQuota.1 object on a remote machine; it won\u2019t work.<\/P>\n<P>We then call the <B>Initialize<\/B> method to bind to the disk quota information for drive C. As you can see, the Initialize method takes two parameters: the drive we want to connect to (C:) and a second parameter that indicates whether we want to open the drive with read-write access or read-only access. We need read-write access in order to modify a quota entry, so we set this second parameter to True.<\/P>\n<P>After we connect to the disk we need to bind to the disk quota entry for kenmyer; that\u2019s what we do here:<\/P><PRE class=\"codeSample\">Set objUser = colDiskQuotas.FindUser(&#8220;kenmyer&#8221;)\n<\/PRE>\n<P>We then simply specify new values for the <B>QuotaThreshold<\/B> and <B>QuotaLimit<\/B> properties (in bytes) and we\u2019re done. We don\u2019t even have to call a Save method of any kind.<\/P>\n<P>In case you\u2019re wondering, there\u2019s actually quite a bit you can do with disk quotas on Windows 2000; the one limitation is that everything you do must take place on the local machine. For more information, you might check out <A href=\"http:\/\/www.microsoft.com\/technet\/scriptcenter\/guide\/sas_fsd_jmqe.mspx\" target=\"_blank\"><B>this portion<\/B><\/A> of the <I>Microsoft Windows 2000 Scripting Guide<\/I>.<\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hey, Scripting Guy! How can I modify a disk quota entry under Windows 2000?&#8212; CL Hey, CL. We have some good news and some bad news for you. The bad news is that we\u2019re doing one of those good news-bad news things that nobody ever likes. The good news is that you actually can modify [&hellip;]<\/p>\n","protected":false},"author":595,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[708,3,12,5],"class_list":["post-69213","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-disk-quotas","tag-scripting-guy","tag-storage","tag-vbscript"],"acf":[],"blog_post_summary":"<p>Hey, Scripting Guy! How can I modify a disk quota entry under Windows 2000?&#8212; CL Hey, CL. We have some good news and some bad news for you. The bad news is that we\u2019re doing one of those good news-bad news things that nobody ever likes. The good news is that you actually can modify [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/69213","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/595"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=69213"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/69213\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=69213"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=69213"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=69213"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}