antibrowser / setup.ps1
DangPhamPham's picture
Upload setup.ps1 with huggingface_hub
51e7230 verified
Raw
History Blame Contribute Delete
1.46 kB
# ===== GOLDEN IMAGE PREP (chay 1 lan trong Windows truoc khi capture) =====
New-Item -ItemType Directory -Force -Path C:\autosetup | Out-Null
# Tao autosetup.ps1 = chay moi logon: RDP 50000 + extend C: chiem tron dia (moi size)
@'
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v PortNumber /t REG_DWORD /d 50000 /f
netsh advfirewall set allprofiles state off
sc.exe config TermService start= auto
net start TermService
try {
$c = Get-Partition -DriveLetter C
Get-Partition -DiskNumber $c.DiskNumber | Where-Object { $_.PartitionNumber -gt $c.PartitionNumber } | Remove-Partition -Confirm:$false -ErrorAction SilentlyContinue
$max = (Get-PartitionSupportedSize -DriveLetter C).SizeMax
if ($max -gt (Get-Partition -DriveLetter C).Size + 10MB) { Resize-Partition -DriveLetter C -Size $max -ErrorAction SilentlyContinue }
} catch {}
'@ | Out-File -Encoding ASCII C:\autosetup\autosetup.ps1
# Scheduled task: chay luc logon, quyen SYSTEM cao nhat
schtasks /create /tn "AutoSetup" /tr "powershell -NoProfile -ExecutionPolicy Bypass -File C:\autosetup\autosetup.ps1" /sc onlogon /ru SYSTEM /rl HIGHEST /f
# Go winhook cu (neu co)
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v BootPing /f 2>$null
del C:\bootping.cmd 2>$null
"PREP_DONE" | Out-File -Encoding ASCII C:\autosetup\prep_done.txt