listing of all rights granted to a user

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.
1 answer Last reply
More about listing rights granted user
  1. 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 :parses
    )
    goto loop
    :finish
    endlocal
    goto :EOF
    :parses
    set work=%line: =#%
    set /a cnt=0
    set share=
    :ploop
    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 :parsep
    )
    goto :EOF
    :parsep
    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
    :parsep1
    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
Ask a new question

Read More

Domain Microsoft Active Directory Windows