# ------------------------------- # SIMPLE COMPANY PORTAL INSTALL # ------------------------------- $ErrorActionPreference = "Stop" $Temp = "C:\Temp\Winget" New-Item -ItemType Directory -Path $Temp -Force | Out-Null Write-Host "[1] Checking for winget..." $winget = Get-Command winget -ErrorAction SilentlyContinue if (-not $winget) { Write-Host " winget not found. Installing App Installer..." # Download latest App Installer (winget) $bundle = "$Temp\AppInstaller.msixbundle" Invoke-WebRequest -Uri "https://aka.ms/getwinget" -OutFile $bundle -UseBasicParsing # Install Add-AppxPackage -Path $bundle Start-Sleep 5 } # Ensure winget is available $wingetExe = "$env:LOCALAPPDATA\Microsoft\WindowsApps\winget.exe" if (-not (Test-Path $wingetExe)) { Write-Error "winget not available for this user session" return } Write-Host "[2] Installing Company Portal..." # IMPORTANT: must run in USER CONTEXT (not SYSTEM) & $wingetExe install --id "9WZDNCRFJ3PZ" ` --source msstore ` --accept-source-agreements ` --accept-package-agreements ` --silent if ($LASTEXITCODE -ne 0) { Write-Warning "winget install failed. You may need to sign into Microsoft Store when prompted." } Write-Host "[3] Launching Company Portal..." Start-Process "companyportal:" -ErrorAction SilentlyContinue Write-Host "DONE"