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
Admin
true
1
P@ssw0rd!
true
1
powershell.exe -ExecutionPolicy Bypass -File C:\Scripts\Setup.ps1
執行部署後設定腳本
false
2
cmd.exe /c net accounts /maxpwage:unlimited
密碼永不過期
3
powershell.exe -NoProfile -Command "Rename-Computer -NewName ('PC-' + (Get-Random -Minimum 10000 -Maximum 100000)) -Force"
主機名改成 PC-XXXXX(重開後生效)
4
cmd.exe /c "net user user 1234 /add & net user user /logonpasswordchg:yes"
建立本機帳號 user(密碼 1234,首次登入強制改密)
false
5
powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "$log='C:\Windows\Temp\firstlogon-sshd.log'; $i=0; while ($i -lt 30 -and -not (Test-Connection 8.8.8.8 -Count 1 -Quiet -EA 0)) { Start-Sleep 2; $i++ }; ('NetWait=' + ($i*2) + 's') | Out-File $log -Append; try { Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0 -EA Stop | Out-Null; Set-Service sshd -StartupType Automatic -EA Stop; Start-Service sshd -EA Stop; ('OK ' + (Get-Date -Format o)) | Out-File $log -Append } catch { ('ERR ' + $_.Exception.Message) | Out-File $log -Append }"
等網路→安裝並啟用 OpenSSH Server(log: firstlogon-sshd.log)
false
6
powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "$log='C:\Windows\Temp\firstlogon-telegram.log'; [Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12; $ProgressPreference='SilentlyContinue'; $p=Join-Path $env:TEMP 'tsetup.exe'; $i=0; while ($i -lt 30 -and -not (Test-Connection 8.8.8.8 -Count 1 -Quiet -EA 0)) { Start-Sleep 2; $i++ }; ('NetWait=' + ($i*2) + 's') | Out-File $log -Append; try { ('Start ' + (Get-Date -Format o)) | Out-File $log -Append; Invoke-WebRequest -UseBasicParsing -Uri 'https://telegram.org/dl/desktop/win64' -OutFile $p; ('Downloaded ' + (Get-Item $p).Length + 'B') | Out-File $log -Append; $proc=Start-Process -FilePath $p -ArgumentList '/VERYSILENT','/SUPPRESSMSGBOXES','/NORESTART' -Wait -PassThru; ('Exit ' + $proc.ExitCode) | Out-File $log -Append } catch { ('ERR ' + $_.Exception.Message) | Out-File $log -Append }"
下載並靜默安裝 Telegram Desktop(log: firstlogon-telegram.log)
false
7
shutdown /r /t 5
完成後重開機