There seems to be a problem with formatting.
lines: 164 to 195
# find using common locations - used as a backup
function UninstallStringFail {
if ($msis.Count -le 0) {
Write-Status -Text "Couldn't parse uninstall string for Edge. Trying to find uninstaller manually." -Level Warning
}
$script:edgeUninstallers = @()
'LocalApplicationData', 'ProgramFilesX86', 'ProgramFiles' | ForEach-Object {
$folder = [Environment]::GetFolderPath($_)
$script:edgeUninstallers += Get-ChildItem "$folder\Microsoft\Edge*\setup.exe" -Recurse -EA 0 |
Where-Object { ($_ -like '*Edge\Application*') -or ($_ -like '*SxS\Application*') }
}
}
# find using Registry
$uninstallKeyPath = "$baseKey\Windows\CurrentVersion\Uninstall\Microsoft Edge"
$uninstallString = (Get-ItemProperty -Path $uninstallKeyPath -EA 0).UninstallString
if ([string]::IsNullOrEmpty($uninstallString) -and ($msis.Count -le 0)) {
$uninstallString = $null
UninstallStringFail
} else {
# split uninstall string for path & args
$uninstallPath, $uninstallArgs = $uninstallString -split '"', 3 |
Where-Object { $_ } |
ForEach-Object { [System.Environment]::ExpandEnvironmentVariables($_.Trim()) }
# check if fully qualified (should normally be), otherwise it could be null or something in the working dir
if (![System.IO.Path]::IsPathRooted($uninstallPath) -or !(Test-Path $uninstallPath -PathType Leaf)) {
$uninstallPath = $null
UninstallStringFail
}
}
Perhaps it should be like this. :)
# find using common locations - used as a backup
function UninstallStringFail {
if ($msis.Count -le 0) {
Write-Status -Text "Couldn't parse uninstall string for Edge. Trying to find uninstaller manually." -Level Warning
}
$script:edgeUninstallers = @()
'LocalApplicationData', 'ProgramFilesX86', 'ProgramFiles' | ForEach-Object {
$folder = [Environment]::GetFolderPath($_)
$script:edgeUninstallers += Get-ChildItem "$folder\Microsoft\Edge*\setup.exe" -Recurse -EA 0 |
Where-Object { ($_ -like '*Edge\Application*') -or ($_ -like '*SxS\Application*') }
}
}
# find using Registry
$uninstallKeyPath = "$baseKey\Windows\CurrentVersion\Uninstall\Microsoft Edge"
$uninstallString = (Get-ItemProperty -Path $uninstallKeyPath -EA 0).UninstallString
if ([string]::IsNullOrEmpty($uninstallString) -and ($msis.Count -le 0)) {
$uninstallString = $null
UninstallStringFail
} else {
# split uninstall string for path & args
$uninstallPath, $uninstallArgs = $uninstallString -split '"', 3 |
Where-Object { $_ } |
ForEach-Object { [System.Environment]::ExpandEnvironmentVariables($_.Trim()) }
# check if fully qualified (should normally be), otherwise it could be null or something in the working dir
if (![System.IO.Path]::IsPathRooted($uninstallPath) -or !(Test-Path $uninstallPath -PathType Leaf)) {
$uninstallPath = $null
UninstallStringFail
}
}
There seems to be a problem with formatting.
lines: 164 to 195
Perhaps it should be like this. :)