@@ -38,7 +38,7 @@ param (
3838 [switch ]$NonInteractive
3939)
4040
41- $version = ' 1.9.3 '
41+ $version = ' 1.9.4 '
4242
4343$ProgressPreference = " SilentlyContinue"
4444$sys32 = [Environment ]::GetFolderPath(' System' )
@@ -322,6 +322,7 @@ function RemoveEdgeChromium([bool]$AlreadyUninstalled) {
322322 while ($fail ) {
323323 switch ($method ) {
324324 # makes Edge think the old legacy UWP is still installed
325+ # seems to fail on some installs?
325326 1 {
326327 GlobalRemoveMethods
327328 if (! (Test-Path " $edgeUWP \MicrosoftEdge.exe" )) {
@@ -339,8 +340,28 @@ function RemoveEdgeChromium([bool]$AlreadyUninstalled) {
339340 }
340341 }
341342
342- # changes region in Registry
343+ # not having windir defined is a condition to allow uninstall
344+ # found in the strings of the setup ^
343345 2 {
346+ GlobalRemoveMethods
347+ $envPath = ' HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'
348+ try {
349+ # delete windir variable temporarily
350+ Set-ItemProperty - Path $envPath - Name ' windir' - Value ' ' - Type ExpandString
351+ $env: windir = [System.Environment ]::GetEnvironmentVariable(' windir' , [System.EnvironmentVariableTarget ]::Machine)
352+
353+ # attempt uninstall
354+ $fail = UninstallEdge
355+ } finally {
356+ CleanupMsg
357+ # this is the default
358+ Set-ItemProperty - Path $envPath - Name ' windir' - Value ' %SystemRoot%' - Type ExpandString
359+ }
360+ }
361+
362+ # changes region in Registry
363+ # currently not known to work, kept for legacy reasons
364+ 3 {
344365 GlobalRemoveMethods
345366 ToggleEURegion $true
346367
@@ -351,7 +372,8 @@ function RemoveEdgeChromium([bool]$AlreadyUninstalled) {
351372 }
352373
353374 # modifies IntegratedServicesRegionPolicySet to add current region to allow list
354- 3 {
375+ # currently not known to work, kept for legacy reasons
376+ 4 {
355377 GlobalRemoveMethods
356378 $cleanup = ModifyRegionJSON
357379
0 commit comments