Last active 8 months ago

powershell -ExecutionPolicy Bypass -NoProfile -Command "iex ((New-Object Net.WebClient).DownloadString('https://gist.mxyw.es/mxywes/4d7dc1880d494d89b85d0c5edc228bae/raw/HEAD/one_time_setup.ps1'))"

Revision 9ead5eb016760b5f8712fea5022d8497345e5fc5

one_time_setup.ps1 Raw
1# Elevate to Administrator if needed
2If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
3 Start-Process powershell.exe "-ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs
4 Exit
5}
6
7# Enable TLS 1.2
8[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
9
10# ----- Download All-in-One Runtime Installer (latest release from GitHub) -----
11$repoApi = "https://api.github.com/repos/BloopSmasher/All-in-One-Runtime-Installer/releases/latest"
12$headers = @{ "User-Agent" = "RuntimeSetupScript" }
13$release = Invoke-RestMethod -Uri $repoApi -Headers $headers
14
15$zipAsset = $release.assets | Where-Object { $_.name -like "*.zip" } | Select-Object -First 1
16$zipUrl = $zipAsset.browser_download_url
17$zipFile = "All-in-One-Runtime-Installer.zip"
18$extractPath = "AllInOneRuntime"
19
20Write-Host "📦 Downloading latest All-in-One-Runtime-Installer..."
21Invoke-WebRequest -Uri $zipUrl -OutFile $zipFile
22
23Write-Host "📂 Extracting..."
24Expand-Archive -Path $zipFile -DestinationPath $extractPath -Force
25Remove-Item $zipFile
26
27# ----- Run the All-in-One Runtime Installer -----
28$installerPath = Join-Path $extractPath "All in One Runtime Installer (AutoAdmin).bat"
29if (Test-Path $installerPath) {
30 Write-Host "🚀 Launching All-in-One Runtime Installer..."
31 Start-Process -FilePath $installerPath -Wait
32} else {
33 Write-Host "⚠️ Could not find All-in-One installer script at: $installerPath" -ForegroundColor Yellow
34}
35
36# ----- Install latest WinGet -----
37$apiUrl = "https://api.github.com/repos/microsoft/winget-cli/releases/latest"
38$assets = (Invoke-RestMethod -Uri $apiUrl -Headers $headers).assets
39$wingetUrl = $assets | Where-Object { $_.name -like "*.msixbundle" } | Select-Object -ExpandProperty browser_download_url
40
41Write-Host "⬇️ Installing WinGet..."
42Invoke-WebRequest -Uri $wingetUrl -OutFile "winget.msixbundle"
43Add-AppxPackage ".\winget.msixbundle"
44Remove-Item "winget.msixbundle"
45
46# ----- Install desired apps with WinGet -----
47winget install --id Microsoft.PowerShell --source winget --accept-package-agreements --accept-source-agreements
48winget install synctrayzor --accept-package-agreements --accept-source-agreements
49winget install windirstat --accept-package-agreements --accept-source-agreements
50winget install 7zip.7zip --accept-package-agreements --accept-source-agreements
51winget install qBittorrent.qBittorrent --accept-package-agreements --accept-source-agreements
52
53# ----- Disable Defender protection features -----
54Set-MpPreference -DisableRealtimeMonitoring $true
55Set-MpPreference -DisableBehaviorMonitoring $true
56Set-MpPreference -DisableBlockAtFirstSeen $true
57Set-MpPreference -SignatureDisableUpdateOnStartupWithoutEngine $true
58
59Write-Host "✅ All tasks completed successfully." -ForegroundColor Green
60