Jump to content

Display Users and Rights


Recommended Posts

This batch file will list the privileges of all users accounts, including those that are disabled or have been removed from the login screen.

 

— Users+Groups.bat —

 

@Echo OFF
SetLocal EnableDelayedExpansion

For /F "SKIP=4 TOKENS=*" %%a In ('net.exe User') Do Call :ProcLine %%a

Echo %CmdCmdline%|findstr.exe /C:"%~N0%~X0""">NUL
If NOT Errorlevel 1 For %%a In (Echo. Pause) Do %%a
Exit /B

:ProcLine
If NOT "%*"=="The command completed successfully." (Set Names=%*
For %%a in (0 25 50) DO Call :ProcName !Names:~%%a,25!)
Goto :EOF

:ProcName
If NOT "%*"=="" (Echo.
Echo User: %*
net.exe Users "%*"|find "Group")

 

— Usage —

 

Double-click the file or execute it from a command line. Use the form Users+Groups.bat>UserRights.txt at a command line to generate a text file of the data.

 

— Technical Notes —

 

Nothing too clever here. %* strips the leading and trailing spaces from the string passed by Call :ProcName.

 

Echo.%CmdCmdline%| findstr.exe /C:"%~N0%~X0""" detects running from the command line, by checking for the batch filename at the end of CmdCmdline, and returning a non-zero Errorlevel if it's missing. (This may count as somewhat clever :whistling: )

Edited by TomGL2
Link to post
Share on other sites

not bad...instead you could simply press windows key+r, type in "control userpasswords2" and see all the information and make necessary changes there.

 

The applet brought up by Control.exe UserPasswords2 is certainly handy, so I've often recommended its use. But it's ill-suited for determining the rights conferred to each user, and disabled accounts aren't shown.

 

The Local Users and Groups console (LUsrMgr.msc) does a little better, as it sees disabled accounts, but ascertaning each user's rights is just as tedious.

 

Then, too, neither generates a list (printable or otherwise) of users and the groups of which they're members.

 

Users+Groups.bat lists all users and their associated groups, optionally to a file suitable for viewing and printing. It's really intended as a diagnostic aid to verify users have the rights (and only those rights) that they require.

 

[ By the way, Control UserPasswords2 actually executes

rundll32.exe netplwiz.dll,UsersRunDll

Which begs the question, why's the old user accounts tool in the Network Places/Map Drives Wizard? ]

Edited by TomGL2
Link to post
Share on other sites

 

 

 

[ By the way, Control UserPasswords2 actually executes

rundll32.exe netplwiz.dll,UsersRunDll

Which begs the question, why's the old user accounts tool in the Network Places/Map Drives Wizard? ]

Because in a network environment, users and the rights they have is extremely important on anything more sophisticated than mom sharing pictures with billy-bob jr. What rights a user has and does not have in a domain logon environment, or other network environment and the files that are available to those people, the permissions they have to alter and or change things is exactly where it should be in the network panel.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...