Skip to content

Instantly share code, notes, and snippets.

@maciakl
Created July 1, 2022 04:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maciakl/7da540c8b11ee65f4e87925dd03304b2 to your computer and use it in GitHub Desktop.
Save maciakl/7da540c8b11ee65f4e87925dd03304b2 to your computer and use it in GitHub Desktop.
Interactive helper script to activate Admin account and change it's password
@echo off
if "%1" == "elevated" goto start
powershell -command "Start-Process %~nx0 elevated -Verb runas"
goto :eof
:start
@echo off
cls
CALL :HEAD
CALL :ADMININFO
echo.
choice /M "[A]ctivate, [C]hange Password, or [Q]uit" /C ACQ
echo.
if %ERRORLEVEL% == 1 ( CALL :ACTIVATE )
if %ERRORLEVEL% == 2 ( CALL :CHANGEPW )
if %ERRORLEVEL% == 3 ( goto :eof )
goto :start
:HEAD
cls
echo.
echo Admin Helper
echo ============
echo.
goto :eof
:ADMININFO
echo.
net user Administrator | findstr name
net user Administrator | findstr active
net user Administrator | findstr last
echo.
goto :eof
:CHANGEPW
set /P pw=Entern rew password, then press ENTER:
net user Administrator %PW%
pause
goto :eof
:ACTIVATE
net user Administrator /active:yes
pause
goto :eof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment