Is there anything I can call from the command line which will tell me if the currently logged in user has a limited account or is an admin?
Asked
Active
Viewed 4.1k times
3 Answers
16
With the default command tools (no third party downloads) you can use the net command.
%username% will have the username of the current logged on user, so I would use:
net user "%username%"
To display information about the current logged on user. The last section of this shows:
Local Group Memberships *Administrators *HelpLibraryUpdaters
*HomeUsers
Global Group memberships *None
Hope this helps
Synetech
- 69,547
William Hilsum
- 117,648
1
You can try this:
net user "%username%" | find /i "*Administrators" >nul 2>&1
if %errorlevel% equ 0 (echo Current user is admin) else (echo Current user is not admin)
wasif
- 9,176