From 74824ef7b48e5b794fd94fa7310032685c84b97e Mon Sep 17 00:00:00 2001 From: bin456789 Date: Tue, 26 May 2026 20:24:25 +0800 Subject: [PATCH] =?UTF-8?q?windows:=20=E8=AE=BE=E7=BD=AE=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=AF=86=E7=A0=81=E6=B0=B8=E4=B8=8D=E8=BF=87=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- trans.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/trans.sh b/trans.sh index ef5376f..9c82598 100644 --- a/trans.sh +++ b/trans.sh @@ -3176,7 +3176,20 @@ modify_windows() { bats="$bats windows-set-netconf-$ethx.bat" done - # 5 frp + # 5. 设置用户密码永不过期 + # Azure 的 Windows 实例,初始用户的密码也是永不过期的 + # 管理员账号默认不会过期 + if [ -n "$username" ]; then + cat <$os_dir/windows-set-user-password-never-expires.bat +wmic useraccount where name="$username" set passwordexpires=false || ^ +powershell -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command "Set-LocalUser -Name '$username' -PasswordNeverExpires \$true" +del "%~f0" +EOF + unix2dos $os_dir/windows-set-user-password-never-expires.bat + bats="$bats windows-set-user-password-never-expires.bat" + fi + + # 6. frp if ls /configs/frpc.* >/dev/null 2>&1; then if [ "$(get_windows_arch_from_windows_drive "$os_dir" | to_lower)" = x86 ]; then os_bit=32