mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-01-01 01:46:50 +01:00
Compare commits
2 Commits
dev/vanzue
...
copilot/fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f0400e666d | ||
|
|
afef99d14e |
@@ -11,6 +11,11 @@
|
||||
<RegistryValue Type="string" Name="InstallScope" Value="$(var.InstallScope)" />
|
||||
</RegistryKey>
|
||||
</Component>
|
||||
<Component Id="powertoys_uninstall_reg" Win64="yes">
|
||||
<RegistryKey Root="$(var.RegistryScope)" Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\[ProductCode]">
|
||||
<RegistryValue Type="string" Name="InstallLocation" Value="[INSTALLFOLDER]" KeyPath="yes" />
|
||||
</RegistryKey>
|
||||
</Component>
|
||||
<Component Id="powertoys_toast_clsid" Win64="yes">
|
||||
<RemoveFolder Id='Remove_powertoys_toast_clsid' On='uninstall' />
|
||||
<RegistryKey Root="$(var.RegistryScope)" Key="Software\Classes\CLSID\{DD5CACDA-7C2E-4997-A62A-04A597B58F76}">
|
||||
@@ -128,6 +133,7 @@
|
||||
<ComponentRef Id="powertoys_exe" />
|
||||
<ComponentRef Id="PowerToysStartMenuShortcut"/>
|
||||
<ComponentRef Id="powertoys_per_machine_comp" />
|
||||
<ComponentRef Id="powertoys_uninstall_reg" />
|
||||
<ComponentRef Id="powertoys_toast_clsid" />
|
||||
<ComponentRef Id="License_rtf" />
|
||||
<ComponentRef Id="Notice_md" />
|
||||
|
||||
@@ -9,6 +9,11 @@
|
||||
<RegistryValue Type="string" Name="InstallScope" Value="$(var.InstallScope)" />
|
||||
</RegistryKey>
|
||||
</Component>
|
||||
<Component Id="powertoys_uninstall_reg" Bitness="always64">
|
||||
<RegistryKey Root="$(var.RegistryScope)" Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\[ProductCode]">
|
||||
<RegistryValue Type="string" Name="InstallLocation" Value="[INSTALLFOLDER]" KeyPath="yes" />
|
||||
</RegistryKey>
|
||||
</Component>
|
||||
<Component Id="powertoys_toast_clsid" Bitness="always64">
|
||||
<RemoveFolder Id="Remove_powertoys_toast_clsid" On="uninstall" />
|
||||
<RegistryKey Root="$(var.RegistryScope)" Key="Software\Classes\CLSID\{DD5CACDA-7C2E-4997-A62A-04A597B58F76}">
|
||||
@@ -109,6 +114,7 @@
|
||||
<ComponentRef Id="powertoys_exe" />
|
||||
<ComponentRef Id="PowerToysStartMenuShortcut" />
|
||||
<ComponentRef Id="powertoys_per_machine_comp" />
|
||||
<ComponentRef Id="powertoys_uninstall_reg" />
|
||||
<ComponentRef Id="powertoys_toast_clsid" />
|
||||
<ComponentRef Id="License_rtf" />
|
||||
<ComponentRef Id="Notice_md" />
|
||||
|
||||
@@ -202,12 +202,13 @@ function Test-PowerToysInstallation {
|
||||
if ($powerToysEntry) {
|
||||
Add-CheckResult -Category "Registry" -CheckName "Uninstall Registry Entry ($Scope)" -Status 'Pass' -Message "PowerToys uninstall entry found with DisplayName: $($powerToysEntry.DisplayName)"
|
||||
|
||||
# Note: InstallLocation may or may not be set in the uninstall registry
|
||||
# This is normal behavior as PowerToys uses direct file references for system bindings
|
||||
# Check for InstallLocation registry value
|
||||
if ($powerToysEntry.InstallLocation) {
|
||||
Add-CheckResult -Category "Registry" -CheckName "Install Location Registry ($Scope)" -Status 'Pass' -Message "InstallLocation found: $($powerToysEntry.InstallLocation)"
|
||||
}
|
||||
# No need to report missing InstallLocation as it's not required
|
||||
else {
|
||||
Add-CheckResult -Category "Registry" -CheckName "Install Location Registry ($Scope)" -Status 'Fail' -Message "InstallLocation missing in uninstall registry entry"
|
||||
}
|
||||
}
|
||||
else {
|
||||
Add-CheckResult -Category "Registry" -CheckName "Uninstall Registry Entry ($Scope)" -Status 'Fail' -Message "PowerToys uninstall entry not found in Windows uninstall registry"
|
||||
@@ -246,8 +247,8 @@ function Get-PowerToysInstallPath {
|
||||
return $InstallPath
|
||||
}
|
||||
|
||||
# Since InstallLocation may not be reliably set in the uninstall registry,
|
||||
# we'll use the default installation paths based on scope
|
||||
# Try to get the installation path from the registry first, fall back to default paths
|
||||
# if InstallLocation is not available
|
||||
if ($Scope -eq 'PerMachine') {
|
||||
$defaultPath = "${env:ProgramFiles}\PowerToys"
|
||||
}
|
||||
@@ -255,12 +256,7 @@ function Get-PowerToysInstallPath {
|
||||
$defaultPath = "${env:LOCALAPPDATA}\PowerToys"
|
||||
}
|
||||
|
||||
# Verify the path exists before returning it
|
||||
if (Test-Path $defaultPath) {
|
||||
return $defaultPath
|
||||
}
|
||||
|
||||
# If default path doesn't exist, try to get it from uninstall registry as fallback
|
||||
# Try to get path from uninstall registry first
|
||||
$uninstallKey = if ($Scope -eq 'PerMachine') {
|
||||
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*"
|
||||
}
|
||||
@@ -273,7 +269,7 @@ function Get-PowerToysInstallPath {
|
||||
$_.DisplayName -like "*PowerToys*"
|
||||
} | Select-Object -First 1
|
||||
|
||||
# Check for InstallLocation first, but it may not exist
|
||||
# Check for InstallLocation first
|
||||
if ($powerToysEntry -and $powerToysEntry.InstallLocation) {
|
||||
return $powerToysEntry.InstallLocation.TrimEnd('\')
|
||||
}
|
||||
@@ -289,7 +285,12 @@ function Get-PowerToysInstallPath {
|
||||
}
|
||||
}
|
||||
catch {
|
||||
# If registry read fails, fall back to null
|
||||
# If registry read fails, fall back to default path
|
||||
}
|
||||
|
||||
# Verify the default path exists before returning it
|
||||
if (Test-Path $defaultPath) {
|
||||
return $defaultPath
|
||||
}
|
||||
|
||||
# If we can't determine the install path, return null
|
||||
|
||||
Reference in New Issue
Block a user