Hi all,

I loged into windows 2003 server with an user name and password.I need to check whether My account is having administrative rights using the command prompt.


I tried to install an application in between it through a message as it is not an administrative user.

I need to run a script or bat file so that it will show whether the current user is having administrative right.


Please help

Dani AI

Generated

asked for a command-line check for local admin rights on Windows Server 2003. 's GUI suggestions and 's pointer to the Local Users & Groups MMC are useful, but a small batch file gives a repeatable, scriptable result. Two safe approaches follow: (A) check whether the current account is explicitly listed in the local Administrators group (fast but not exhaustive), and (B) attempt an admin-only operation to test effective privileges (reliable for determining what the current token can actually do).

@echo off
rem -- Method A: explicit local Administrators membership
set "full=%USERDOMAIN%\%USERNAME%"

net localgroup Administrators | findstr /I /C:"%full%" >nul 2>&1
if %errorlevel%==0 (
  echo %full% is explicitly in the local Administrators group.
  exit /b 0
)

net localgroup Administrators | findstr /I /C:"%USERNAME%" >nul 2>&1
if %errorlevel%==0 (
  echo %USERNAME% is explicitly in the local Administrators group.
  exit /b 0
)

echo Not explicitly listed in local Administrators (membership may be via a group).
exit /b 1
@echo off
rem -- Method B: test an admin-only operation (effective privilege test)
fsutil dirty query %systemdrive% >nul 2>&1
if %errorlevel%==0 (
  echo Effective administrative privileges: YES
  exit /b 0
) else (
  echo Effective administrative privileges: NO
  exit /b 1
)

Notes and caveats: Method A only detects explicit membership; if the account inherits admin rights through a domain group (e.g., Domain Admins added to local Administrators), the user name may not appear and Method A will report “not listed.” Method B reports whether the current token can perform an admin-only action (recommended when accuracy matters). On Windows Server 2003 there is no UAC elevation to confuse results. Save either snippet as a .bat and run from cmd.exe; exit code 0 indicates admin in each test.

Recommended Answers

All 4 Replies

Are you wanting to check local (just the computer) admin rights, or domain rights???

yes I am looking for local machine.
Not for Domain right's

oh, for local admin rights that is easy to check.

Make sure you can install something. See if you can get into and system configurations like msconfig (Start > Run > type msconfig > hit enter), see if you can get into control panel, see if you can change the time, see if you can see a new desktop and / or screensaver.

If you can't do most of those, then you don't have local admin rights.

That is how i can check at school :P :D

if you are unable to run lusrmgr.msc, then you don't have local admin priveledges

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.