forked from ChrisTitusTech/winutil
-
Notifications
You must be signed in to change notification settings - Fork 0
/
edgeremoval.ps1
466 lines (377 loc) · 18.4 KB
/
edgeremoval.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
# Script Metadata
# Created by AveYo, source: https://raw.githubusercontent.com/AveYo/fox/main/Edge_Removal.bat
# Powershell Conversion and Refactor done by Chris Titus Tech
# Initial Configuration
$host.ui.RawUI.WindowTitle = 'Edge Removal - Chris Titus Tech 2023.05.10'
$remove_win32 = @("Microsoft Edge", "Microsoft Edge Update")
$remove_appx = @("MicrosoftEdge")
$skip = @() # Optional: @("DevTools")
$also_remove_webview = 0
if ($also_remove_webview -eq 1) {
$remove_win32 += "Microsoft EdgeWebView"
$remove_appx += "WebExperience", "Win32WebViewHost"
}
# Administrative Privileges Check
# Get the 'SetPrivilege' method from System.Diagnostics.Process type
$setPrivilegeMethod = [System.Diagnostics.Process].GetMethod('SetPrivilege', [System.Reflection.BindingFlags]::NonPublic -bor [System.Reflection.BindingFlags]::Static)
# List of privileges to set
$privileges = @(
'SeSecurityPrivilege',
'SeTakeOwnershipPrivilege',
'SeBackupPrivilege',
'SeRestorePrivilege'
)
# Invoke the method for each privilege
foreach ($privilege in $privileges) {
$setPrivilegeMethod.Invoke($null, @($privilege, 2))
}
# Edge Removal Procedures
# Define processes to shut down
$processesToShutdown = @(
'explorer', 'Widgets', 'widgetservice', 'msedgewebview2', 'MicrosoftEdge*', 'chredge',
'msedge', 'edge', 'msteams', 'msfamily', 'WebViewHost', 'Clipchamp'
)
# Kill explorer process
Stop-Process -Name "explorer" -Force -ErrorAction SilentlyContinue
# Kill the processes from the list
$processesToShutdown | ForEach-Object {
Stop-Process -Name $_ -Force -ErrorAction SilentlyContinue
}
# Set path for Edge executable
$MS = ($env:ProgramFiles, ${env:ProgramFiles(x86)})[[Environment]::Is64BitOperatingSystem] + '\Microsoft\Edge\Application\msedge.exe'
# Clean up certain registry entries
Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\msedge.exe" -Recurse -ErrorAction SilentlyContinue
Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\ie_to_edge_stub.exe" -Recurse -ErrorAction SilentlyContinue
Remove-Item -Path 'Registry::HKEY_Users\S-1-5-21*\Software\Classes\microsoft-edge' -Recurse -ErrorAction SilentlyContinue
Remove-Item -Path 'Registry::HKEY_Users\S-1-5-21*\Software\Classes\MSEdgeHTM' -Recurse -ErrorAction SilentlyContinue
# Create new registry entries
New-Item -Path "HKLM:\SOFTWARE\Classes\microsoft-edge\shell\open\command" -Force -ErrorAction SilentlyContinue
Set-ItemProperty -Path "HKLM:\SOFTWARE\Classes\microsoft-edge\shell\open\command" -Name '(Default)' -Value "`"$MS`" --single-argument %%1" -Force -ErrorAction SilentlyContinue
New-Item -Path "HKLM:\SOFTWARE\Classes\MSEdgeHTM\shell\open\command" -Force -ErrorAction SilentlyContinue
Set-ItemProperty -Path "HKLM:\SOFTWARE\Classes\MSEdgeHTM\shell\open\command" -Name '(Default)' -Value "`"$MS`" --single-argument %%1" -Force -ErrorAction SilentlyContinue
# Remove certain registry properties
$registryPaths = @('HKLM:\SOFTWARE\Policies', 'HKLM:\SOFTWARE', 'HKLM:\SOFTWARE\WOW6432Node')
$edgeProperties = @('InstallDefault', 'Install{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}', 'Install{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}')
foreach ($path in $registryPaths) {
foreach ($prop in $edgeProperties) {
Remove-ItemProperty -Path "$path\Microsoft\EdgeUpdate" -Name $prop -Force -ErrorAction SilentlyContinue
}
}
$edgeupdate = 'Microsoft\EdgeUpdate\Clients\{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}'
$webvupdate = 'Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}'
$on_actions = @('on-os-upgrade', 'on-logon', 'on-logon-autolaunch', 'on-logon-startup-boost')
$registryBases = @('HKLM:\SOFTWARE', 'HKLM:\SOFTWARE\Wow6432Node')
foreach ($base in $registryBases) {
foreach ($launch in $on_actions) {
Remove-Item -Path "$base\$edgeupdate\Commands\$launch" -Force -ErrorAction SilentlyContinue
Remove-Item -Path "$base\$webvupdate\Commands\$launch" -Force -ErrorAction SilentlyContinue
}
}
# Clear specific registry keys
$registryPaths = @('HKCU:', 'HKLM:')
$nodes = @('', '\Wow6432Node')
foreach ($regPath in $registryPaths) {
foreach ($node in $nodes) {
foreach ($i in $remove_win32) {
Remove-ItemProperty -Path "$regPath\SOFTWARE${node}\Microsoft\Windows\CurrentVersion\Uninstall\$i" -Name 'NoRemove' -Force -ErrorAction SilentlyContinue
New-Item -Path "$regPath\SOFTWARE${node}\Microsoft\EdgeUpdateDev" -Force | Out-Null
Set-ItemProperty -Path "$regPath\SOFTWARE${node}\Microsoft\EdgeUpdateDev" -Name 'AllowUninstall' -Value 1 -Type Dword -Force
}
}
}
# Locate setup.exe and ie_to_edge_stub.exe
$foldersToSearch = @('LocalApplicationData', 'ProgramFilesX86', 'ProgramFiles') | ForEach-Object {
[Environment]::GetFolderPath($_)
}
$edges = @()
$bhoFiles = @()
foreach ($folder in $foldersToSearch) {
$bhoFiles += Get-ChildItem -Path "$folder\Microsoft\Edge*\ie_to_edge_stub.exe" -Recurse -ErrorAction SilentlyContinue
$edges += Get-ChildItem -Path "$folder\Microsoft\Edge*\setup.exe" -Recurse -ErrorAction SilentlyContinue |
Where-Object { $_.FullName -notlike '*EdgeWebView*' }
}
# Create directory and copy ie_to_edge_stub.exe to it
$destinationDir = "$env:SystemDrive\Scripts"
New-Item -Path $destinationDir -ItemType Directory -ErrorAction SilentlyContinue | Out-Null
foreach ($bhoFile in $bhoFiles) {
if (Test-Path $bhoFile) {
try {
Copy-Item -Path $bhoFile -Destination "$destinationDir\ie_to_edge_stub.exe" -Force
} catch { }
}
}
## Work on Appx Removals
# Retrieve AppX provisioned packages and all AppX packages
$provisioned = Get-AppxProvisionedPackage -Online
$appxpackage = Get-AppxPackage -AllUsers
# Initialize empty array for EndOfLife packages
$eol = @()
# Define user SIDs and retrieve them from the registry
$store = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore'
$users = @('S-1-5-18')
if (Test-Path $store) {
$users += (Get-ChildItem $store -ErrorAction SilentlyContinue | Where-Object { $_.PSChildName -like '*S-1-5-21*' }).PSChildName
}
# Process AppX packages for removal
foreach ($choice in $remove_appx) {
if ([string]::IsNullOrWhiteSpace($choice)) { continue }
# Process provisioned packages
$provisioned | Where-Object { $_.PackageName -like "*$choice*" } | ForEach-Object {
if ($skip -Contains $_.PackageName) { return }
$PackageName = $_.PackageName
$PackageFamilyName = ($appxpackage | Where-Object { $_.Name -eq $_.DisplayName }).PackageFamilyName
# Add registry entries
New-Item -Path "$store\Deprovisioned\$PackageFamilyName" -Force -ErrorAction SilentlyContinue | Out-Null
$users | ForEach-Object {
New-Item -Path "$store\EndOfLife\$_\$PackageName" -Force -ErrorAction SilentlyContinue | Out-Null
}
$eol += $PackageName
# Modify non-removable app policy and remove package
dism /online /set-nonremovableapppolicy /packagefamily:$PackageFamilyName /nonremovable:0 | Out-Null
Remove-AppxProvisionedPackage -PackageName $PackageName -Online -AllUsers | Out-Null
}
# Process all AppX packages
$appxpackage | Where-Object { $_.PackageFullName -like "*$choice*" } | ForEach-Object {
if ($skip -Contains $_.PackageFullName) { return }
$PackageFullName = $_.PackageFullName
# Add registry entries
New-Item -Path "$store\Deprovisioned\$_.PackageFamilyName" -Force -ErrorAction SilentlyContinue | Out-Null
$users | ForEach-Object {
New-Item -Path "$store\EndOfLife\$_\$PackageFullName" -Force -ErrorAction SilentlyContinue | Out-Null
}
$eol += $PackageFullName
# Modify non-removable app policy and remove package
dism /online /set-nonremovableapppolicy /packagefamily:$PackageFamilyName /nonremovable:0 | Out-Null
Remove-AppxPackage -Package $PackageFullName -AllUsers | Out-Null
}
}
## Run Edge setup uninstaller
foreach ($setup in $edges) {
if (Test-Path $setup) {
$target = if ($setup -like '*EdgeWebView*') { "--msedgewebview" } else { "--msedge" }
$removalArgs = "--uninstall $target --system-level --verbose-logging --force-uninstall"
Write-Host "$setup $removalArgs"
try {
Start-Process -FilePath $setup -ArgumentList $removalArgs -Wait
} catch {
# You may want to add logging or other error handling here.
}
while ((Get-Process -Name 'setup', 'MicrosoftEdge*' -ErrorAction SilentlyContinue).Path -like '*\Microsoft\Edge*') {
Start-Sleep -Seconds 3
}
}
}
## Cleanup
# Define necessary paths and variables
$edgePaths = $env:ProgramFiles, ${env:ProgramFiles(x86)}
$appDataPath = [Environment]::GetFolderPath('ApplicationData')
# Uninstall Microsoft Edge Update
foreach ($path in $edgePaths) {
$edgeUpdateExe = "$path\Microsoft\EdgeUpdate\MicrosoftEdgeUpdate.exe"
if (Test-Path $edgeUpdateExe) {
Write-Host $edgeUpdateExe /uninstall
Start-Process -FilePath $edgeUpdateExe -ArgumentList '/uninstall' -Wait
while ((Get-Process -Name 'setup','MicrosoftEdge*' -ErrorAction SilentlyContinue).Path -like '*\Microsoft\Edge*') {
Start-Sleep -Seconds 3
}
if ($also_remove_webview -eq 1) {
foreach ($regPath in 'HKCU:', 'HKLM:') {
foreach ($node in '', '\Wow6432Node') {
Remove-Item -Path "$regPath\SOFTWARE$node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge Update" -Recurse -Force -ErrorAction SilentlyContinue
}
}
Remove-Item -Path "$path\Microsoft\EdgeUpdate" -Recurse -Force -ErrorAction SilentlyContinue
Unregister-ScheduledTask -TaskName 'MicrosoftEdgeUpdate*' -Confirm:$false -ErrorAction SilentlyContinue
}
}
}
# Remove Edge shortcuts
Remove-Item -Path "$appDataPath\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Tombstones\Microsoft Edge.lnk" -Force -ErrorAction SilentlyContinue
Remove-Item -Path "$appDataPath\Microsoft\Internet Explorer\Quick Launch\Microsoft Edge.lnk" -Force -ErrorAction SilentlyContinue
# Revert settings related to Microsoft Edge
foreach ($sid in $users) {
foreach ($packageName in $eol) {
Remove-Item -Path "$store\EndOfLife\$sid\$packageName" -Force -ErrorAction SilentlyContinue
}
}
# Set policies to prevent unsolicited reinstalls of Microsoft Edge
$registryPaths = @('HKLM:\SOFTWARE\Policies', 'HKLM:\SOFTWARE', 'HKLM:\SOFTWARE\WOW6432Node')
$edgeUpdatePolicies = @{
'InstallDefault' = 0;
'Install{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}' = 0;
'Install{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}' = 1;
'DoNotUpdateToEdgeWithChromium' = 1;
}
foreach ($path in $registryPaths) {
New-Item -Path "$path\Microsoft\EdgeUpdate" -Force -ErrorAction SilentlyContinue | Out-Null
foreach ($policy in $edgeUpdatePolicies.GetEnumerator()) {
Set-ItemProperty -Path "$path\Microsoft\EdgeUpdate" -Name $policy.Key -Value $policy.Value -Type Dword -Force
}
}
$edgeUpdateActions = @('on-os-upgrade', 'on-logon', 'on-logon-autolaunch', 'on-logon-startup-boost')
$edgeUpdateClients = @(
'Microsoft\EdgeUpdate\Clients\{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}',
'Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}'
)
foreach ($client in $edgeUpdateClients) {
foreach ($action in $edgeUpdateActions) {
foreach ($regBase in 'HKLM:\SOFTWARE', 'HKLM:\SOFTWARE\Wow6432Node') {
$regPath = "$regBase\$client\Commands\$action"
New-Item -Path $regPath -Force -ErrorAction SilentlyContinue | Out-Null
Set-ItemProperty -Path $regPath -Name 'CommandLine' -Value 'systray.exe' -Force
}
}
}
## Redirect Edge Shortcuts
# Define Microsoft Edge Paths
$MSEP = ($env:ProgramFiles, ${env:ProgramFiles(x86)})[[Environment]::Is64BitOperatingSystem] + '\Microsoft\Edge\Application'
$IFEO = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options'
$MIN = ('--headless', '--width 1 --height 1')[([environment]::OSVersion.Version.Build) -gt 25179]
$CMD = "$env:systemroot\system32\conhost.exe $MIN"
$DIR = "$env:SystemDrive\Scripts"
# Setup Microsoft Edge Registry Entries
New-Item -Path "HKLM:\SOFTWARE\Classes\microsoft-edge\shell\open\command" -Force | Out-Null
Set-ItemProperty -Path "HKLM:\SOFTWARE\Classes\microsoft-edge" -Name '(Default)' -Value 'URL:microsoft-edge' -Force
Set-ItemProperty -Path "HKLM:\SOFTWARE\Classes\microsoft-edge" -Name 'URL Protocol' -Value '' -Force
Set-ItemProperty -Path "HKLM:\SOFTWARE\Classes\microsoft-edge" -Name 'NoOpenWith' -Value '' -Force
Set-ItemProperty -Path "HKLM:\SOFTWARE\Classes\microsoft-edge\shell\open\command" -Name '(Default)' -Value "`"$DIR\ie_to_edge_stub.exe`" %1" -Force
# Setup MSEdgeHTM Registry Entries
New-Item -Path "HKLM:\SOFTWARE\Classes\MSEdgeHTM\shell\open\command" -Force | Out-Null
Set-ItemProperty -Path "HKLM:\SOFTWARE\Classes\MSEdgeHTM" -Name 'NoOpenWith' -Value '' -Force
Set-ItemProperty -Path "HKLM:\SOFTWARE\Classes\MSEdgeHTM\shell\open\command" -Name '(Default)' -Value "`"$DIR\ie_to_edge_stub.exe`" %1" -Force
# Setup Image File Execution Options for Edge and Edge WebView
$exeSettings = @(
@{ ExeName = 'ie_to_edge_stub.exe'; Debugger = "$CMD $DIR\OpenWebSearch.cmd"; FilterPath = "$DIR\ie_to_edge_stub.exe" },
@{ ExeName = 'msedge.exe'; Debugger = "$CMD $DIR\OpenWebSearch.cmd"; FilterPath = "$MSEP\msedge.exe" }
)
foreach ($setting in $exeSettings) {
New-Item -Path "$IFEO\$($setting.ExeName)\0" -Force | Out-Null
Set-ItemProperty -Path "$IFEO\$($setting.ExeName)" -Name 'UseFilter' -Value 1 -Type Dword -Force
Set-ItemProperty -Path "$IFEO\$($setting.ExeName)\0" -Name 'FilterFullPath' -Value $setting.FilterPath -Force
Set-ItemProperty -Path "$IFEO\$($setting.ExeName)\0" -Name 'Debugger' -Value $setting.Debugger -Force
}
# Write OpenWebSearch Batch Script
$OpenWebSearch = @'
@echo off
@title OpenWebSearch Redux
:: Minimize prompt
for /f %%E in ('"prompt $E$S & for %%e in (1) do rem"') do echo;%%E[2t >nul 2>&1
:: Get default browser from registry
call :get_registry_value "HKCU\SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice" ProgID DefaultBrowser
if not defined DefaultBrowser (
echo Error: Failed to get default browser from registry.
pause
exit /b
)
if /i "%DefaultBrowser%" equ "MSEdgeHTM" (
echo Error: Default browser is set to Edge! Change it or remove OpenWebSearch script.
pause
exit /b
)
:: Get browser command line
call :get_registry_value "HKCR\%DefaultBrowser%\shell\open\command" "" BrowserCommand
if not defined BrowserCommand (
echo Error: Failed to get browser command from registry.
pause
exit /b
)
set Browser=& for %%i in (%BrowserCommand%) do if not defined Browser set "Browser=%%~i"
:: Set fallback for Edge
call :get_registry_value "HKCR\MSEdgeMHT\shell\open\command" "" FallBack
set EdgeCommand=& for %%i in (%FallBack%) do if not defined EdgeCommand set "EdgeCommand=%%~i"
:: Parse command line arguments and check for redirect or noop conditions
set "URI=" & set "URL=" & set "NOOP=" & set "PassThrough=%EdgeCommand:msedge=edge%"
set "CommandLineArgs=%CMDCMDLINE:"=``% "
call :parse_arguments
if defined NOOP (
if not exist "%PassThrough%" (
echo Error: PassThrough path doesn't exist.
pause
exit /b
)
start "" "%PassThrough%" %ParsedArgs%
exit /b
)
:: Decode URL
call :decode_url
if not defined URL (
echo Error: Failed to decode URL.
pause
exit /b
)
:: Open URL in default browser
start "" "%Browser%" "%URL%"
exit
:: Functions
:get_registry_value
setlocal
set regQuery=reg query "%~1" /v %2 /z /se "," /f /e
if "%~2" equ "" set regQuery=reg query "%~1" /ve /z /se "," /f /e
for /f "skip=2 tokens=* delims=" %%V in ('%regQuery% 2^>nul') do set "result=%%V"
if defined result (set "result=%result:*) =%") else (set "%~3=")
endlocal & set "%~3=%result%"
exit /b
:decode_url
:: Brute URL percent decoding
setlocal enabledelayedexpansion
set "decoded=%URL:!=}%"
call :brute_decode
endlocal & set "URL=%decoded%"
exit /b
:parse_arguments
:: Remove specific substrings from arguments
set "CommandLineArgs=%CommandLineArgs:*ie_to_edge_stub.exe`` =%"
set "CommandLineArgs=%CommandLineArgs:*ie_to_edge_stub.exe =%"
set "CommandLineArgs=%CommandLineArgs:*msedge.exe`` =%"
set "CommandLineArgs=%CommandLineArgs:*msedge.exe =%"
:: Remove any trailing spaces
if "%CommandLineArgs:~-1%"==" " set "CommandLineArgs=%CommandLineArgs:~0,-1%"
:: Check if arguments are a redirect or URL
set "RedirectArg=%CommandLineArgs:microsoft-edge=%"
set "UrlArg=%CommandLineArgs:http=%"
set "ParsedArgs=%CommandLineArgs:``="%"
:: Set NOOP flag if no changes to arguments
if "%CommandLineArgs%" equ "%RedirectArg%" (set NOOP=1) else if "%CommandLineArgs%" equ "%UrlArg%" (set NOOP=1)
:: Extract URL if present
if not defined NOOP (
set "URL=%CommandLineArgs:*microsoft-edge=%"
set "URL=http%URL:*http=%"
if "%URL:~-2%"=="``" set "URL=%URL:~0,-2%"
)
exit /b
:brute_decode
:: Brute force URL percent decoding
set "decoded=%decoded:%%20= %"
set "decoded=%decoded:%%21=!!"
set "decoded=%decoded:%%22="%""
set "decoded=%decoded:%%23=#%"
set "decoded=%decoded:%%24=$%"
set "decoded=%decoded:%%25=%%%"
set "decoded=%decoded:%%26=&%"
set "decoded=%decoded:%%27='%"
set "decoded=%decoded:%%28=(%"
set "decoded=%decoded:%%29=)%"
set "decoded=%decoded:%%2A=*%"
set "decoded=%decoded:%%2B=+%"
set "decoded=%decoded:%%2C=,%"
set "decoded=%decoded:%%2D=-%"
set "decoded=%decoded:%%2E=.%"
set "decoded=%decoded:%%2F=/%"
:: ... Continue for other encodings ...
:: Correct any double percentage signs
set "decoded=%decoded:%%%%=%"
exit /b
'@
[io.file]::WriteAllText("$DIR\OpenWebSearch.cmd", $OpenWebSearch)
# Final Steps
# Retrieve the Edge_Removal property from the specified registry paths
$userRegPaths = Get-ChildItem -Path 'Registry::HKEY_Users\S-1-5-21*\Volatile*' -ErrorAction SilentlyContinue
$edgeRemovalPath = $userRegPaths | Get-ItemProperty -Name 'Edge_Removal' -ErrorAction SilentlyContinue
# If the Edge_Removal property exists, remove it
if ($edgeRemovalPath) {
Remove-ItemProperty -Path $edgeRemovalPath.PSPath -Name 'Edge_Removal' -Force -ErrorAction SilentlyContinue
}
# Ensure the explorer process is running
if (-not (Get-Process -Name 'explorer' -ErrorAction SilentlyContinue)) {
Start-Process 'explorer'
}