| |
| |
| 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 |
| |
| 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 |
| |
| reg add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f 2>$null |
| |
| sc.exe config wuauserv start= disabled |
| |
| 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 |
| |
| $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. ===" |
|
|