unattend.xml 直接以 User(首字大寫)建帳號;Setup.ps1 拿掉 rename-LocalUser

把 Order 3 的 net user 命令直接寫成 net user User,省掉「先建小寫 user 再
Rename-LocalUser 改成大寫 User」這個迂迴。Setup.ps1 的 rename-hide-accounts
段同時改名為 hide-admin-account,內容只剩設 SpecialAccounts\\UserList\\Admin=0
這一行——隱藏 Admin 仍然由 Setup.ps1 負責。

文件全部同步:DEPLOY/QUICKSTART/SUMMARY/README/CLAUDE 把「先建小寫再改名」的
bulletproof 解釋與相關段名都拿掉。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-27 13:59:15 +08:00
parent c84e18bd9d
commit b1e5b6912a
7 changed files with 15 additions and 25 deletions

View File

@@ -233,15 +233,8 @@ Section 'apply-ui-ime-default-profile' {
}
}
Section 'rename-hide-accounts' {
$u = Get-LocalUser -Name 'user' -ErrorAction SilentlyContinue
if ($u -and $u.Name -ceq 'user') {
Rename-LocalUser -Name 'user' -NewName 'User'
Log 'Renamed user -> User'
} else {
Log "Local user 'user' not found or already renamed; skip"
}
Section 'hide-admin-account' {
# 帳號 User 在 unattend.xml Order 3 已直接以大寫建立,這裡只負責把 Admin 從登入畫面藏掉
$userListKey = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList'
Set-RegValue $userListKey 'Admin' 0 # 0 = 從登入畫面隱藏(帳號仍存在仍可用)
}