From 8c45921d0395e32f13c66f16daa1da2a6ec0d80f Mon Sep 17 00:00:00 2001 From: Lex Li Date: Mon, 11 Jan 2021 23:00:17 -0500 Subject: [PATCH] Added PowerShell store version check. --- install.ps1 | 5 +++++ uninstall.old.ps1 | 5 +++++ uninstall.ps1 | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/install.ps1 b/install.ps1 index a323d67..5d513ab 100644 --- a/install.ps1 +++ b/install.ps1 @@ -440,6 +440,11 @@ function CreateMenuItems( # Based on @nerdio01's version in https://github.com/microsoft/terminal/issues/1060 +if ((Get-Process -Id $pid).Path -like "*WindowsApps*") { + Write-Error "PowerShell installed via Microsoft Store is not supported. Learn other ways to install it from https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-windows?view=powershell-7 . Exit."; + exit 1 +} + if ((Test-Path "Registry::HKEY_CLASSES_ROOT\Directory\shell\MenuTerminal") -and -not (Test-Path "Registry::HKEY_CURRENT_USER\SOFTWARE\Classes\Directory\shell\MenuTerminal")) { Write-Error "Please execute uninstall.old.ps1 to remove previous installation." diff --git a/uninstall.old.ps1 b/uninstall.old.ps1 index 3b3bebb..cacc6b9 100644 --- a/uninstall.old.ps1 +++ b/uninstall.old.ps1 @@ -12,6 +12,11 @@ param( # Based on @nerdio01's version in https://github.com/microsoft/terminal/issues/1060 +if ((Get-Process -Id $pid).Path -like "*WindowsApps*") { + Write-Error "PowerShell installed via Microsoft Store is not supported. Learn other ways to install it from https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-windows?view=powershell-7 . Exit."; + exit 1 +} + $localCache = "$Env:LOCALAPPDATA\Microsoft\WindowsApps\Cache" if (Test-Path $localCache) { Remove-Item $localCache -Recurse diff --git a/uninstall.ps1 b/uninstall.ps1 index 13a66c0..1ca6c73 100644 --- a/uninstall.ps1 +++ b/uninstall.ps1 @@ -11,6 +11,11 @@ param( # Based on @nerdio01's version in https://github.com/microsoft/terminal/issues/1060 +if ((Get-Process -Id $pid).Path -like "*WindowsApps*") { + Write-Error "PowerShell installed via Microsoft Store is not supported. Learn other ways to install it from https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-windows?view=powershell-7 . Exit."; + exit 1 +} + if ((Test-Path "Registry::HKEY_CLASSES_ROOT\Directory\shell\MenuTerminal") -and -not (Test-Path "Registry::HKEY_CURRENT_USER\SOFTWARE\Classes\Directory\shell\MenuTerminal")) { Write-Error "Please execute uninstall.old.ps1 to remove previous installation."