applying Disk Quota using CF and windows


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 ?


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CF does not apply the restrictions its Windows itself that can apply the restrictions.
here are some links to Windows Scripting, which you could convert to ColdFusion
Michael_OAuthor Commented:
Thank you for the link. But I'm searching a comprehensive way. can you give me straight link ?
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

Tacobell777Commented: is a comprehensive link - you need to convert this code to CF.
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.

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
I see SetQuota is a sub routine not included in the link I provided, so you might want to use the following
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

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

<cfdump var="#objDiskQuota#">

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
did any of that help you at all?
Michael_OAuthor Commented:
It seems correct, But I didn't have time to check it.

Thank you for your solution.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.