Sign in with
Sign up | Sign in
Your question

listing of all rights granted to a user

Last response: in Windows 2000/NT
Share
Anonymous
December 3, 2004 4:49:01 PM

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

I would like to know what rights a specific user has in our domain,
specifically what shares this user has rights to.
Anonymous
December 4, 2004 11:22:13 AM

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

On Fri, 3 Dec 2004 13:49:01 -0800, "peichar" <peichar@discussions.microsoft.com> wrote:

>I would like to know what rights a specific user has in our domain,
>specifically what shares this user has rights to.

Using RMTShare.exe from tip 6353 in the 'Tips & Tricks' at http://www.jsiinc.com

@echo off
if {%2}=={} @echo Syntax: UserSharePerms UserOrGroup ServerName1 [ServerName2 ... ServerNameN]&goto :EOF
setlocal
set UserOrGroup=%1
set UserOrGroup=%UserOrGroup:"=%
:loop
if {%2}=={} goto finish
set server=%2
shift
set server=%server:\=%
for /f "Skip=4 Tokens=*" %%s in ('rmtshare \\%server%') do (
if /i "%%s" NEQ "The command completed successfully." set line=%%s&call :p arses
)
goto loop
:finish
endlocal
goto :EOF
:p arses
set work=%line: =#%
set /a cnt=0
set share=
:p loop
call set char=%%work:~%cnt%^,1%%
if "%char%" EQU "#" goto getshare
if "%char%" EQU ":" goto fixshare
set share=%share%%char%
set /a cnt=%cnt% + 1
if %cnt% LSS 65 goto ploop
goto :EOF
:fixshare
set /a cnt=%cnt% - 2
call set share=%%share:~0,%cnt%%%
:getshare
set Perm=N
for /f "Skip=3 Tokens=*" %%p in ('rmtshare \\%server%\"%share%"') do (
set line=%%p&call :p arsep
)
goto :EOF
:p arsep
if /i "%line%" EQU "The command completed successfully." goto :EOF
if "%Perm%" EQU "Y" goto parsep1
if /i "%line%" EQU "Permissions:" set Perm=Y
goto :EOF
:p arsep1
for /f "Tokens=1* Delims=:" %%a in ('@echo %line%') do set who=%%a#&set what=#%%b
set who=%who: #=%
set who=%who:#=%
set OK=N
for /f "Tokens=*" %%u in ('@echo %who%^|FINDSTR /I /L /C:"%UserOrGroup%"') do (
set OK=Y
)
if /i "%OK%" NEQ "Y" goto :EOF
set what=%what:# =%
set what=%what:#=%
@echo "\\%server%\%share%" "%who%" "%what%"


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