系列文章:
由於彰化縣KMS將於2021年11月1日停止服務,資訊組就人仰馬翻要去處理電腦Windows與Office認證。希望能夠只要滑鼠點兩下,讓電腦開機時就完成認證,不需要資訊組再去處理。那如果不想要電腦開機時就完成認證,也只要點兩下就好。
範例檔案下載,解壓密碼demo1234
使用教學影片:
目的:電腦開機自動完成彰化縣Windows KMS認證
檔案名稱:AutoChcWin10Certi.bat
內容:
@echo off
REM ---------------以下是程式碼,不需更改---------------
REM :: BatchGotAdmin (Run as Admin code starts)
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
REM :: BatchGotAdmin (Run as Admin code ends)
REM :: Your codes should start from the following line
REM -------------------關閉UAC------------------------
rem reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "EnableLUA" /d 0 /t REG_DWORD /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "ConsentPromptBehaviorAdmin" /d 0 /t REG_DWORD /f
gpupdate /force
taskkill /f /im explorer.exe
start %systemroot%\explorer
REM -------------------將縣網Win10認證複製到Startup------------------------
copy "%~dp0\KMS\chcwin10_kms.bat" "%HomePath%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
shutdown /r /f /t 0
目的:移除電腦開機自動完成彰化縣Windows KMS認證
檔案名稱:RemoveAutoChcWin10Certi.bat
內容:
@echo off
REM ---------------以下是程式碼,不需更改---------------
REM :: BatchGotAdmin (Run as Admin code starts)
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
REM :: BatchGotAdmin (Run as Admin code ends)
REM :: Your codes should start from the following line
REM -------------------開啟UAC------------------------
rem reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "EnableLUA" /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "ConsentPromptBehaviorAdmin" /d 5 /t REG_DWORD /f
gpupdate /force
taskkill /f /im explorer.exe
start %systemroot%\explorer
REM -------------------刪除Startup縣網Win10認證------------------------
del "%HomePath%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\chcwin10_kms.bat"
shutdown /r /f /t 0
沒有留言:
張貼留言