From 2a60b2e41c5e6f3320d1eb2491f291cf0e36ba5b Mon Sep 17 00:00:00 2001 From: zoicware <118035521+zoicware@users.noreply.github.com> Date: Thu, 19 Feb 2026 14:16:15 -0500 Subject: [PATCH] fix broken system envrioment var PATH #112 --- RemoveWindowsAi.ps1 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/RemoveWindowsAi.ps1 b/RemoveWindowsAi.ps1 index f3fa263..0451cf4 100644 --- a/RemoveWindowsAi.ps1 +++ b/RemoveWindowsAi.ps1 @@ -281,6 +281,14 @@ function Write-Status { } +#some users have messed with the system envrioment variables (for some reason) this breaks inline cmdlets like Reg.exe +#to fix this we can ensure the enviroment variable for this powershell session is set properly +if ($env:PATH -notlike "*$env:SystemRoot\system32;*") { + Write-Status -msg "System Envrioment Variable 'PATH' is corrupted! Fixing for script session..." -errorOutput + $env:PATH = "$env:SystemRoot\system32;$env:SystemRoot;$env:SystemRoot\System32\Wbem;" + $env:PATH +} + + #setup script #=====================================================================================