Check if user is a Local Administrator

This script will check if the user is part of BUILTINAdministrators, directly named This script will check if the user is a member of BUILTINAdministrators, directly named
or inherited from other local or domain groups
Version 1.5.5
Created on 2020-06-10
Modified on 2020-06-10
Created by Marcel Calef
Downloads: 85

The Script Copy Script Copied to clipboard
@echo off
::  NAME   : Check if user is a Local Administrator
::           This script will check if the user is a member of BUILTIN\Administrators, directly named 
::           or inherited from other local or domain groups
::  CONTEXT: User Session
::  HISTORY: 2020-06-10 Marcel Calef - initial release

:checl_localAdmin

whoami /groups | findstr "BUILTIN\Administrators">NUL
if %errorLevel% == 0 (
        echo   User is a Local Administrator.
    ) else (
        echo   No local admin rights.
    )
:: timeout 15>nul  
:: pause >nul