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
arse1 %%a "%%b"
)
endlocal
goto :EOF
arse1
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
arse2
set wrk=%fld: =%
if %wrk% EQU %fld% goto parse4
set /a pos=0
arse3
set /a pos=%pos% + 1
call set char=%%fld:~%pos%^,2%%
if "%char%" NEQ " " goto parse3
call set fld=%%fld:~0,%pos%%%"
arse4
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