Files
PowerToys/.pipelines/installPowertoys.ps1
Gleb Khmyznikov 85f698677a [UITests] AI migration skill + ScreenRuler tests example port. (#48842)
This PR is build on top of
https://github.com/microsoft/PowerToys/pull/48717 and
https://github.com/microsoft/PowerToys/pull/48467

It adds the ui-tests-migration skill which should be used to migrate the
old UITest module by module to use new .Next UI framework.

As an example, the screen ruller tests was ported here.

---------

Co-authored-by: Boliang Zhang (from Dev Box) <bozhang@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-09 11:02:54 +08:00

52 lines
1.9 KiB
PowerShell

param(
[Parameter()]
[ValidateSet("Machine", "PerUser")]
[string]$InstallMode = "Machine",
# Folder that contains the PowerToys installer. Defaults to the build staging directory used
# by the official-build path (installer downloaded via DownloadPipelineArtifact@2). The
# full-build (buildNow) path passes the downloaded pipeline-artifact folder instead, since
# the installer ships inside that build's own artifact.
[Parameter()]
[string]$ArtifactPath = $ENV:BUILD_ARTIFACTSTAGINGDIRECTORY
)
$ProgressPreference = 'SilentlyContinue'
if (-not $ArtifactPath) {
throw "Installer path not provided. Pass -ArtifactPath or set BUILD_ARTIFACTSTAGINGDIRECTORY."
}
# Since we only download PowerToysSetup-*.exe files, we can directly find it
$Installer = Get-ChildItem -Path $ArtifactPath -Filter 'PowerToys*.exe' | Select-Object -First 1
if (-not $Installer) {
throw "PowerToys installer not found"
}
Write-Host "Installing PowerToys: $($Installer.Name)"
# Install PowerToys
$Process = Start-Process -Wait -FilePath $Installer.FullName -ArgumentList "/passive", "/norestart" -PassThru -NoNewWindow
if ($Process.ExitCode -eq 0 -or $Process.ExitCode -eq 3010) {
Write-Host "✅ PowerToys installation completed successfully"
} else {
throw "PowerToys installation failed with exit code: $($Process.ExitCode)"
}
# Verify installation
if ($InstallMode -eq "PerUser") {
if (Test-Path "${env:LOCALAPPDATA}\PowerToys\PowerToys.exe") {
Write-Host "✅ PowerToys verified at: ${env:LOCALAPPDATA}\PowerToys\PowerToys.exe"
} else {
throw "PowerToys installation verification failed"
}
} else {
if (Test-Path "${env:ProgramFiles}\PowerToys\PowerToys.exe") {
Write-Host "✅ PowerToys verified at: ${env:ProgramFiles}\PowerToys\PowerToys.exe"
} else {
throw "PowerToys installation verification failed"
}
}