cmd: AD 도메인에 배치 처리
개요
수요는 줄어들고 있지만
주로 컴퓨터가 시작될 때 사용한다.
배치 컨텐트
@echo off
rem 管理者権限があるかどうかチェック
whoami /PRIV | find "SeLoadDriverPrivilege" >NUL
if not errorlevel 1 goto start
rem ない場合は powershell 経由で自分自身を実行
powershell.exe -Command Start-Process "%~0" -Verb Runas
goto :EOF
:start
rem ここからバッチ本来の処理
echo.
echo ===============================
echo UACを一時的に無効化します
echo ===============================
echo.
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "ConsentPromptBehaviorAdmin" /t REG_DWORD /d "0" /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "EnableLUA" /t REG_DWORD /d "0" /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "PromptOnSecureDesktop" /t REG_DWORD /d "0" /f
echo ドメインに参加します
wmic ComputerSystem WHERE "name='%computername%'" CALL JoinDomainOrWorkgroup Name="hogehoge.local" Username="administrator" Password="Password" FJoinOptions=3
Del /F "%~dp0%~nx0"
echo.
echo ===============================
echo UACを有効にします
echo ===============================
echo.
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "ConsentPromptBehaviorAdmin" /t REG_DWORD /d "5" /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "EnableLUA" /t REG_DWORD /d "1" /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "PromptOnSecureDesktop" /t REG_DWORD /d "1" /f
exit
Reference
이 문제에 관하여(cmd: AD 도메인에 배치 처리), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://zenn.dev/barusu/articles/8fe357d5ac86ed텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)