Re: script to create home folder, assign correct permissions and map to it
From: Eugene Mindrov (reaperman_at_mail.nnov.ru)
Date: 10/22/04
- Next message: Nuno Ricardo: "Re: How to compare 2 files"
- Previous message: James: "Re: How to compare 2 files"
- In reply to: Tony: "script to create home folder, assign correct permissions and map to it"
- Next in thread: Gerry Hickman: "Re: script to create home folder, assign correct permissions and map to it"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 22 Oct 2004 16:21:23 +0400
Hello, Tony!
You wrote on Thu, 21 Oct 2004 10:43:16 -0700:
T> Any help or advice appreciated
I wouldn't post the complete solution here ;) 'cos I think it's best for
anyone to develop most suited one him(her)self, but here're some clues:
If you've got domain (which I hope you have ;)) then you should
1. Get the list of domain users. Use can do this using one of the following
techniques:
a. 'net user' command-line utility (it turned out to be little tricky
though ;) 'cos its output differs slightly depending on whether it runs on
domain controller or not)
b. 'dsget' and 'dsquery' command-line utilites (if you've got 2003
environment)
c. if you don't wanna leave wsh ;) then you can query AD with LDAP or
ADO (see good example of enumerating computer accounts here:
http://www.microsoft.com/resources/documentation/windows/2000/server/scriptguide/en-us/sas_srv_lxfr.mspx -
slight modification and you can query user accounts just as easily :))
2. Now when you get all the user accounts you can cycle through them and
create home folder for each user matching his(her) account name by using
either Scripting.FileSystemObject or by using 'mkdir' shell command.
3. After you've successfully created home folder for a user, you gotta set
appropriate permissions for it. That's the most tricky part if you still
wanna do this using WSH ;) AFAIK handling ACLs from WSH is not the most easy
part at all :( So I prefer to use good old command-line utility - 'cacls'.
Using it you can set necessary permissions for home folder in no time (I
ordinarily allow 'full control' for admins & 'change' for the user)
4. And, at last, you gotta change home folder info in AD for the user, using
either homeDirectory property of the user account in WSH, or using
abovementioned 'net user' command-line utility with /homedir parameter.
As for me, I wrote simple cmd-script that checks availability of home dir
for every user account in a domain and creates it in case it's not found.
Pity I have solved this task without using WSH :)
-- With best regards, Eugene Mindrov. E-mail: reaperman@mail.nnov.ru
- Next message: Nuno Ricardo: "Re: How to compare 2 files"
- Previous message: James: "Re: How to compare 2 files"
- In reply to: Tony: "script to create home folder, assign correct permissions and map to it"
- Next in thread: Gerry Hickman: "Re: script to create home folder, assign correct permissions and map to it"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|