Show error if powershell functionality is restricted (#79)

This commit is contained in:
Raphire
2024-06-26 20:27:25 +02:00
parent d19f20fbf9
commit 589f2e82df
2 changed files with 21 additions and 2 deletions

View File

@@ -35,6 +35,15 @@ param (
[switch]$DisableShare, [switch]$HideShare
)
# Show error if current powershell environment does not have LanguageMode set to FullLanguage
if ($ExecutionContext.SessionState.LanguageMode -ne "FullLanguage") {
Write-Host "Error: Win11Debloat is unable to run on your system. Powershell execution is restricted by security policies" -ForegroundColor Red
Write-Output ""
Write-Output "Press enter to exit..."
Read-Host | Out-Null
Exit
}
Clear-Host
Write-Output "-------------------------------------------------------------------------------------------"
Write-Output " Win11Debloat Script - Get"