# Ensure running as Administrator if (-not ([Security.Principal.WindowsPrincipal] ` [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(` [Security.Principal.WindowsBuiltInRole]::Administrator)) { Write-Host "You must run this script as Administrator." -ForegroundColor Red Pause exit 1 } Write-Host "Running as Administrator." -ForegroundColor Green Write-Host "" $BaseFolder = "C:\Users\Public\Downloads\Helpers" if (!(Test-Path $BaseFolder)) { New-Item -ItemType Directory -Path $BaseFolder | Out-Null Write-Host "Base folder created at: $BaseFolder." -ForegroundColor Green } else { Write-Host "Base folder already exists." -ForegroundColor Green } function Download-And-Install { param( [string]$Url, [string]$FileName, [string]$InstallerType # 'exe' or 'msi' ) $FilePath = "$BaseFolder\$FileName" Write-Host "Downloading $FileName..." -ForegroundColor Yellow try { $wc = New-Object System.Net.WebClient $wc.DownloadFile($Url, $FilePath) $wc.Dispose() Write-Host "$FileName downloaded successfully." -ForegroundColor Green # Automatically start installation Write-Host "Starting installation of $FileName..." -ForegroundColor Cyan if ($InstallerType -eq 'msi') { # /qn = silent installation Start-Process "msiexec.exe" -ArgumentList "/i `"$FilePath`" /qn /norestart" -Wait } else { # For .exe installers, many support /S or /quiet for silent install Start-Process "$FilePath" -ArgumentList "/S" -Wait } Write-Host "$FileName installation completed." -ForegroundColor Green } catch { Write-Host "Failed to download or install $FileName." -ForegroundColor Red } } # ----------------------------- # Example software installations # ----------------------------- # Mozilla Firefox $installFirefox = Read-Host "Do you want to install Mozilla Firefox? (Y/N)" if ($installFirefox -match "^[Yy]$") { $FirefoxUrl = "https://download.mozilla.org/?product=firefox-latest&os=win64&lang=en-US" Download-And-Install -Url $FirefoxUrl -FileName "Firefox Installer.exe" -InstallerType "exe" } # TeamViewer (company custom) $installTeamviewer = Read-Host "Do you want to install Sonextis TeamViewer? (Y/N)" if ($installTeamviewer -match "^[Yy]$") { # POST to TeamViewer API to get fresh download link $url = "https://get.teamviewer.com/api/CustomDesign" $json = @{ ConfigId = "uu2483g" Version = "15" IsCustomModule = $true Subdomain = "1" ConnectionId = "" } | ConvertTo-Json $headers = @{ "Content-Type" = "application/json; charset=utf-8" } $response = Invoke-RestMethod -Uri $url -Method POST -Headers $headers -Body $json Download-And-Install -Url $response -FileName "TeamViewer_Host_Setup.exe" -InstallerType "exe" } # Advanced IP Scanner $installAdvIPScanner = Read-Host "Do you want to install Advanced IP Scanner? (Y/N)" if ($installAdvIPScanner -match "^[Yy]$") { $AdvIPScannerUrl = "https://download.advanced-ip-scanner.com/download/files/Advanced_IP_Scanner_2.5.4594.1.exe" Download-And-Install -Url $AdvIPScannerUrl -FileName "Advanced_IP_Scanner_2.5.4594.1.exe" -InstallerType "exe" } # Putty $installPutty = Read-Host "Do you want to install Putty? (Y/N)" if ($installPutty -match "^[Yy]$") { $PuttyUrl = "https://the.earth.li/~sgtatham/putty/latest/w64/putty-64bit-0.83-installer.msi" Download-And-Install -Url $PuttyUrl -FileName "putty-64bit-0.83-installer.msi" -InstallerType "msi" } Write-Host "" Write-Host "All requested installations completed." -ForegroundColor Cyan Write-Host "Files saved to $BaseFolder"