steps/ 把 Setup.ps1 拆成 18 個獨立步驟(00-17),每段:
- _common.ps1 提供 Log/Section/Set-RegValue/Wait-Network helper
- 各段一個 .ps1 + 同名 .bat(自動 UAC 提權)
- _admin-shell.bat 開一個已提權 cmd,從那裡跑各 .bat 不再被 UAC 問
- RUN-ALL.bat 依序跑 00..17
- _template.bat 全部 .bat 共用樣板
- README.txt 用法說明
從 macOS WinRM 端對端跑過所有 18 段、發現並修:
- 02-rdp-enable-3389:'Remote Desktop' display group 在某些 Win11 SKU 不存在,
改顯式 New-NetFirewallRule + Restart-Service TermService
- 04-winrm-enable:開頭加 Set-NetConnectionProfile -NetworkCategory Private fallback,
避免 winrm quickconfig 在 Public profile 拒絕啟用
- 11-kms-activate:原本 'successful|成功' 正則在 Big5 codepage 下 mojibake 出 '{x,y}',
改用 SoftwareLicensingProduct.LicenseStatus -eq 1 WMI 判斷
- 12-winget-install-chrome:加 --source winget,避開 msstore 憑證錯誤造成的歧義
- 13-remove-windows-ai:拿掉 -AllOptions,顯式 10 個 option 排除 UpdateCleanupCheck
(DISM Cleanup-Image + sfc + MessageBox 在 Session-0 default Yes 觸發 Restart-Computer)
- 14-win11debloat:加 -Sysprep(寫到 Default profile 不撞 HKCU 鎖),
從 config 移除 DisableSearchHistory/DisableSearchHighlights/HideSearchTb
(它們的 reg.exe import 會被「存取被拒」擋住)
- 07-apply-ui-ime-default-profile:補上 IsDeviceSearchHistoryEnabled / IsDynamicSearchBoxEnabled
替代上面從 Win11Debloat 拔掉的兩項
- 新增 00-network-private 步驟把所有 NetConnectionProfile 改 Private
- 全部 19 個 .ps1 加 UTF-8 BOM,避免 CHT Windows PS5.1 fallback ANSI 讀中文 mojibake
- 全部 .bat REM 註解改 ASCII,根除「'券蠶setup.log' 不是內部命令」那種亂碼
Run-Setup.bat:當 unattend.xml FirstLogonCommands 沒成功跑起 Setup.ps1 時,
把這支從 USB 雙擊執行,會 UAC 提權 + 從 USB 重拷 + 跑 + console 即時印 + 收 log
54 lines
2.2 KiB
Plaintext
54 lines
2.2 KiB
Plaintext
steps/ — 拆解後的 post-install 步驟,每段一個 .bat 雙擊執行
|
||
==========================================================
|
||
|
||
用法
|
||
----
|
||
1. 把 USB 插上 Windows 機器
|
||
2. 用檔案總管打開 D:\ventoy\script\steps\(D 換成 USB 在 Windows 看到的代號)
|
||
3. 雙擊任一個 NN-xxx.bat(會自動 UAC 提權)
|
||
4. 黑色 console 視窗會即時顯示 START / DONE / ERR
|
||
5. 跑完按任意鍵關掉視窗
|
||
|
||
想一次跑完,雙擊 RUN-ALL.bat 即可。
|
||
|
||
順序建議
|
||
--------
|
||
Phase 1(不需要網路;本機設定)
|
||
01-firewall-ssh-22 防火牆開 SSH 22
|
||
02-rdp-enable-3389 打開 RDP
|
||
03-icmp-echo-allow 允許 ping
|
||
04-winrm-enable 啟用 WinRM
|
||
05-onedrive-remove 移除 OneDrive
|
||
06-cortana-websearch-off 關 Cortana / Web Search
|
||
07-apply-ui-ime-default-profile UI/IME 預設套到 Default profile
|
||
08-hide-admin-account 把 Admin 從登入畫面藏掉
|
||
09-pause-windows-update 暫停 WU(避免下面動作搶頻寬)
|
||
|
||
Phase 2(需要網路;下載安裝)
|
||
10-openssh-server-install OpenSSH Server FoD
|
||
11-kms-activate KMS 啟用
|
||
12-winget-install-chrome 裝 Chrome
|
||
13-remove-windows-ai RemoveWindowsAI 線上腳本
|
||
14-win11debloat Win11Debloat(讀同目錄 win11debloat-config.json)
|
||
15-remove-uwp-apps 批次移除 UWP
|
||
16-install-telegram 裝 Telegram
|
||
|
||
收尾
|
||
17-resume-trigger-wu 解除 WU 暫停 + 觸發掃描
|
||
|
||
Log
|
||
---
|
||
所有 step.ps1 共用同一個 log:
|
||
C:\Windows\Temp\setup.log
|
||
|
||
每段會印 [時間] === 段名 START === / DONE === / ERR ===
|
||
|
||
檔案結構
|
||
--------
|
||
_common.ps1 共用 helper(Log / Section / Set-RegValue / Wait-Network)
|
||
_template.bat .bat 樣板(不要動)
|
||
NN-xxx.ps1 各段邏輯
|
||
NN-xxx.bat 各段 .bat(自動 UAC + 跑 .ps1)
|
||
win11debloat-config.json 14 段用的 JSON 設定
|
||
RUN-ALL.bat 依序跑 01..17 全部
|