• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 225
  • Last Modified:

applying Disk Quota using CF and windows

Hi,

I want to apply disk quote to users using CF in Windows server 2003. Is there any way to do it ? How can I imply transfer restriction to a specific user ?

Regards,

Michael
0
Michael_O
Asked:
Michael_O
  • 7
  • 2
1 Solution
 
Tacobell777Commented:
CF does not apply the restrictions its Windows itself that can apply the restrictions.
0
 
Tacobell777Commented:
here are some links to Windows Scripting, which you could convert to ColdFusion

http://www.google.com.au/search?hl=en&q=wscript+windows+2003+disk+quota&meta=
0
 
Michael_OAuthor Commented:
Thank you for the link. But I'm searching a comprehensive way. can you give me straight link ?
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
Tacobell777Commented:
http://www.winnetmag.com/Articles/Print.cfm?ArticleID=23973 is a comprehensive link - you need to convert this code to CF.
0
 
Tacobell777Commented:
and because I am such a nice guy I converted some of it for you to get you going, no guarantee it will work... Somethign like this is not easy and you need to start at the bottom and know what you are doing.

<cfscript>
strDomain = "COMPANYA";            //::: Name of Win2K/Windows NT domain
strVolume = "D:\";                  //::: Which disk volume to work on
intDefaultSize = 20;            //::: Default quota for this volume
//::: Set default quota for disk volume.
writeOutput( "Setting initial quota of " & intDefaultSize & "MB for all users on " & strVolume & " volume" );

objDQ = createObject("com", "Microsoft.DiskQuota.1");
objDQ.Initialize( strVolume, TRUE );
objDQ.DefaultQuotaLimit = intDefaultSize * MEG;
objDQ.DefaultQuotaThreshold = intDefaultSize * MEG;

//::: Call the subroutine once for each required group. Change to suit your
//::: own environment. Do smallest quotas first so that if a user is a member
//::: of more than one of the groups, the larger quota will apply.
SetQuota( "Sales", 50 );      //::: e.g., 50MB for members of sales group
SetQuota( "Marketing", 100 ); //::: e.g., 100MB for members of marketing group
SetQuota( "Technical", 250 ); //::: e.g., 250MB for members of technical group
</cfscript>
0
 
Tacobell777Commented:
I see SetQuota is a sub routine not included in the link I provided, so you might want to use the following

http://www.winnetmag.com/Files/43195/Listing_01.txt
0
 
Tacobell777Commented:
OK I got a bit carried away and wrote some code myself.

But this is the best I can do, in the end it all depends on exactly what you want to do, but the following simply creates the object, makes sure disk quota is enabled and adds a user

<cfscript>
// The volume you are working with
variables.volume = "E:\\";
// The username of the user you are working with
variables.username = "test";
// Create the object
objDiskQuota = createObject( "com", "Microsoft.DiskQuota.1" );
// Initialize the object
objDiskQuota.initialize( variables.volume, 1 );
// Enable the Disk Quota
objDiskQuota.quotaState = 2;
// Add a user to the quota
objDiskQuota.addUser( variables.username );

</cfscript>
<cfdump var="#objDiskQuota#">

For more details on the diskquota object, visit the following link..

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/objects/diskquotacontrol/diskquotacontrol.asp
0
 
Tacobell777Commented:
did any of that help you at all?
0
 
Michael_OAuthor Commented:
It seems correct, But I didn't have time to check it.

Thank you for your solution.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 7
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now