Link to home
Start Free TrialLog in
Avatar of Bernie Salvaggio
Bernie SalvaggioFlag for United States of America

asked on

Create a user, homedir, and set attributes from a script

Ok, I'm running Windows 2000, active directory.  I'm looking to make my life easier when creating users. I'd like a script that I can run that will prompt me (or just enter it at the command line) for username, first name, and last name, and do the rest.  I've tried a lot of batch file stuff but haven't been able to do everything I want all at once. So here's what I want to do...

Create the user with a username unrelated to their actual name, their first name and last name in their respective fields and together in the display name.
Set the option for User must change password at next logon
Add logon.bat to the Logon script: option
Add the user to a group.
Then, create a folder, share it (hidden) and grant access to the user, and admins.
The share needs to be accessible by both Win98 and 2k/xp clients.
Additionally, if I can add two other groups with specific rights, that'd be great too.

Thanks in advance!
Avatar of PaulADavis
PaulADavis
Flag of United States of America image

check out the ldif utility...
Avatar of Bernie Salvaggio

ASKER

I have, I use it at the beginning of the year to add 250+ students to the network.  That needs a text file to import from though and I don't believe it supports the use of variables, I'd have to edit the text file and type in the name and username a bunch of times, which kind of defeats the purpose of saving time.  Do you know if ldif works for adding to a group, or adding logon.bat to the logon script, or anything else I mentioned in the question? Thanks!
-Update-

Currently I know I can use 'net user' to create the user, but that doesn't set any options like 'User must change pw on next logon' etc..  I have a vb script for adding the logon.bat file.  I can use rmtshare for sharing their folders.  I just haven't figured out a way to streamline it all and fill in the gaps I'm missing.  I've tried checking MS technet scripting center but don't know enough about vbs to make the parts work together to do what I need.
well you can use ldif to create homedir, set the drive letter, and to add group membership....

but i understand what you are saying.... you want something that would allow you to only edit one or two lines...

Do you know where I can look to find how to do what you mentioned with ldif?
ASKER CERTIFIED SOLUTION
Avatar of PaulADavis
PaulADavis
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
http://ldapadmin.sourceforge.net/

this seems interesting... it has the option to add logon script...
if you can use a test machine, see if you can enter a logon script in ldif.....

Script:   %u.cmd
or rather... script: xxxxxx
Thanks, I'll check out what you mentioned and get back to you next week.