Files
PowerToys/tools/Verification scripts/verify-installation-script.ps1
Miranda Zheng 459dd2fa37 KeystrokeOverlay: New PowerToys module for on screen key strokes (#44250)
<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request
This pull request introduces the new KeystrokeOverlay module to
PowerToys, including its documentation, build configuration, installer
setup, and spell-check dictionary updates. KeystrokeOverlay can be used
to show keys pressed on the screen like Visual Studio Code's Screencast
Mode.

It provides customization options for text size and background, offers
four types of display modes, and three shortcuts for toggling on/off the
display, cycling through monitors, and through different display modes
(see below for more details).

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [x] Closes: #981 
<!-- - [ ] Closes: #yyy (add separate lines for additional resolved
issues) -->
- [x] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [x] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments
**KeystrokeOverlay Module Integration:**

* Added KeystrokeOverlay as a new module in the solution, with
corresponding projects for the keyboard service, UI, and module
interface (`PowerToys.slnx`).
* Added documentation for the Keystroke Overlay module, including
architecture, usage, and debugging instructions
(`doc/devdocs/modules/keystrokeoverlay.md`).
* Updated installer configuration to include Keystroke Overlay, adding
new WiX include and setup files (`installer/PowerToysSetup/Common.wxi`,
`installer/PowerToysSetup/KeystrokeOverlay.wxs`).
[[1]](diffhunk://#diff-ecd2ee19d18433ed47b8f13b44cfff7b00c8009c17bc71139cec0d8571f8f607R1-R59)
[[2]](diffhunk://#diff-af48b984b168acbe5aeb021e97a9e826ab9b52c20c08b36f40dd3e5ad00342b1R1-R9)
* Registered Keystroke Overlay in the settings documentation and issue
templates (`doc/dsc/Settings.md`,
`.github/ISSUE_TEMPLATE/bug_report.yml`,
`.github/ISSUE_TEMPLATE/translation_issue.yml`).
[[1]](diffhunk://#diff-bde46f469b76ba994ea938853f169553846221b329a21e9b59d37c5a0b7d63aeR35)
[[2]](diffhunk://#diff-637f7b97bba458badb691a1557c3d4648686292e948dbe3e8360564378b653efR85)
[[3]](diffhunk://#diff-135b470e9875068a1085599402d6f89bea163068568c426b22f493f35fbfbea6R58)
* Added KeystrokeOverlay binaries to the signing pipeline
(`.pipelines/ESRPSigning_core.json`).

**Customization options**
| Category | Setting | Description | Default / Example |
| :--- | :--- | :--- | :--- |
| **General** | **Enable Keystroke Overlay** | Master toggle to turn the
module on or off. | `On` |
| **Shortcuts** | **Activation Shortcut** | Hotkey to toggle the overlay
visibility. | `Win` + `Shift` + `K` |
| | **Switch Monitor Shortcut** | Hotkey to move the overlay to another
display. | `Win` + `Shift` + `/` |
| | **Switch Display Mode** | Hotkey to cycle through different
visualization modes. | `Win` + `Shift` + `D` |
| **Behavior** | **Draggable Overlay** | Allows you to manually move the
overlay position with your mouse. | `On` |
| | **Display Mode** | Controls what history of keys is shown (e.g.,
history vs. single). | `Last Five Keystrokes` |
| | **Overlay Timeout** | How long (in ms) the keys stay visible before
fading. | `2000` ms |
| **Appearance** | **Text Size** | Adjusts the font size of the keys
inside the overlay. | `37` |
| | **Text Color** | Sets the font color and transparency level. |
`White` (Example) |
| | **Background Color** | Sets the background box color and
transparency level. | `Purple` (Example) |

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed
The new module was tested on multiple different Windows Devices and all
configurations work as expected.

---------

Signed-off-by: Shawn Yuan (from Dev Box) <shuaiyuan@microsoft.com>
Co-authored-by: Sátvik Karanam <89281036+skara9@users.noreply.github.com>
Co-authored-by: Jiří Polášek <me@jiripolasek.com>
Co-authored-by: Software2 <software-2@users.noreply.github.com>
Co-authored-by: Niels Laute <niels.laute@live.nl>
Co-authored-by: Mike Griese <migrie@microsoft.com>
Co-authored-by: Jaylyn Barbee <51131738+Jaylyn-Barbee@users.noreply.github.com>
Co-authored-by: Gordon Lam (SH) <yeelam@microsoft.com>
Co-authored-by: Kai Tao <69313318+vanzue@users.noreply.github.com>
Co-authored-by: Mark Russinovich <markruss@microsoft.com>
Co-authored-by: Mark Russinovich <markruss@ntdev.microsoft.com>
Co-authored-by: Clint Rutkas <clint@rutkas.com>
Co-authored-by: Alex Mihaiuc <69110671+foxmsft@users.noreply.github.com>
Co-authored-by: Michael Jolley <mike@baldbeardedbuilder.com>
Co-authored-by: Gordon Lam <73506701+yeelam-gordon@users.noreply.github.com>
Co-authored-by: leileizhang <leilzh@microsoft.com>
Co-authored-by: Dave Rayment <dave.rayment@gmail.com>
Co-authored-by: Shawn Yuan <128874481+shuaiyuanxx@users.noreply.github.com>
Co-authored-by: Kai Tao <kaitao@microsoft.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jiripolasek <4773077+jiripolasek@users.noreply.github.com>
Co-authored-by: Dustin L. Howett <duhowett@microsoft.com>
Co-authored-by: Sam Rueby <samrueby@gmail.com>
Co-authored-by: Lee Won Jun <dldnjs1013@nate.com>
Co-authored-by: Mason Bergstrom <13530957+MasonBergstrom@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Mike Hall <mikehall@microsoft.com>
Co-authored-by: moooyo <42196638+moooyo@users.noreply.github.com>
Co-authored-by: Yu Leng <yuleng@microsoft.com>
Co-authored-by: dsm20 <74568547+dsm20@users.noreply.github.com>
Co-authored-by: zackpaton <91792781+zackpaton@users.noreply.github.com>
Co-authored-by: Gleb Khmyznikov <gleb.khmyznikov@gmail.com>
Co-authored-by: Guilherme <57814418+DevLGuilherme@users.noreply.github.com>
2025-12-13 08:25:20 +01:00

834 lines
33 KiB
PowerShell

#Requires -Version 5.1
<#
.SYNOPSIS
Verifies a PowerToys installation by checking all components, registry entries, files, and custom logic.
.DESCRIPTION
This script comprehensively verifies a PowerToys installation by checking:
- Registry entries for both per-machine and per-user installations
- File and folder structure integrity
- Module registration and functionality
- WiX installer logic verification
- Custom action results
- DSC module installation
- Command Palette packages
.PARAMETER InstallScope
Specifies the installation scope to verify. Valid values are 'PerMachine' or 'PerUser'.
Default is 'PerMachine'.
.PARAMETER InstallPath
Optional. Specifies a custom installation path to verify. If not provided, the script will
detect the installation path from the registry.
.EXAMPLE
.\verify-installation-script.ps1 -InstallScope PerMachine
.EXAMPLE
.\verify-installation-script.ps1 -InstallScope PerUser
.NOTES
Author: PowerToys Team
Requires: PowerShell 5.1 or later
Requires: Administrative privileges for per-machine verification
#>
[CmdletBinding()]
param(
[Parameter(Mandatory = $false)]
[ValidateSet('PerMachine', 'PerUser')]
[string]$InstallScope = 'PerMachine',
[Parameter(Mandatory = $false)]
[string]$InstallPath
)
# Initialize results tracking
$script:Results = @{
Summary = @{
TotalChecks = 0
PassedChecks = 0
FailedChecks = 0
WarningChecks = 0
OverallStatus = "Unknown"
}
Details = @{}
Timestamp = Get-Date
Computer = $env:COMPUTERNAME
User = $env:USERNAME
PowerShellVersion = $PSVersionTable.PSVersion.ToString()
}
# PowerToys constants
$PowerToysUpgradeCodePerMachine = "{42B84BF7-5FBF-473B-9C8B-049DC16F7708}"
$PowerToysUpgradeCodePerUser = "{D8B559DB-4C98-487A-A33F-50A8EEE42726}"
$PowerToysRegistryKeyPerMachine = "HKLM:\SOFTWARE\Classes\PowerToys"
$PowerToysRegistryKeyPerUser = "HKCU:\SOFTWARE\Classes\PowerToys"
# Utility functions
function Write-StatusMessage {
param(
[string]$Message,
[ValidateSet('Info', 'Success', 'Warning', 'Error')]
[string]$Level = 'Info'
)
$color = switch ($Level) {
'Info' { 'White' }
'Success' { 'Green' }
'Warning' { 'Yellow' }
'Error' { 'Red' }
}
$prefix = switch ($Level) {
'Info' { '[INFO]' }
'Success' { '[PASS]' }
'Warning' { '[WARN]' }
'Error' { '[FAIL]' }
}
Write-Host "$prefix $Message" -ForegroundColor $color
}
function Add-CheckResult {
param(
[string]$Category,
[string]$CheckName,
[string]$Status,
[string]$Message,
[object]$Details = $null
)
$script:Results.Summary.TotalChecks++
switch ($Status) {
'Pass' { $script:Results.Summary.PassedChecks++ }
'Fail' { $script:Results.Summary.FailedChecks++ }
'Warning' { $script:Results.Summary.WarningChecks++ }
}
if (-not $script:Results.Details.ContainsKey($Category)) {
$script:Results.Details[$Category] = @{}
}
$checkDetails = @{
Status = $Status
Message = $Message
Details = $Details
Timestamp = Get-Date
}
$script:Results.Details[$Category][$CheckName] = $checkDetails
# Always show all checks with their status
$level = switch ($Status) {
'Pass' { 'Success' }
'Fail' { 'Error' }
'Warning' { 'Warning' }
}
Write-StatusMessage "[$Category] $CheckName - $Message" -Level $level
}
function Test-RegistryKey {
param(
[string]$Path
)
try {
return Test-Path $Path
}
catch {
return $false
}
}
function Get-RegistryValue {
param(
[string]$Path,
[string]$Name,
[object]$DefaultValue = $null
)
try {
$value = Get-ItemProperty -Path $Path -Name $Name -ErrorAction SilentlyContinue
return $value.$Name
}
catch {
return $DefaultValue
}
}
function Test-PowerToysInstallation {
param(
[ValidateSet('PerMachine', 'PerUser')]
[string]$Scope
)
Write-StatusMessage "Verifying PowerToys $Scope installation..." -Level Info
# Determine registry paths based on scope
$registryKey = if ($Scope -eq 'PerMachine') { $PowerToysRegistryKeyPerMachine } else { $PowerToysRegistryKeyPerUser }
# Check main registry key
$mainKeyExists = Test-RegistryKey -Path $registryKey
Add-CheckResult -Category "Registry" -CheckName "Main Registry Key ($Scope)" -Status $(if ($mainKeyExists) { 'Pass' } else { 'Fail' }) -Message "Registry key exists: $registryKey"
if (-not $mainKeyExists) {
Add-CheckResult -Category "Installation" -CheckName "Installation Status ($Scope)" -Status 'Fail' -Message "PowerToys $Scope installation not found"
return $false
}
# Check install scope value
$installScopeValue = Get-RegistryValue -Path $registryKey -Name "InstallScope"
$expectedScope = $Scope.ToLower()
if ($Scope -eq 'PerMachine') { $expectedScope = 'perMachine' }
if ($Scope -eq 'PerUser') { $expectedScope = 'perUser' }
$scopeCorrect = $installScopeValue -eq $expectedScope
Add-CheckResult -Category "Registry" -CheckName "Install Scope Value ($Scope)" -Status $(if ($scopeCorrect) { 'Pass' } else { 'Fail' }) -Message "Install scope: Expected '$expectedScope', Found '$installScopeValue'"
# Check for uninstall registry entry (this is what makes PowerToys appear in Add/Remove Programs)
$uninstallKey = if ($Scope -eq 'PerMachine') {
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*"
}
else {
"HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*"
}
try {
$powerToysEntry = Get-ItemProperty -Path $uninstallKey | Where-Object {
$_.DisplayName -like "*PowerToys*"
} | Select-Object -First 1
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
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 "Uninstall Registry Entry ($Scope)" -Status 'Fail' -Message "PowerToys uninstall entry not found in Windows uninstall registry"
}
}
catch {
Add-CheckResult -Category "Registry" -CheckName "Uninstall Registry Entry ($Scope)" -Status 'Fail' -Message "Failed to read Windows uninstall registry"
}
# Check for installation folder
$installFolder = Get-PowerToysInstallPath -Scope $Scope
if ($installFolder -and (Test-Path $installFolder)) {
Add-CheckResult -Category "Installation" -CheckName "Install Folder ($Scope)" -Status 'Pass' -Message "Installation folder exists: $installFolder"
# Verify core files
Test-CoreFiles -InstallPath $installFolder -Scope $Scope
# Verify modules
Test-ModuleFiles -InstallPath $installFolder -Scope $Scope
return $true
}
else {
Add-CheckResult -Category "Installation" -CheckName "Install Folder ($Scope)" -Status 'Fail' -Message "Installation folder not found or inaccessible: $installFolder"
return $false
}
}
function Get-PowerToysInstallPath {
param(
[ValidateSet('PerMachine', 'PerUser')]
[string]$Scope
)
if ($InstallPath) {
return $InstallPath
}
# Since InstallLocation may not be reliably set in the uninstall registry,
# we'll use the default installation paths based on scope
if ($Scope -eq 'PerMachine') {
$defaultPath = "${env:ProgramFiles}\PowerToys"
}
else {
$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
$uninstallKey = if ($Scope -eq 'PerMachine') {
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*"
}
else {
"HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*"
}
try {
$powerToysEntry = Get-ItemProperty -Path $uninstallKey | Where-Object {
$_.DisplayName -like "*PowerToys*"
} | Select-Object -First 1
# Check for InstallLocation first, but it may not exist
if ($powerToysEntry -and $powerToysEntry.InstallLocation) {
return $powerToysEntry.InstallLocation.TrimEnd('\')
}
# Check for UninstallString as alternative source of install path
if ($powerToysEntry -and $powerToysEntry.UninstallString) {
# Extract directory from uninstall string like "C:\Program Files\PowerToys\unins000.exe"
$uninstallExe = $powerToysEntry.UninstallString.Trim('"')
$installDir = Split-Path $uninstallExe -Parent
if ($installDir -and (Test-Path $installDir)) {
return $installDir
}
}
}
catch {
# If registry read fails, fall back to null
}
# If we can't determine the install path, return null
return $null
}
function Test-CoreFiles {
param(
[string]$InstallPath,
[string]$Scope
)
# Essential core files (must exist for basic functionality)
$essentialCoreFiles = @(
'PowerToys.exe',
'PowerToys.ActionRunner.exe',
'License.rtf',
'Notice.md'
)
# Critical signed PowerToys executable files (from ESRP signing config)
$criticalSignedFiles = @(
# Main PowerToys components
'PowerToys.exe',
'PowerToys.ActionRunner.exe',
'PowerToys.Update.exe',
'PowerToys.BackgroundActivatorDLL.dll',
'PowerToys.FilePreviewCommon.dll',
'PowerToys.Interop.dll',
# Common libraries
'CalculatorEngineCommon.dll',
'PowerToys.ManagedTelemetry.dll',
'PowerToys.ManagedCommon.dll',
'PowerToys.ManagedCsWin32.dll',
'PowerToys.Common.UI.dll',
'PowerToys.Settings.UI.Lib.dll',
'PowerToys.GPOWrapper.dll',
'PowerToys.GPOWrapperProjection.dll',
'PowerToys.AllExperiments.dll',
# Module executables and libraries
'PowerToys.AlwaysOnTop.exe',
'PowerToys.AlwaysOnTopModuleInterface.dll',
'PowerToys.CmdNotFoundModuleInterface.dll',
'PowerToys.ColorPicker.dll',
'PowerToys.ColorPickerUI.dll',
'PowerToys.ColorPickerUI.exe',
'PowerToys.CropAndLockModuleInterface.dll',
'PowerToys.CropAndLock.exe',
'PowerToys.PowerOCRModuleInterface.dll',
'PowerToys.PowerOCR.dll',
'PowerToys.PowerOCR.exe',
'PowerToys.AdvancedPasteModuleInterface.dll',
'PowerToys.AwakeModuleInterface.dll',
'PowerToys.Awake.exe',
'PowerToys.Awake.dll',
# FancyZones
'PowerToys.FancyZonesEditor.exe',
'PowerToys.FancyZonesEditor.dll',
'PowerToys.FancyZonesEditorCommon.dll',
'PowerToys.FancyZonesModuleInterface.dll',
'PowerToys.FancyZones.exe',
# Preview handlers
'PowerToys.GcodePreviewHandler.dll',
'PowerToys.GcodePreviewHandler.exe',
'PowerToys.GcodePreviewHandlerCpp.dll',
'PowerToys.GcodeThumbnailProvider.dll',
'PowerToys.GcodeThumbnailProvider.exe',
'PowerToys.GcodeThumbnailProviderCpp.dll',
'PowerToys.BgcodePreviewHandler.dll',
'PowerToys.BgcodePreviewHandler.exe',
'PowerToys.BgcodePreviewHandlerCpp.dll',
'PowerToys.BgcodeThumbnailProvider.dll',
'PowerToys.BgcodeThumbnailProvider.exe',
'PowerToys.BgcodeThumbnailProviderCpp.dll',
'PowerToys.MarkdownPreviewHandler.dll',
'PowerToys.MarkdownPreviewHandler.exe',
'PowerToys.MarkdownPreviewHandlerCpp.dll',
'PowerToys.MonacoPreviewHandler.dll',
'PowerToys.MonacoPreviewHandler.exe',
'PowerToys.MonacoPreviewHandlerCpp.dll',
'PowerToys.PdfPreviewHandler.dll',
'PowerToys.PdfPreviewHandler.exe',
'PowerToys.PdfPreviewHandlerCpp.dll',
'PowerToys.PdfThumbnailProvider.dll',
'PowerToys.PdfThumbnailProvider.exe',
'PowerToys.PdfThumbnailProviderCpp.dll',
'PowerToys.powerpreview.dll',
'PowerToys.PreviewHandlerCommon.dll',
'PowerToys.QoiPreviewHandler.dll',
'PowerToys.QoiPreviewHandler.exe',
'PowerToys.QoiPreviewHandlerCpp.dll',
'PowerToys.QoiThumbnailProvider.dll',
'PowerToys.QoiThumbnailProvider.exe',
'PowerToys.QoiThumbnailProviderCpp.dll',
'PowerToys.StlThumbnailProvider.dll',
'PowerToys.StlThumbnailProvider.exe',
'PowerToys.StlThumbnailProviderCpp.dll',
'PowerToys.SvgPreviewHandler.dll',
'PowerToys.SvgPreviewHandler.exe',
'PowerToys.SvgPreviewHandlerCpp.dll',
'PowerToys.SvgThumbnailProvider.dll',
'PowerToys.SvgThumbnailProvider.exe',
'PowerToys.SvgThumbnailProviderCpp.dll',
# Image Resizer
'PowerToys.ImageResizer.exe',
'PowerToys.ImageResizer.dll',
'PowerToys.ImageResizerExt.dll',
'PowerToys.ImageResizerContextMenu.dll',
# Keyboard Manager
'PowerToys.KeyboardManager.dll',
'PowerToys.KeyboardManagerEditorLibraryWrapper.dll',
# PowerToys Run
'PowerToys.Launcher.dll',
'PowerToys.PowerLauncher.dll',
'PowerToys.PowerLauncher.exe',
'PowerToys.PowerLauncher.Telemetry.dll',
'Wox.Infrastructure.dll',
'Wox.Plugin.dll',
# Mouse utilities
'PowerToys.FindMyMouse.dll',
'PowerToys.MouseHighlighter.dll',
'PowerToys.MouseJump.dll',
'PowerToys.MouseJump.Common.dll',
'PowerToys.MousePointerCrosshairs.dll',
'PowerToys.MouseJumpUI.dll',
'PowerToys.MouseJumpUI.exe',
'PowerToys.MouseWithoutBorders.dll',
'PowerToys.MouseWithoutBorders.exe',
'PowerToys.MouseWithoutBordersModuleInterface.dll',
'PowerToys.MouseWithoutBordersService.dll',
'PowerToys.MouseWithoutBordersService.exe',
'PowerToys.MouseWithoutBordersHelper.dll',
'PowerToys.MouseWithoutBordersHelper.exe',
# PowerAccent
'PowerAccent.Core.dll',
'PowerToys.PowerAccent.dll',
'PowerToys.PowerAccent.exe',
'PowerToys.PowerAccentModuleInterface.dll',
'PowerToys.PowerAccentKeyboardService.dll',
# Workspaces
'PowerToys.WorkspacesSnapshotTool.exe',
'PowerToys.WorkspacesLauncher.exe',
'PowerToys.WorkspacesWindowArranger.exe',
'PowerToys.WorkspacesEditor.exe',
'PowerToys.WorkspacesEditor.dll',
'PowerToys.WorkspacesLauncherUI.exe',
'PowerToys.WorkspacesLauncherUI.dll',
'PowerToys.WorkspacesModuleInterface.dll',
'PowerToys.WorkspacesCsharpLibrary.dll',
# Shortcut Guide
'PowerToys.ShortcutGuide.exe',
'PowerToys.ShortcutGuideModuleInterface.dll',
# ZoomIt
'PowerToys.ZoomIt.exe',
'PowerToys.ZoomItModuleInterface.dll',
'PowerToys.ZoomItSettingsInterop.dll',
# Command Palette
'PowerToys.CmdPalModuleInterface.dll',
'CmdPalKeyboardService.dll'
)
# WinUI3Apps signed files (in WinUI3Apps subdirectory)
$winUI3SignedFiles = @(
'PowerToys.Settings.dll',
'PowerToys.Settings.exe',
'PowerToys.AdvancedPaste.exe',
'PowerToys.AdvancedPaste.dll',
'PowerToys.HostsModuleInterface.dll',
'PowerToys.HostsUILib.dll',
'PowerToys.Hosts.dll',
'PowerToys.Hosts.exe',
'PowerToys.FileLocksmithLib.Interop.dll',
'PowerToys.FileLocksmithExt.dll',
'PowerToys.FileLocksmithUI.exe',
'PowerToys.FileLocksmithUI.dll',
'PowerToys.FileLocksmithContextMenu.dll',
'Peek.Common.dll',
'Peek.FilePreviewer.dll',
'Powertoys.Peek.UI.dll',
'Powertoys.Peek.UI.exe',
'Powertoys.Peek.dll',
'PowerToys.EnvironmentVariablesModuleInterface.dll',
'PowerToys.EnvironmentVariablesUILib.dll',
'PowerToys.EnvironmentVariables.dll',
'PowerToys.EnvironmentVariables.exe',
'PowerToys.MeasureToolModuleInterface.dll',
'PowerToys.MeasureToolCore.dll',
'PowerToys.MeasureToolUI.dll',
'PowerToys.MeasureToolUI.exe',
'PowerToys.NewPlus.ShellExtension.dll',
'PowerToys.NewPlus.ShellExtension.win10.dll',
'PowerToys.PowerRenameExt.dll',
'PowerToys.PowerRename.exe',
'PowerToys.PowerRenameContextMenu.dll',
'PowerToys.RegistryPreviewExt.dll',
'PowerToys.RegistryPreviewUILib.dll',
'PowerToys.RegistryPreview.dll',
'PowerToys.RegistryPreview.exe',
'PowerToys.KeystrokeOverlayModuleInterface.dll',
'PowerToys.KeystrokeOverlay.exe'
)
# Tools signed files (in Tools subdirectory)
$toolsSignedFiles = @(
'PowerToys.BugReportTool.exe'
)
# KeyboardManager signed files (in specific subdirectories)
$keyboardManagerFiles = @{
'KeyboardManagerEditor\PowerToys.KeyboardManagerEditor.exe' = 'KeyboardManagerEditor'
'KeyboardManagerEngine\PowerToys.KeyboardManagerEngine.exe' = 'KeyboardManagerEngine'
}
# Run plugins signed files (in RunPlugins subdirectories)
$runPluginFiles = @{
'RunPlugins\Calculator\Microsoft.PowerToys.Run.Plugin.Calculator.dll' = 'Calculator plugin'
'RunPlugins\Folder\Microsoft.Plugin.Folder.dll' = 'Folder plugin'
'RunPlugins\Indexer\Microsoft.Plugin.Indexer.dll' = 'Indexer plugin'
'RunPlugins\OneNote\Microsoft.PowerToys.Run.Plugin.OneNote.dll' = 'OneNote plugin'
'RunPlugins\History\Microsoft.PowerToys.Run.Plugin.History.dll' = 'History plugin'
'RunPlugins\PowerToys\Microsoft.PowerToys.Run.Plugin.PowerToys.dll' = 'PowerToys plugin'
'RunPlugins\Program\Microsoft.Plugin.Program.dll' = 'Program plugin'
'RunPlugins\Registry\Microsoft.PowerToys.Run.Plugin.Registry.dll' = 'Registry plugin'
'RunPlugins\WindowsSettings\Microsoft.PowerToys.Run.Plugin.WindowsSettings.dll' = 'Windows Settings plugin'
'RunPlugins\Shell\Microsoft.Plugin.Shell.dll' = 'Shell plugin'
'RunPlugins\Uri\Microsoft.Plugin.Uri.dll' = 'URI plugin'
'RunPlugins\WindowWalker\Microsoft.Plugin.WindowWalker.dll' = 'Window Walker plugin'
'RunPlugins\UnitConverter\Community.PowerToys.Run.Plugin.UnitConverter.dll' = 'Unit Converter plugin'
'RunPlugins\VSCodeWorkspaces\Community.PowerToys.Run.Plugin.VSCodeWorkspaces.dll' = 'VS Code Workspaces plugin'
'RunPlugins\Service\Microsoft.PowerToys.Run.Plugin.Service.dll' = 'Service plugin'
'RunPlugins\System\Microsoft.PowerToys.Run.Plugin.System.dll' = 'System plugin'
'RunPlugins\TimeDate\Microsoft.PowerToys.Run.Plugin.TimeDate.dll' = 'Time Date plugin'
'RunPlugins\ValueGenerator\Community.PowerToys.Run.Plugin.ValueGenerator.dll' = 'Value Generator plugin'
'RunPlugins\WebSearch\Community.PowerToys.Run.Plugin.WebSearch.dll' = 'Web Search plugin'
'RunPlugins\WindowsTerminal\Microsoft.PowerToys.Run.Plugin.WindowsTerminal.dll' = 'Windows Terminal plugin'
}
# Check essential core files (must exist)
Write-StatusMessage "Checking essential core files..." -Level Info
foreach ($file in $essentialCoreFiles) {
$filePath = Join-Path $InstallPath $file
$exists = Test-Path $filePath
Add-CheckResult -Category "Core Files" -CheckName "$file ($Scope)" -Status $(if ($exists) { 'Pass' } else { 'Fail' }) -Message "Essential file: $filePath"
}
# Check critical signed files in root directory
Write-StatusMessage "Checking critical signed files in root directory..." -Level Info
foreach ($file in $criticalSignedFiles) {
$filePath = Join-Path $InstallPath $file
$exists = Test-Path $filePath
# Most signed files are critical, but some may be optional depending on configuration
$status = if ($exists) { 'Pass' } else { 'Warning' }
Add-CheckResult -Category "Signed Files" -CheckName "$file ($Scope)" -Status $status -Message "Signed file: $filePath"
}
# Check WinUI3Apps signed files
Write-StatusMessage "Checking WinUI3Apps signed files..." -Level Info
foreach ($file in $winUI3SignedFiles) {
$filePath = Join-Path $InstallPath "WinUI3Apps\$file"
$exists = Test-Path $filePath
$status = if ($exists) { 'Pass' } else { 'Warning' }
Add-CheckResult -Category "Signed Files" -CheckName "WinUI3Apps\$file ($Scope)" -Status $status -Message "WinUI3 signed file: $filePath"
}
# Check Tools signed files
Write-StatusMessage "Checking Tools signed files..." -Level Info
foreach ($file in $toolsSignedFiles) {
$filePath = Join-Path $InstallPath "Tools\$file"
$exists = Test-Path $filePath
$status = if ($exists) { 'Pass' } else { 'Warning' }
Add-CheckResult -Category "Signed Files" -CheckName "Tools\$file ($Scope)" -Status $status -Message "Tools signed file: $filePath"
}
# Check KeyboardManager files
Write-StatusMessage "Checking KeyboardManager signed files..." -Level Info
foreach ($relativePath in $keyboardManagerFiles.Keys) {
$filePath = Join-Path $InstallPath $relativePath
$exists = Test-Path $filePath
$status = if ($exists) { 'Pass' } else { 'Warning' }
$description = $keyboardManagerFiles[$relativePath]
Add-CheckResult -Category "Signed Files" -CheckName "$relativePath ($Scope)" -Status $status -Message "KeyboardManager $description signed file: $filePath"
}
# Check Run plugins files
Write-StatusMessage "Checking PowerToys Run plugin files..." -Level Info
foreach ($relativePath in $runPluginFiles.Keys) {
$filePath = Join-Path $InstallPath $relativePath
$exists = Test-Path $filePath
$status = if ($exists) { 'Pass' } else { 'Warning' }
$description = $runPluginFiles[$relativePath]
Add-CheckResult -Category "Signed Files" -CheckName "$relativePath ($Scope)" -Status $status -Message "PowerToys Run $description signed file: $filePath"
}
}
function Test-ModuleFiles {
param(
[string]$InstallPath,
[string]$Scope
)
# PowerToys does not actually install modules in a "modules" subfolder.
# Instead, modules are integrated directly into the main installation or specific subfolders.
# Check for key module directories that should exist:
# Check KeyboardManager components (installed as separate folders)
$keyboardManagerEditor = Join-Path $InstallPath "KeyboardManagerEditor"
$keyboardManagerEngine = Join-Path $InstallPath "KeyboardManagerEngine"
if (Test-Path $keyboardManagerEditor) {
Add-CheckResult -Category "Modules" -CheckName "KeyboardManager Editor ($Scope)" -Status 'Pass' -Message "KeyboardManager Editor folder exists: $keyboardManagerEditor"
}
else {
Add-CheckResult -Category "Modules" -CheckName "KeyboardManager Editor ($Scope)" -Status 'Warning' -Message "KeyboardManager Editor folder not found: $keyboardManagerEditor"
}
if (Test-Path $keyboardManagerEngine) {
Add-CheckResult -Category "Modules" -CheckName "KeyboardManager Engine ($Scope)" -Status 'Pass' -Message "KeyboardManager Engine folder exists: $keyboardManagerEngine"
}
else {
Add-CheckResult -Category "Modules" -CheckName "KeyboardManager Engine ($Scope)" -Status 'Warning' -Message "KeyboardManager Engine folder not found: $keyboardManagerEngine"
}
# Check RunPlugins folder (contains PowerToys Run modules)
$runPluginsPath = Join-Path $InstallPath "RunPlugins"
if (Test-Path $runPluginsPath) {
Add-CheckResult -Category "Modules" -CheckName "Run Plugins Folder ($Scope)" -Status 'Pass' -Message "Run plugins folder exists: $runPluginsPath"
}
else {
Add-CheckResult -Category "Modules" -CheckName "Run Plugins Folder ($Scope)" -Status 'Warning' -Message "Run plugins folder not found: $runPluginsPath"
}
# Check Tools folder
$toolsPath = Join-Path $InstallPath "Tools"
if (Test-Path $toolsPath) {
Add-CheckResult -Category "Modules" -CheckName "Tools Folder ($Scope)" -Status 'Pass' -Message "Tools folder exists: $toolsPath"
}
else {
Add-CheckResult -Category "Modules" -CheckName "Tools Folder ($Scope)" -Status 'Warning' -Message "Tools folder not found: $toolsPath"
}
}
function Test-RegistryHandlers {
param(
[string]$Scope
)
$registryRoot = if ($Scope -eq 'PerMachine') { 'HKLM:' } else { 'HKCU:' }
# Test URL protocol handler
$protocolPath = "$registryRoot\SOFTWARE\Classes\powertoys"
if (Test-RegistryKey -Path $protocolPath) {
Add-CheckResult -Category "Registry Handlers" -CheckName "PowerToys URL Protocol ($Scope)" -Status 'Pass' -Message "URL protocol registered"
# Check command handler
$commandPath = "$protocolPath\shell\open\command"
if (Test-RegistryKey -Path $commandPath) {
Add-CheckResult -Category "Registry Handlers" -CheckName "PowerToys URL Command ($Scope)" -Status 'Pass' -Message "URL command handler registered"
}
else {
Add-CheckResult -Category "Registry Handlers" -CheckName "PowerToys URL Command ($Scope)" -Status 'Fail' -Message "URL command handler not found"
}
}
else {
Add-CheckResult -Category "Registry Handlers" -CheckName "PowerToys URL Protocol ($Scope)" -Status 'Fail' -Message "URL protocol not registered"
}
# Test CLSID registration for toast notifications
$toastClsidPath = "$registryRoot\SOFTWARE\Classes\CLSID\{DD5CACDA-7C2E-4997-A62A-04A597B58F76}"
if (Test-RegistryKey -Path $toastClsidPath) {
Add-CheckResult -Category "Registry Handlers" -CheckName "Toast Notification CLSID ($Scope)" -Status 'Pass' -Message "Toast notification CLSID registered"
}
else {
Add-CheckResult -Category "Registry Handlers" -CheckName "Toast Notification CLSID ($Scope)" -Status 'Warning' -Message "Toast notification CLSID not found"
}
}
function Test-DSCModule {
param(
[string]$Scope
)
if ($Scope -eq 'PerUser') {
# For per-user installations, DSC module is installed via custom action to user's Documents
$userModulesPath = "$env:USERPROFILE\Documents\PowerShell\Modules\Microsoft.PowerToys.Configure"
if (Test-Path $userModulesPath) {
Add-CheckResult -Category "DSC Module" -CheckName "DSC Module (PerUser)" -Status 'Pass' -Message "DSC module found in user profile: $userModulesPath"
}
else {
Add-CheckResult -Category "DSC Module" -CheckName "DSC Module (PerUser)" -Status 'Fail' -Message "DSC module not found in user profile: $userModulesPath"
}
}
else {
# For per-machine installations, DSC module is installed to system WindowsPowerShell modules
$systemModulesPath = "${env:ProgramFiles}\WindowsPowerShell\Modules\Microsoft.PowerToys.Configure"
if (Test-Path $systemModulesPath) {
Add-CheckResult -Category "DSC Module" -CheckName "DSC Module (PerMachine)" -Status 'Pass' -Message "DSC module found in system modules: $systemModulesPath"
}
else {
Add-CheckResult -Category "DSC Module" -CheckName "DSC Module (PerMachine)" -Status 'Fail' -Message "DSC module not found in system modules: $systemModulesPath"
}
}
}
function Test-CommandPalettePackages {
param(
[string]$InstallPath
)
$cmdPalPath = Join-Path $InstallPath "WinUI3Apps\CmdPal"
if (Test-Path $cmdPalPath) {
# Check for MSIX package file (the actual Command Palette installation)
$msixFiles = Get-ChildItem $cmdPalPath -Filter "*.msix" -ErrorAction SilentlyContinue
if ($msixFiles) {
Add-CheckResult -Category "Command Palette" -CheckName "CmdPal MSIX Package" -Status 'Pass' -Message "Found $($msixFiles.Count) Command Palette MSIX package(s)"
}
else {
Add-CheckResult -Category "Command Palette" -CheckName "CmdPal MSIX Package" -Status 'Warning' -Message "No Command Palette MSIX packages found"
}
}
else {
Add-CheckResult -Category "Command Palette" -CheckName "CmdPal Module" -Status 'Warning' -Message "Command Palette module not found at: $cmdPalPath"
}
}
function Test-ContextMenuPackages {
param(
[string]$InstallPath
)
# Context menu packages are installed as sparse packages
# These MSIX packages should be present in the installation
$contextMenuPackages = @{
"ImageResizerContextMenuPackage.msix" = @{ Name = "Image Resizer context menu package"; Location = "Root" }
"FileLocksmithContextMenuPackage.msix" = @{ Name = "File Locksmith context menu package"; Location = "WinUI3Apps" }
"PowerRenameContextMenuPackage.msix" = @{ Name = "PowerRename context menu package"; Location = "WinUI3Apps" }
"NewPlusPackage.msix" = @{ Name = "New+ context menu package"; Location = "WinUI3Apps" }
}
# Check for packages based on their expected location
foreach ($packageFile in $contextMenuPackages.Keys) {
$packageInfo = $contextMenuPackages[$packageFile]
if ($packageInfo.Location -eq "Root") {
$packagePath = Join-Path $InstallPath $packageFile
}
else {
$packagePath = Join-Path $InstallPath "WinUI3Apps\$packageFile"
}
if (Test-Path $packagePath) {
Add-CheckResult -Category "Context Menu Packages" -CheckName $packageInfo.Name -Status 'Pass' -Message "Context menu package found: $packagePath"
}
else {
Add-CheckResult -Category "Context Menu Packages" -CheckName $packageInfo.Name -Status 'Fail' -Message "Context menu package not found: $packagePath"
}
}
}
# Main execution
function Main {
Write-StatusMessage "Starting PowerToys Installation Verification" -Level Info
Write-StatusMessage "Scope: $InstallScope" -Level Info
# Check the specified scope - no fallbacks, only what installer should create
$installationFound = $false
if ($InstallScope -eq 'PerMachine') {
if (Test-PowerToysInstallation -Scope 'PerMachine') {
$installationFound = $true
Test-RegistryHandlers -Scope 'PerMachine'
Test-DSCModule -Scope 'PerMachine'
$installPath = Get-PowerToysInstallPath -Scope 'PerMachine'
if ($installPath) {
Test-CommandPalettePackages -InstallPath $installPath
Test-ContextMenuPackages -InstallPath $installPath
}
}
}
else { # PerUser
if (Test-PowerToysInstallation -Scope 'PerUser') {
$installationFound = $true
Test-RegistryHandlers -Scope 'PerUser'
Test-DSCModule -Scope 'PerUser'
$installPath = Get-PowerToysInstallPath -Scope 'PerUser'
if ($installPath) {
Test-CommandPalettePackages -InstallPath $installPath
Test-ContextMenuPackages -InstallPath $installPath
}
}
}
if ($installationFound) {
# Common tests (only run if installation found)
# Note: Scheduled tasks are not created by installer, they're created at runtime
}
# Calculate overall status
if ($script:Results.Summary.FailedChecks -eq 0) {
if ($script:Results.Summary.WarningChecks -eq 0) {
$script:Results.Summary.OverallStatus = "Healthy"
}
else {
$script:Results.Summary.OverallStatus = "Healthy with Warnings"
}
}
else {
$script:Results.Summary.OverallStatus = "Issues Detected"
}
# Display summary
Write-Host "`n" -NoNewline
Write-StatusMessage "=== VERIFICATION SUMMARY ===" -Level Info
Write-StatusMessage "Total Checks: $($script:Results.Summary.TotalChecks)" -Level Info
Write-StatusMessage "Passed: $($script:Results.Summary.PassedChecks)" -Level Success
Write-StatusMessage "Failed: $($script:Results.Summary.FailedChecks)" -Level Error
Write-StatusMessage "Warnings: $($script:Results.Summary.WarningChecks)" -Level Warning
Write-StatusMessage "Overall Status: $($script:Results.Summary.OverallStatus)" -Level $(
switch ($script:Results.Summary.OverallStatus) {
'Healthy' { 'Success' }
'Healthy with Warnings' { 'Warning' }
default { 'Error' }
}
)
Write-StatusMessage "PowerToys Installation Verification Complete" -Level Info
}
# Run the main function
Main