Setup.ps1 加 WU 暫停/恢復;unattend.xml Order 5 收 stderr 進 log
- Setup.ps1 開頭暫停 Windows Update(PauseUpdatesExpiryTime + 停 wuauserv/UsoSvc/BITS), 結尾解暫停 + UsoClient 觸發掃描,避免跟 post-install 搶頻寬/CPU - Win11Debloat config 從 here-string 改成 hashtable + ConvertTo-Json, 繞開 PowerShell 5.1 ANSI 讀取時 here-string parse 失敗的 case - Log 函式加 Write-Host,console 視窗能即時看 START/DONE - unattend.xml Order 5 把 stdout+stderr 全部 redirect 到 firstlogon-runsetup.log, Setup.ps1 連 parse error 都會留紀錄;Order 3 改空密碼 + 強制改密
This commit is contained in:
@@ -169,8 +169,8 @@
|
||||
</SynchronousCommand>
|
||||
<SynchronousCommand wcm:action="add">
|
||||
<Order>3</Order>
|
||||
<CommandLine>cmd.exe /c "net user User 1234 /add & net user User /logonpasswordchg:yes"</CommandLine>
|
||||
<Description>建立本機帳號 User(密碼 1234,首次登入強制改密)</Description>
|
||||
<CommandLine>cmd.exe /c "net user User /add & net user User /logonpasswordchg:yes"</CommandLine>
|
||||
<Description>建立本機帳號 User(空密碼,首次登入強制設定新密碼)</Description>
|
||||
<RequiresUserInput>false</RequiresUserInput>
|
||||
</SynchronousCommand>
|
||||
<SynchronousCommand wcm:action="add">
|
||||
@@ -181,8 +181,8 @@
|
||||
</SynchronousCommand>
|
||||
<SynchronousCommand wcm:action="add">
|
||||
<Order>5</Order>
|
||||
<CommandLine>cmd.exe /c "if exist C:\Scripts\Setup.ps1 (powershell.exe -NoProfile -ExecutionPolicy Bypass -File C:\Scripts\Setup.ps1) else (echo SETUP_NOT_FOUND %DATE% %TIME% > C:\Windows\Temp\firstlogon-runsetup.log)"</CommandLine>
|
||||
<Description>執行 Setup.ps1(13 項 post-install:SSH/RDP/WinRM/KMS/Chrome/Debloat/Telegram/RemoveAI/UI/IME/重命名帳號…,log: C:\Windows\Temp\setup.log)</Description>
|
||||
<CommandLine>cmd.exe /c "(echo == firstlogon-runsetup %DATE% %TIME% == & if exist C:\Scripts\Setup.ps1 (powershell.exe -NoProfile -ExecutionPolicy Bypass -File C:\Scripts\Setup.ps1) else (echo SETUP_NOT_FOUND)) > C:\Windows\Temp\firstlogon-runsetup.log 2>&1"</CommandLine>
|
||||
<Description>執行 Setup.ps1(所有 stdout/stderr 都收到 firstlogon-runsetup.log,含 parse error);正常 Setup.ps1 自身寫到 setup.log</Description>
|
||||
<RequiresUserInput>false</RequiresUserInput>
|
||||
</SynchronousCommand>
|
||||
<SynchronousCommand wcm:action="add">
|
||||
|
||||
Reference in New Issue
Block a user