« Tiny VPN | Main | あとで読む »

Oct 18, 2006

アカウントコントロール バッチ

アクティブディレクトリ管理をしている環境にて
アカウントの操作(アカウントの有効・無効、パスワード変更、ステータス確認)を
行うメニュー付きバッチを作成しました。

Account.bat
----
@ECHO OFF

:INITIALIZATION

SET USER_NAME=%1
SET PASSWD=%2

:MENU

cls
SET CHECK=
ECHO ################################
ECHO.
ECHO   Acoount control MENU
ECHO.
ECHO   1. Account Enable
ECHO   2. Account Disable
ECHO   3. Password change
ECHO   4. Status check
ECHO   5. Exit
ECHO.
ECHO   User name: %USER_NAME%
ECHO.
ECHO ################################

SET/P CHECK="Pleae choice number [1] or [2] or [3] or [4] or [5]
[%CHECK%]:"

IF %CHECK% == GOTO END
IF %CHECK% == 1 GOTO 1AEnable
IF %CHECK% == 2 GOTO 2ADisable
IF %CHECK% == 3 GOTO 3PChange
IF %CHECK% == 4 GOTO 4SCheck
IF %CHECK% == 5 GOTO 5END

:1AEnable
net user %USER_NAME% /active:yes /domain
echo Please "Enter" back to MENU
PAUSE > nul
GOTO MENU

:2ADisable
net user %USER_NAME% /active:no /domain
echo Please "Enter" back to MENU
PAUSE > nul
GOTO MENU

:3PChange
if %PASSWD% == "" go to ERROR
net user %USER_NAME% %PASSWD% /active:yes /domain
echo Please "Enter" back to MENU
PAUSE > nul
GOTO MENU

:4SCheck
net user %USER_NAME% /domain
echo Please "Enter" back to MENU
PAUSE > nul
GOTO MENU

:5END
echo If you push "Enter" it's fine
PAUSE > nul
cls
exit

:ERROR
echo Please check your input Argument
PAUSE > nul
----

←クリック一票

|

« Tiny VPN | Main | あとで読む »

Script」カテゴリの記事

Comments

Post a comment



(Not displayed with comment.)


Comments are moderated, and will not appear on this weblog until the author has approved them.



TrackBack

TrackBack URL for this entry:
http://app.cocolog-nifty.com/t/trackback/68055/12334593

Listed below are links to weblogs that reference アカウントコントロール バッチ:

« Tiny VPN | Main | あとで読む »