Skip to content

Commit

Permalink
Added PowerShell store version check.
Browse files Browse the repository at this point in the history
  • Loading branch information
lextm committed Jan 12, 2021
1 parent a5404ed commit 8c45921
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
5 changes: 5 additions & 0 deletions uninstall.old.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions uninstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down

0 comments on commit 8c45921

Please sign in to comment.