• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

need help in writing script

Hello,
can anyone tell me if you can write a logon script that will create a home directory for a user and also assign a disk quota to that home diretory?


 

Using Windows 2000 I assume.

Here's a few lines of batch code that will make a home directory. I'm assuming a few things like the drive letter D: and whatnot.

md d:\user\%1
echo y| cacls d:\user\%1 /c /g "creator owner":f BUILTIN\administrators:f "DOMAIN ADMINS":F %1:f
rmtshare \\%computername%\%1$=d:\user\%1 /grant %1:f /grant "DOMAIN ADMINS":f /remove everyone

Line 1 above makes the folder for the given user.
Line 2 sets the file permissions. (cacls doesn't have a /y switch so I piped one from the echo command)
Line 3 uses a 'rmtshare' tool from the resource kit to create the share. Without rmtshare I think the only option is to use the 'net share' command but it doesn't allow you to fool with permissions.

As for quotas: I'm using a 3rd party util here on the NT network that comes with it's own command line interface for stuff like this. If you are using .NET or XP you can fool with quotas using the 'fsutil' commmand but in w2k I think you might be in for some trouble. Set a default disk quota with the GUI before you begin and just allow the new home directory to assume the default. You can also checkout this MS kbase article if you MUST do it from command line: Q320047

You can also fool with quotas using vbScript. I'm definately NOT a pro in this area, but here's some sample code that can be copied and pasted into a .vbs file.

Set colDiskQuotas = CreateObject("Microsoft.DiskQuota.1")
colDiskQuotas.Initialize "D:\", True
set objUser = colDiskQuotas.FindUser("jsmith")
objUser.QuotaThreshold = 90000000
objUser.QuotaLimit = 100000000

Hope this has been some help.


 
Back
Top