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