From 727550c0fa3f00547f951094663e92226f526b47 Mon Sep 17 00:00:00 2001 From: regexreggae <82324302+regexreggae@users.noreply.github.com> Date: Thu, 26 Feb 2026 12:13:59 +0100 Subject: [PATCH 1/2] Fix error message ("Throw") $PSCOMMANDPATH refers to this script (the PS7Bootstrap.ps1). What we need here is the Script that was passed to the bootstrap script as an argument. --- PS7Bootstrap.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PS7Bootstrap.ps1 b/PS7Bootstrap.ps1 index 902a95b..ab75906 100644 --- a/PS7Bootstrap.ps1 +++ b/PS7Bootstrap.ps1 @@ -73,6 +73,6 @@ if ($Script -ne "") { & pwsh.exe -ExecutionPolicy bypass -File $Script } Catch { - Throw "Failed to start $PSCOMMANDPATH" + Throw "Failed to start $($Script) using pwsh.exe" } } From 3c2a7c68672e8d3411b9794268b33a491e977a9a Mon Sep 17 00:00:00 2001 From: regexreggae <82324302+regexreggae@users.noreply.github.com> Date: Thu, 26 Feb 2026 12:29:46 +0100 Subject: [PATCH 2/2] Bump version to 1.0.2 and require admin privs for install Updated version number to 1.0.2 and added admin guard for installation. --- PS7Bootstrap.ps1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PS7Bootstrap.ps1 b/PS7Bootstrap.ps1 index ab75906..076fd3e 100644 --- a/PS7Bootstrap.ps1 +++ b/PS7Bootstrap.ps1 @@ -1,5 +1,5 @@ <#PSScriptInfo -.VERSION 1.0.1 +.VERSION 1.0.2 .GUID 2d80b74b-905a-4d91-97af-35f0d3fe56e7 .AUTHOR Michael Niehaus .COMPANYNAME @@ -58,7 +58,9 @@ Write-Host "Minimum PowerShell version = $MinimumVersion" # Install or upgrade as needed if ($currentVersion -lt $MinimumVersion) { - + # make sure current shell is elevated, which is required for the global .msi installation of pwsh + if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { + throw "Admin privileges required for global PS7 install. Please re-run elevated." } Write-Host "Installing PowerShell LTS" Invoke-Expression "& { $(Invoke-RestMethod https://aka.ms/install-powershell.ps1) } -UseMSI -Quiet"