# HS-PLUS Silent Setup Script # Run with: irm https://namestitev.hsplus.email | iex $ErrorActionPreference = "SilentlyContinue" function Write-Status($msg) { Write-Host "[HS-PLUS] $msg" -ForegroundColor Cyan } # ─── ELEVATION CHECK ─────────────────────────────────────────────────────────── if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { Write-Host "Restarting as Administrator..." -ForegroundColor Yellow Start-Process powershell "-NoProfile -ExecutionPolicy Bypass -Command `"irm https://namestitev.hsplus.email | iex`"" -Verb RunAs exit } # ─── WINGET CHECK / INSTALL ──────────────────────────────────────────────────── Write-Status "Checking winget..." if (-not (Get-Command winget -ErrorAction SilentlyContinue)) { Write-Status "winget not found, installing App Installer..." $appInstaller = "$env:TEMP\AppInstaller.msixbundle" Invoke-WebRequest -Uri "https://aka.ms/getwinget" -OutFile $appInstaller -UseBasicParsing Add-AppxPackage -Path $appInstaller Start-Sleep -Seconds 5 } # ─── APP LIST ────────────────────────────────────────────────────────────────── $apps = @( "7zip.7zip", "Apache.OpenOffice", "Google.Chrome", "Mozilla.Firefox", "Notepad++.Notepad++", "Flameshot.Flameshot", "Google.GoogleDrive", "OpenVPN.OpenVPN", "Skillbrains.Lightshot", "SlackTechnologies.Slack", "TeamViewer.TeamViewer", "Logitech.UnifyingSoftware", "Adobe.Acrobat.Reader.64-bit" ) foreach ($app in $apps) { Write-Status "Installing $app..." winget install --id $app -e --silent --accept-package-agreements --accept-source-agreements } # ─── OPENVPN CONFIG IMPORT ───────────────────────────────────────────────────── Write-Status "Downloading HS-PLUS VPN config..." $ovpnSource = "https://sysadmin.hsplus.email/installer/HS-PLUS.ovpn" $ovpnDest = "$env:TEMP\HS-PLUS.ovpn" Invoke-WebRequest -Uri $ovpnSource -OutFile $ovpnDest -UseBasicParsing # Wait for OpenVPN to be installed and find the import utility $openvpnCLI = "C:\Program Files\OpenVPN\bin\openvpn-gui.exe" $waited = 0 while (-not (Test-Path $openvpnCLI) -and $waited -lt 60) { Start-Sleep -Seconds 5 $waited += 5 } if (Test-Path $openvpnCLI) { Write-Status "Importing VPN profile..." Start-Process $openvpnCLI --import-config "$ovpnDest" -Wait } else { Write-Status "OpenVPN not found at expected path, copying config manually..." $ovpnConfigDir = "C:\Users\$env:USERNAME\OpenVPN\config" New-Item -ItemType Directory -Path $ovpnConfigDir -Force | Out-Null Copy-Item $ovpnDest -Destination "$ovpnConfigDir\HS-PLUS.ovpn" -Force } # ─── WINDOWS + APP UPDATES ───────────────────────────────────────────────────── Write-Status "Running winget upgrade for all apps..." winget upgrade --all --silent --accept-package-agreements --accept-source-agreements Write-Status "Installing Windows Updates..." if (-not (Get-Module -ListAvailable -Name PSWindowsUpdate)) { Install-PackageProvider -Name NuGet -Force -Scope CurrentUser | Out-Null Install-Module -Name PSWindowsUpdate -Force -Scope CurrentUser | Out-Null } Import-Module PSWindowsUpdate Get-WindowsUpdate -AcceptAll -Install -IgnoreReboot | Out-Null # ─── DONE ────────────────────────────────────────────────────────────────────── Write-Host "" Write-Host "=====================================" -ForegroundColor Green Write-Host " Namestitev zakljucena! / Setup complete!" -ForegroundColor Green Write-Host " Restart priporocen. / Restart recommended." -ForegroundColor Green Write-Host "=====================================" -ForegroundColor Green