antibrowser / prep.ps1
DangPhamPham's picture
Upload prep.ps1 with huggingface_hub
d2e30ea verified
Raw
History Blame Contribute Delete
2.18 kB
# ===== PREP Win10 clean (chay as Admin TRUOC sysprep) =====
# 1) RDP port 50000 + firewall off + TermService auto
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
netsh advfirewall firewall add rule name=rdp50000 dir=in action=allow protocol=TCP localport=50000
# 2) Power: khong tat man hinh / sleep
powercfg -setactive SCHEME_MIN
powercfg -change -monitor-timeout-ac 0; powercfg -change -monitor-timeout-dc 0
powercfg -change -standby-timeout-ac 0; powercfg -change -standby-timeout-dc 0
# 3) Tat prompt "Networks" (NLA)
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f 2>$null
# 4) Tat Windows Update (tuy chon)
sc.exe config wuauserv start= disabled
# 5) Auto-extend C: moi logon: xoa RECOVERY sau C: (GIU ESP/MSR) roi extend
New-Item -ItemType Directory -Force -Path C:\autosetup | Out-Null
@'
$ErrorActionPreference="SilentlyContinue"
$c = Get-Partition -DriveLetter C
Get-Partition -DiskNumber $c.DiskNumber | Where-Object { $_.PartitionNumber -gt $c.PartitionNumber -and $_.Type -ne 'System' -and $_.Type -ne 'Reserved' } | Remove-Partition -Confirm:$false
"rescan`r`nselect volume c`r`nextend" | diskpart
'@ | Out-File -Encoding ASCII C:\autosetup\autoextend.ps1
schtasks /create /tn "AutoExtend" /tr "powershell -NoProfile -ExecutionPolicy Bypass -File C:\autosetup\autoextend.ps1" /sc onlogon /ru SYSTEM /rl HIGHEST /f
# 6) (BUILD-TIME) xoa RECOVERY (GIU ESP) + extend C: tren VM build -> anh sach
$ErrorActionPreference="SilentlyContinue"
$cc = Get-Partition -DriveLetter C
Get-Partition -DiskNumber $cc.DiskNumber | Where-Object { $_.PartitionNumber -gt $cc.PartitionNumber -and $_.Type -ne 'System' -and $_.Type -ne 'Reserved' } | Remove-Partition -Confirm:$false
$mx = (Get-PartitionSupportedSize -DriveLetter C).SizeMax
if ($mx -gt (Get-Partition -DriveLetter C).Size + 10MB) { Resize-Partition -DriveLetter C -Size $mx }
Write-Host "=== PREP DONE. Gio chay sysprep. ==="