Folders and Rights

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I need you help!!!, I will create 300 folders that have the name of the
users with the rights only for this user and for Administrators, and create
the Sharing only for these user, is same the %Home% of the Users...

For Example: The User CarlosC...
Folder Name: CarlosC
NTFS rights: Administrators Full Control, CarlosC Change
Sharing Name: U_CarlosC$
Sharing Rights: CarlosC Change

Do you know a script or similar that I can use?

Thanks in advance (And sorry for my English)
 
Hi,

I need you help!!!, I will create 300 folders that have the name of the
users with the rights only for this user and for Administrators, and create
the Sharing only for these user, is same the %Home% of the Users...

For Example: The User CarlosC...
Folder Name: CarlosC
NTFS rights: Administrators Full Control, CarlosC Change
Sharing Name: U_CarlosC$
Sharing Rights: CarlosC Change

Do you know a script or similar that I can use?

Thanks in advance (And sorry for my English)

On the server that will host the shares, create the parent folder, like C:\Users.
Turn of inheritance from C: and set permission on C:\Users to
Administrators F
System F

The user folders that we create under C:\Users will inherit these permissions.

Using GetUsers from tip 7964 in the 'Tips & Tricks' at http://www.jsiinc.com ,
CACLS from tip 1556 and link, and subInAcl from tip 8530, run the following
CreateUserFolder.bat job: CreateUserFolder C:\Users

@echo off
if {%1}=={} @echo Syntax: CreateUserFolder FolderPath&goto :EOF
if not exist %1 @echo CreateUserFolder - %1 does not exist.&goto :EOF
setlocal
set folder=%1
pushd %folder%
for /f "Tokens=*" %%u in ('getusers') do (
MD %%u
echo y| cacls %%u /E /C /G %USERDOMAIN%\%%u:F
subinacl /share \\%ComputerName%\U_%%u$ /GRANT=%USERDOMAIN%\%%u=C
)
popd
endlocal

NOTE: I haven't tested this script. The script assumes that there are no spaces in user name.


Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
Hi,

I need you help!!!, I will create 300 folders that have the name of the
users with the rights only for this user and for Administrators, and create
the Sharing only for these user, is same the %Home% of the Users...

For Example: The User CarlosC...
Folder Name: CarlosC
NTFS rights: Administrators Full Control, CarlosC Change
Sharing Name: U_CarlosC$
Sharing Rights: CarlosC Change

Do you know a script or similar that I can use?

Thanks in advance (And sorry for my English)


Oops. I forgot the net share command

@echo off
if {%1}=={} @echo Syntax: CreateUserFolder FolderPath&goto :EOF
if not exist %1 @echo CreateUserFolder - %1 does not exist.&goto :EOF
setlocal
set folder=%1
pushd %folder%
for /f "Tokens=*" %%u in ('getusers') do (
MD %%u
echo y| cacls %%u /E /C /G %USERDOMAIN%\%%u:F
net share U_%%u$=%folder%\%%u
subinacl /share \\%ComputerName%\U_%%u$ /GRANT=%USERDOMAIN%\%%u=C
)
popd
endlocal


Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
Hi,

I need you help!!!, I will create 300 folders that have the name of the
users with the rights only for this user and for Administrators, and create
the Sharing only for these user, is same the %Home% of the Users...

For Example: The User CarlosC...
Folder Name: CarlosC
NTFS rights: Administrators Full Control, CarlosC Change
Sharing Name: U_CarlosC$
Sharing Rights: CarlosC Change

Do you know a script or similar that I can use?

Thanks in advance (And sorry for my English)

More Oops.

I forgot to remove Everyone from the share.

@echo off
if {%1}=={} @echo Syntax: CreateUserFolder FolderPath&goto :EOF
if not exist %1 @echo CreateUserFolder - %1 does not exist.&goto :EOF
setlocal
set folder=%1
pushd %folder%
for /f "Tokens=*" %%u in ('getusers') do (
MD %%u
echo y| cacls %%u /E /C /G %USERDOMAIN%\%%u:F
net share U_%%u$=%folder%\%%u
subinacl /share \\%ComputerName%\U_%%u$ /GRANT=%USERDOMAIN%\%%u=C /Revoke=Everyone
)
popd
endlocal



Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
One more OOPS and you're out! :-)

--

Thanks,
Mike

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Please do not send e-mail directly to this alias.
This alias is for newsgroup purposes only.
 
Thanks a lot!!! :-D

Jerold Schulman said:
More Oops.

I forgot to remove Everyone from the share.

@echo off
if {%1}=={} @echo Syntax: CreateUserFolder FolderPath&goto :EOF
if not exist %1 @echo CreateUserFolder - %1 does not exist.&goto :EOF
setlocal
set folder=%1
pushd %folder%
for /f "Tokens=*" %%u in ('getusers') do (
MD %%u
echo y| cacls %%u /E /C /G %USERDOMAIN%\%%u:F
net share U_%%u$=%folder%\%%u
subinacl /share \\%ComputerName%\U_%%u$ /GRANT=%USERDOMAIN%\%%u=C /Revoke=Everyone
)
popd
endlocal



Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top