# PanosOptimizationTool - one-line launcher # irm https://panostool.pages.dev/run | iex # Downloads the latest PanosOptimizationTool.ps1 to %LOCALAPPDATA%\PanosOptimizationTool # and starts it as administrator. Nothing else is changed until you press a button in the app. & { $ErrorActionPreference = 'Stop' [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 $url = 'https://panostool.pages.dev/PanosOptimizationTool.ps1' Write-Host '' Write-Host ' PanosOptimizationTool' -ForegroundColor Cyan Write-Host ' Downloading the latest version...' try { # drop the UTF-8 BOM that comes with the text, WriteAllText adds its own (two BOMs break line 1) $code = (Invoke-WebRequest $url -UseBasicParsing).Content.TrimStart([char]0xFEFF) } catch { Write-Host " Could not download PanosOptimizationTool: $($_.Exception.Message)" -ForegroundColor Yellow Write-Host ' Check your internet connection and run the command again.' -ForegroundColor Yellow return } # the usual place can be locked (an older copy still open, a read-only file, another Windows user), # so fall back to a fresh file in TEMP instead of giving up $dir = Join-Path $env:LOCALAPPDATA 'PanosOptimizationTool' $targets = @((Join-Path $dir 'PanosOptimizationTool.ps1'), (Join-Path $env:TEMP ('PanosOptimizationTool-' + [guid]::NewGuid().ToString('N').Substring(0, 8) + '.ps1'))) $file = $null; $why = '' foreach ($t in $targets) { try { New-Item -ItemType Directory -Path (Split-Path $t) -Force | Out-Null if (Test-Path $t) { (Get-Item $t -Force).Attributes = 'Normal' } [IO.File]::WriteAllText($t, $code, (New-Object Text.UTF8Encoding($true))) $file = $t; break } catch { $why = $_.Exception.Message } } if (-not $file) { Write-Host " Windows did not allow saving the app: $why" -ForegroundColor Yellow Write-Host ' Your antivirus or company policy may be blocking PowerShell scripts.' -ForegroundColor Yellow Write-Host ' Try the PanosOptimizationTool.cmd download from https://panostool.pages.dev instead.' -ForegroundColor Yellow return } Unblock-File $file -ErrorAction SilentlyContinue try { Write-Host ' Starting. Click YES on the Windows administrator prompt.' -ForegroundColor Green Start-Process powershell.exe -Verb RunAs -ArgumentList "-NoProfile -ExecutionPolicy Bypass -STA -WindowStyle Hidden -File `"$file`"" } catch { Write-Host ' PanosOptimizationTool needs administrator rights. Run the command again and click YES.' -ForegroundColor Yellow } }