Folder permissions

G

Guest

Guest
Archived from groups: microsoft.public.win2000.file_system (More info?)

Is there a way to gather all the user permissions to shared folders on a
particular server's drive?

Ran cacls on the drive and came up with 26,000 + pages of permissions to
every file on the drive. Overkill to say the least.

How can you get ONLY the folder permissions? There are tons of folders
within other folders.

TIA
DDS
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.file_system (More info?)

On Mon, 8 Nov 2004 16:19:52 -0700, "Danny Sanders" <Danny.Sanders@cpcNOmedSPAM.org> wrote:

>Is there a way to gather all the user permissions to shared folders on a
>particular server's drive?
>
>Ran cacls on the drive and came up with 26,000 + pages of permissions to
>every file on the drive. Overkill to say the least.
>
>How can you get ONLY the folder permissions? There are tons of folders
>within other folders.
>
>TIA
>DDS
>
>

Run
SharedFolderPerms

or

ShareFolderPerms /$

The latter includes shares that end in a $

The output is created in SharedFolderPerms.log in the current directory.

SharedFolderPerms.bat contains:

@echo off
setlocal
if exist SharedFolderPerms.log del /q SharedFolderPerms.log
set exclude=Y
if /i {%1} EQU {/$} set exclude=N
for /f "Tokens=1*" %%a in ('net share ^|FINDSTR /I /L /C:":"') do (
call :parse1 %%a "%%b"
)
endlocal
goto :EOF
:parse1
set shr=%1
set fld=%2
if "%fld:~2,2%" NEQ ":\" goto :EOF
if "%exclude%" EQU "N" goto parse2
set wrk=%shr:$=%
if "%wrk%" NEQ "%shr%" goto :EOF
:parse2
set wrk=%fld: =%
if %wrk% EQU %fld% goto parse4
set /a pos=0
:parse3
set /a pos=%pos% + 1
call set char=%%fld:~%pos%^,2%%
if "%char%" NEQ " " goto parse3
call set fld=%%fld:~0,%pos%%%"
:parse4
set /a pos=%pos% - 1
call set char=%%fld:~%pos%^,1%%
if "%char%" EQU "\" call set fld=%%fld:~1,%pos%%%
@echo Share=%shr%,Folder=%fld%>>SharedFolderPerms.log
cacls %fld% >>SharedFolderPerms.log
for /f "Tokens=*" %%f in ('dir %fld% /b /s /ad') do (
cacls "%%f" >>SharedFolderPerms.log
)
@echo ______________________________________>>SharedFolderPerms.log

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

Guest

Guest
Archived from groups: microsoft.public.win2000.file_system (More info?)

Thanks Jerold.

After getting RMTshare it worked like a charm!!!!

You saved me 15 minutes work every day for the next 645 days!!

They were wanting me to manually copy the permissions for 9600+ folders by
spending 15 minutes a day getting permissions. By my calculations of 15
minutes a day I can get about 15 folders done on a good day, that would have
taken me about 645 days. Not including *any* new folders added during that
time.

Not to mention that when I was done the list would be obsolete because of
new users and new folders.


Thanks a lot

DDS


"Jerold Schulman" <Jerry@jsiinc.com> wrote in message
news:r7g1p05bg8vujjlv28p2tfmm0n0asukckk@4ax.com...
> On Mon, 8 Nov 2004 16:19:52 -0700, "Danny Sanders"
<Danny.Sanders@cpcNOmedSPAM.org> wrote:
>
> >Is there a way to gather all the user permissions to shared folders on a
> >particular server's drive?
> >
> >Ran cacls on the drive and came up with 26,000 + pages of permissions to
> >every file on the drive. Overkill to say the least.
> >
> >How can you get ONLY the folder permissions? There are tons of folders
> >within other folders.
> >
> >TIA
> >DDS
> >
> >
>
> Run
> SharedFolderPerms
>
> or
>
> ShareFolderPerms /$
>
> The latter includes shares that end in a $
>
> The output is created in SharedFolderPerms.log in the current directory.
>
> SharedFolderPerms.bat contains:
>
> @echo off
> setlocal
> if exist SharedFolderPerms.log del /q SharedFolderPerms.log
> set exclude=Y
> if /i {%1} EQU {/$} set exclude=N
> for /f "Tokens=1*" %%a in ('net share ^|FINDSTR /I /L /C:":"') do (
> call :parse1 %%a "%%b"
> )
> endlocal
> goto :EOF
> :parse1
> set shr=%1
> set fld=%2
> if "%fld:~2,2%" NEQ ":\" goto :EOF
> if "%exclude%" EQU "N" goto parse2
> set wrk=%shr:$=%
> if "%wrk%" NEQ "%shr%" goto :EOF
> :parse2
> set wrk=%fld: =%
> if %wrk% EQU %fld% goto parse4
> set /a pos=0
> :parse3
> set /a pos=%pos% + 1
> call set char=%%fld:~%pos%^,2%%
> if "%char%" NEQ " " goto parse3
> call set fld=%%fld:~0,%pos%%%"
> :parse4
> set /a pos=%pos% - 1
> call set char=%%fld:~%pos%^,1%%
> if "%char%" EQU "\" call set fld=%%fld:~1,%pos%%%
> @echo Share=%shr%,Folder=%fld%>>SharedFolderPerms.log
> cacls %fld% >>SharedFolderPerms.log
> for /f "Tokens=*" %%f in ('dir %fld% /b /s /ad') do (
> cacls "%%f" >>SharedFolderPerms.log
> )
> @echo ______________________________________>>SharedFolderPerms.log
>
> Jerold Schulman
> Windows: General MVP
> JSI, Inc.
> http://www.jsiinc.com