DangPhamPham commited on
Commit
d2e30ea
·
verified ·
1 Parent(s): 3d65c5d

Upload prep.ps1 with huggingface_hub

Browse files
Files changed (1) hide show
  1. prep.ps1 +6 -8
prep.ps1 CHANGED
@@ -11,23 +11,21 @@ powercfg -change -monitor-timeout-ac 0; powercfg -change -monitor-timeout-dc 0
11
  powercfg -change -standby-timeout-ac 0; powercfg -change -standby-timeout-dc 0
12
  # 3) Tat prompt "Networks" (NLA)
13
  reg add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f 2>$null
14
- # 4) Tat Windows Update (gon nhe, tuy chon)
15
  sc.exe config wuauserv start= disabled
16
- # 5) Auto-extend C: moi logon: XOA partition sau C: (Recovery...) ROI extend (robust moi layout)
17
  New-Item -ItemType Directory -Force -Path C:\autosetup | Out-Null
18
  @'
19
  $ErrorActionPreference="SilentlyContinue"
20
  $c = Get-Partition -DriveLetter C
21
- # Xoa moi partition NAM SAU C: tren cung dia (Recovery chan giua...)
22
- Get-Partition -DiskNumber $c.DiskNumber | Where-Object { $_.PartitionNumber -gt $c.PartitionNumber -and $_.Type -notin @(System,Reserved) } | Remove-Partition -Confirm:$false
23
- # Extend C: vao free space lien ke (diskpart tu rescan)
24
  "rescan`r`nselect volume c`r`nextend" | diskpart
25
  '@ | Out-File -Encoding ASCII C:\autosetup\autoextend.ps1
26
  schtasks /create /tn "AutoExtend" /tr "powershell -NoProfile -ExecutionPolicy Bypass -File C:\autosetup\autoextend.ps1" /sc onlogon /ru SYSTEM /rl HIGHEST /f
27
- # 6) (BUILD-TIME) Xoa recovery + extend C: ngay tren VM build -> anh sach (disk3-like)
28
  $ErrorActionPreference="SilentlyContinue"
29
  $cc = Get-Partition -DriveLetter C
30
- Get-Partition -DiskNumber $cc.DiskNumber | Where-Object { $_.PartitionNumber -gt $cc.PartitionNumber -and $_.Type -notin @(System,Reserved) } | Remove-Partition -Confirm:$false
31
  $mx = (Get-PartitionSupportedSize -DriveLetter C).SizeMax
32
  if ($mx -gt (Get-Partition -DriveLetter C).Size + 10MB) { Resize-Partition -DriveLetter C -Size $mx }
33
- Write-Host "=== PREP DONE. Gio chay sysprep (xem buoc tiep). ==="
 
11
  powercfg -change -standby-timeout-ac 0; powercfg -change -standby-timeout-dc 0
12
  # 3) Tat prompt "Networks" (NLA)
13
  reg add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f 2>$null
14
+ # 4) Tat Windows Update (tuy chon)
15
  sc.exe config wuauserv start= disabled
16
+ # 5) Auto-extend C: moi logon: xoa RECOVERY sau C: (GIU ESP/MSR) roi extend
17
  New-Item -ItemType Directory -Force -Path C:\autosetup | Out-Null
18
  @'
19
  $ErrorActionPreference="SilentlyContinue"
20
  $c = Get-Partition -DriveLetter C
21
+ Get-Partition -DiskNumber $c.DiskNumber | Where-Object { $_.PartitionNumber -gt $c.PartitionNumber -and $_.Type -ne 'System' -and $_.Type -ne 'Reserved' } | Remove-Partition -Confirm:$false
 
 
22
  "rescan`r`nselect volume c`r`nextend" | diskpart
23
  '@ | Out-File -Encoding ASCII C:\autosetup\autoextend.ps1
24
  schtasks /create /tn "AutoExtend" /tr "powershell -NoProfile -ExecutionPolicy Bypass -File C:\autosetup\autoextend.ps1" /sc onlogon /ru SYSTEM /rl HIGHEST /f
25
+ # 6) (BUILD-TIME) xoa RECOVERY (GIU ESP) + extend C: tren VM build -> anh sach
26
  $ErrorActionPreference="SilentlyContinue"
27
  $cc = Get-Partition -DriveLetter C
28
+ Get-Partition -DiskNumber $cc.DiskNumber | Where-Object { $_.PartitionNumber -gt $cc.PartitionNumber -and $_.Type -ne 'System' -and $_.Type -ne 'Reserved' } | Remove-Partition -Confirm:$false
29
  $mx = (Get-PartitionSupportedSize -DriveLetter C).SizeMax
30
  if ($mx -gt (Get-Partition -DriveLetter C).Size + 10MB) { Resize-Partition -DriveLetter C -Size $mx }
31
+ Write-Host "=== PREP DONE. Gio chay sysprep. ==="