Công cụ quản lý tài khoản User Account Management Tool

Xem
Công cụ quản lý tài khoản User Account Management Tool được viết bằng tập tin batch cho phép bạn quản lý tài khoản người dùng trong Windows hiệu quả. Công cụ cho phép xem danh sách các tài khoản, tạo tài khoản mới hoặc xóa một tài khoản nào đó. Công cụ cũng cho phép kích hoạt, vô hiệu hóa thay đổi hoặc xóa mật khẩu của một tài khoản. Công cụ rất dễ sử dụng không yêu cầu cài đặt và tương thích với tất cả Windows.

Download User Account Management Tool
Mật khẩu giải nén: www.blogthuthuatwin10.com

Code


@echo off

title User Account Management Tool

color 3f

setlocal enabledelayedexpansion

cls

>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"

if "%errorlevel%" NEQ "0" (

echo: Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"

echo: UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"

"%temp%\getadmin.vbs" & exit

)

if exist "%temp%\getadmin.vbs" del /f /q "%temp%\getadmin.vbs"



:: Menu

::=======================================================================================

:Menu

cls

echo.You are signing in with username: %username%

echo.

echo.ID Option

echo.

echo.1 View list user accounts

echo.2 Create a new user

echo.3 Delete user account

echo.4 Enable user account

echo.5 Disable user account

echo.6 Change password

echo.7 Delete password

echo.

choice /c:12345678 /n /m "Select ID for continue : "

if %errorlevel% EQU 1 goto list-user-accounts

if %errorlevel% EQU 2 goto create-a-new-user

if %errorlevel% EQU 3 goto delete-user-account

if %errorlevel% EQU 4 goto enable-user-account

if %errorlevel% EQU 5 goto disable-user-account

if %errorlevel% EQU 6 goto change-password

if %errorlevel% EQU 7 goto delete-password

::=======================================================================================



::View list user accounts

::=======================================================================================

:list-user-accounts

cls

echo.List user accounts

echo.

wmic useraccount where domain='%computername%' get Name,Status

echo.

pause

goto Menu

::=======================================================================================



::Create a new user

::=======================================================================================

:create-a-new-user

cls

choice /c:YN /n /m "Are you sure? (Yes/No) "

if %errorlevel% EQU 1 goto username

if %errorlevel% EQU 2 goto menu



:username

cls

echo.Create a new user

echo.

echo.You can not create a new user already in the list of user accounts below:

echo.

wmic useraccount where domain='%computername%' get Name,Status

set /p usr=Type a name for the new user :

if [!usr!]==[] goto username



:password

set /p pwd=Type a password for the new user (can be left blank) :



echo.

pause

net user /add "%usr%" %pwd%

net localgroup administrators /add "%usr%"

goto user-account-information



:user-account-information

cls

echo.Name of the new user is: %usr%

echo.Password of the new user is: %pwd%

echo.

echo.You must sign out and sign in with your new user account to complete this operation.

choice /c YN /n /m "Would you like to sign out now? (Yes/No) "

if %errorlevel% EQU 1 goto signout

if %errorlevel% EQU 2 goto menu

::=======================================================================================



::Delete user account

::=======================================================================================

:delete-user-account

cls

echo.Delete user account

echo.

echo.Name

for /f "delims=" %%a in ('net localgroup Administrators^|more +6^|find /v "The command completed successfully."') do (

echo.%%a

)

echo.

echo.WARNING: You can not delete Administrator and %username% account.

set /p usr1=Type username for continue if not press M to return Menu :

if [!usr1!]==[] goto enable-user-account

if [!usr1!]==[M] goto Menu

net user "%usr1%" /del

pause

goto Menu

::=======================================================================================



::Enable user account

::=======================================================================================

:enable-user-account

cls

echo.Enable user account

echo.

wmic useraccount where Status='Degraded' get Name

set /p usr2=Type username for continue if not press M to return Menu :

if [!usr2!]==[] goto enable-user-account

if [!usr2!]==[M] goto Menu

net user "%usr2%" /active:yes

pause

goto Menu

::=======================================================================================



::Disable user account

::=======================================================================================

:disable-user-account

cls

echo.Disable user account

echo.

wmic useraccount where Status='OK' get Name

set /p usr3=Type username for continue if not press M to return Menu :

if [!usr3!]==[] goto disable-user-account

if [!usr3!]==[M] goto Menu

net user "%usr3%" /active:no

pause

goto Menu

::=======================================================================================



::Change password

::=======================================================================================

:change-password

cls

echo.Change password

echo.

wmic useraccount where Status='OK' get Name

set /p usr4=Type username for continue if not press M to return Menu :

if [!usr4!]==[] goto change-password

if [!usr4!]==[M] goto Menu

net user "%usr4%" *

pause

goto Menu

::=======================================================================================



::Delete password

::=======================================================================================

:delete-password

cls

echo.Delete password

echo.

wmic useraccount where Status='OK' get Name

set /p usr5=Type username for continue if not press M to return Menu :

if [!usr5!]==[] goto delete-password

if [!usr5!]==[M] goto Menu

net user "%usr5%" ""

pause

goto Menu

::=======================================================================================



::Sign out

::=======================================================================================

:signout

shutdown /l

::=======================================================================================


Hình ảnh minh họa

















Bài Viết Liên Quan:

loading...