RE: How to Create User Shares for Group of Users by Avil
Avil
Tue Feb 22 01:10:27 CST 2005
Appreciate if you could give me a simple script in details.
I have the users list in a excel file in a column.
Thanks,
Avil
>-----Original Message-----
>
>'|-------------------------------------------------------|
>'|Script Tom
Holland |
>'|This Script Assumes Your CSV is a Single String|
>'|ie. user1,user2,user3,user4,user5,user6 |
>'|You Will Also Need To Create A Batch File |
>'|Described at the end of this file. put in root |
>'|of the file server you will be using
|
>'|-------------------------------------------------------|
>
>Dim objShell : Set objShell = CreateObject
("WScript.Shell")
>Dim iReturn : iReturn = 0
>Dim objFSO : Set objFSO = CreateObject
("Scripting.FileSystemObject")
>Const ForReading = 1
>Const sYourFile = "<your file location>"
>Const sDomain = "Your Domain"
>Const sBatchName = "Your back File, The script should be
run on the server,
>and the batch should localize location"
>Dim objFileReader : Set objFileReader =
objFSO.OpenTextFile
>sYourFile,ForReading
>Dim aUsers(1000)
>Dim sReadString : sReadString = objFileReader.ReadLine
>Dim iCount, iCounter : iCounter = 0
>
>Do While Not objFileReader.AtEndOfStream
> load the user names individually into the array.
Increment iCount
>Loop
>
>While (iCounter < iCount)
>
> iReturn = objShell.Run(sBatchName & " " & aUsers
(iCounter) & " " &
>aUsers(iCounter) & "$" & " " & sDomain & aUsers(iCounter))
> iCounter = iCounter + 1
>
>wend
>
>wscript.quit(0)
>
>'----------------
>'Batch File Below
>'----------------
>
>
>set your base drive
>create the dir with %1, (md %1)
>use cacls with something like (cacls %1 /G <your domain>\%
3 <your
>domain>\administrators)
>use net to create share with %2, (net share %2=<your
drive>\%1 /users:2)
>
>"Avil" wrote:
>
>> Hi,
>> I have list of users in a csv file(300 users) and I
have
>> to create a shared folder with the same name as their
>> userID, share them as userid$ and set individual
>> permissions for those folders. Only the Domain Admin
and
>> the individual owner of the folder should have full
access
>> to the folder. Can anyone help me out with this. Thanks
in
>> advance.
>>
>.
>