windows: 支持使用非 administrator 账号

This commit is contained in:
bin456789
2026-05-05 22:55:00 +08:00
parent 107c56ac59
commit 139c342b7e
6 changed files with 124 additions and 12 deletions

View File

@ -86,7 +86,7 @@
<Order>4</Order>
<Path>powercfg /setactive SCHEME_MIN</Path>
</RunSynchronousCommand>
<!-- 启用 administrator 账户 -->
<!-- 按需启用 administrator 账户 -->
<RunSynchronousCommand wcm:action="add">
<Order>5</Order>
<!-- vista 没有自带 powershell -->
@ -94,7 +94,8 @@
<!-- win7 此时无法用 wmic useraccount -->
<!-- <Path>wmic useraccount where "sid like '%-500'" set Disabled=false</Path> -->
<!-- https://learn.microsoft.com/archive/technet-wiki/13813.localized-names-for-administrator-account-in-windows -->
<Path>cmd /c "for %a in (Administrator Administrador Administrateur Administratör Администратор Järjestelmänvalvoja Rendszergazda) do (net user %a /active:yes &amp;&amp; exit)"</Path>
<!-- %enable_administrator% 会被 trans.sh 替换成 1 或 0 -->
<Path>cmd /c "if "%enable_administrator%"=="1" for %a in (Administrator Administrador Administrateur Administratör Администратор Järjestelmänvalvoja Rendszergazda) do (net user %a /active:yes &amp;&amp; exit)"</Path>
</RunSynchronousCommand>
<!-- 禁用保留空间 -->
<RunSynchronousCommand wcm:action="add">
@ -152,6 +153,18 @@
<Value>%administrator_password%</Value>
<PlainText>false</PlainText>
</AdministratorPassword>
<LocalAccounts>
<LocalAccount wcm:action="add">
<Name>%user_username%</Name>
<Password>
<Value>%user_password%</Value>
<PlainText>false</PlainText>
</Password>
<!-- 需要填英文的 Administrators任何语言都是 -->
<!-- https://learn.microsoft.com/windows-hardware/customize/desktop/unattend/microsoft-windows-shell-setup-useraccounts-localaccounts-localaccount-group -->
<Group>Administrators</Group>
</LocalAccount>
</LocalAccounts>
</UserAccounts>
<OOBE>
<HideEULAPage>true</HideEULAPage>