From 747b6f8ca185bdba1e7a68576cd50f39cfe09516 Mon Sep 17 00:00:00 2001 From: Gabi <218829269+GabiNun2@users.noreply.github.com> Date: Fri, 17 Apr 2026 17:02:27 +0300 Subject: [PATCH] Added restriction policy error (#4370) * Added restriction policy error * Update KnownIssues.md * Update KnownIssues.md * Update KnownIssues.md * Update KnownIssues.md --- docs/content/KnownIssues.md | 44 +++---------------------------------- scripts/start.ps1 | 4 ++++ 2 files changed, 7 insertions(+), 41 deletions(-) diff --git a/docs/content/KnownIssues.md b/docs/content/KnownIssues.md index 8f0a029a..3e0a0c0d 100644 --- a/docs/content/KnownIssues.md +++ b/docs/content/KnownIssues.md @@ -22,46 +22,8 @@ If you are still having issues, try using a **VPN**, or changing your **DNS prov ### Script Won't Run -If your PowerShell session is running in **Constrained Language Mode**, some scripts and commands may fail to execute. To check the current language mode, run: -```powershell -$ExecutionContext.SessionState.LanguageMode -``` -If it returns `ConstrainedLanguage`, you may need to switch to `FullLanguage` mode or run the script in a session with administrative privileges. Be aware that some security policies may enforce Constrained Language Mode, especially in corporate or managed environments. +If you run WinUtil and get the error: -**If the download fails**: +`"WinUtil is unable to run on your system, powershell execution is restricted by security policies,"` -1. Try the direct GitHub link: - -```powershell -irm https://github.com/ChrisTitusTech/Winutil/releases/latest/download/Winutil.ps1 | iex -``` - -2. Force TLS 1.2: - -```powershell -[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -irm "https://christitus.com/win" | iex -``` - -> [!NOTE] -> On Windows 11, you usually do not need the TLS 1.2 command. Use it only if you encounter download or security protocol errors. - -### Execution Policy Error - -If you see an execution policy error when running the downloaded script, you can allow the current session to run unsigned scripts with this command: - -```powershell -Set-ExecutionPolicy Unrestricted -Scope Process -Force -irm "https://christitus.com/win" | iex -``` - -This only changes the policy for the current PowerShell process and is safe for one-off runs. - -### Interface Doesn't Appear - -If Winutil downloads, but the GUI does not open or appear, try these steps: - -1. Check if your antivirus or Windows Defender is blocking the script — add an exclusion if necessary. -2. Ensure you launched PowerShell / Terminal as **Administrator**. -3. Close and reopen PowerShell, then run the launch command again. -4. If the script still doesn't show, try running the script in a visible PowerShell window (avoid background/silent shells) to observe output and errors. +this means that your PowerShell session is in **Constrained Language Mode**, which prevents WinUtil from running. diff --git a/scripts/start.ps1 b/scripts/start.ps1 index 44766a22..2e0221a9 100644 --- a/scripts/start.ps1 +++ b/scripts/start.ps1 @@ -33,6 +33,10 @@ if ($Offline) { $PARAM_OFFLINE = $true } +if ($ExecutionContext.SessionState.LanguageMode -ne 'FullLanguage') { + Write-Host "WinUtil is unable to run on your system, powershell execution is restricted by security policies" -ForegroundColor Red + return +} if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { Write-Output "Winutil needs to be run as Administrator. Attempting to relaunch."