zh-TW 0404:00000404 zh-TW zh-TW zh-TW $$VT_WINDOWS_DISK_1ST_NONVTOY$$ true 1EFI500 2MSR128 3Primarytrue 11 FAT32 23 NTFSC $$VT_WINDOWS_DISK_1ST_NONVTOY$$3 false W269N-WFGWX-YVC9B-4J6C9-T83GX OnError true IT Department YourCompany * Taipei Standard Time IT Department YourCompany 0404:00000404 zh-TW zh-TW zh-TW true true true true Work 3 true true Admin Administrator Administrators P@ssw0rd! true</PlainText> </Password> </LocalAccount> </LocalAccounts> </UserAccounts> <AutoLogon> <Username>Admin</Username> <Enabled>true</Enabled> <LogonCount>1</LogonCount> <Password> <Value>P@ssw0rd!</Value> <PlainText>true</PlainText> </Password> </AutoLogon> <!-- 首次登入執行的自訂腳本 前 4 條為「不需網路、可獨立成功」的本機指令; Order 5 從 Ventoy USB 把 Setup.ps1 複製到 C:\Scripts\, Order 6 跑 Setup.ps1(13 項 post-install 動作集中在那裡), Order 7 重開機。 各條都會寫獨立 log 到 C:\Windows\Temp\,方便排查無聲失敗。 --> <FirstLogonCommands> <SynchronousCommand wcm:action="add"> <Order>1</Order> <CommandLine>cmd.exe /c net accounts /maxpwage:unlimited</CommandLine> <Description>密碼永不過期</Description> </SynchronousCommand> <SynchronousCommand wcm:action="add"> <Order>2</Order> <CommandLine>powershell.exe -NoProfile -Command "Rename-Computer -NewName ('PC-' + (Get-Random -Minimum 10000 -Maximum 100000)) -Force"</CommandLine> <Description>主機名改成 PC-XXXXX(重開後生效)</Description> </SynchronousCommand> <SynchronousCommand wcm:action="add"> <Order>3</Order> <CommandLine>cmd.exe /c "net user User 1234 /add &amp; net user User /logonpasswordchg:yes"</CommandLine> <Description>建立本機帳號 User(密碼 1234,首次登入強制改密)</Description> <RequiresUserInput>false</RequiresUserInput> </SynchronousCommand> <SynchronousCommand wcm:action="add"> <Order>4</Order> <CommandLine>powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "$log='C:\Windows\Temp\firstlogon-copysetup.log'; New-Item -ItemType Directory -Force -Path C:\Scripts | Out-Null; $src=$null; foreach ($d in (Get-PSDrive -PSProvider FileSystem -EA 0).Root) { $cand=Join-Path $d 'ventoy\script\Setup.ps1'; if (Test-Path $cand) { $src=$cand; break } }; if ($src) { Copy-Item $src 'C:\Scripts\Setup.ps1' -Force; ('OK from ' + $src + ' at ' + (Get-Date -Format o)) | Out-File $log -Append } else { ('NOT FOUND at ' + (Get-Date -Format o)) | Out-File $log -Append }"</CommandLine> <Description>從 Ventoy USB 的 \ventoy\script\Setup.ps1 複製到 C:\Scripts\(log: firstlogon-copysetup.log)</Description> <RequiresUserInput>false</RequiresUserInput> </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% &gt; 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> <RequiresUserInput>false</RequiresUserInput> </SynchronousCommand> <SynchronousCommand wcm:action="add"> <Order>6</Order> <CommandLine>shutdown /r /t 5</CommandLine> <Description>完成後重開機</Description> </SynchronousCommand> </FirstLogonCommands> </component> </settings> </unattend>