fleet/ee/maintained-apps/inputs/winget/scripts/spotify_install.ps1
Allen Houchins 54f239826e
Add Spotify as a Windows FMA (#37630)
This pull request adds full support for managing the installation and
uninstallation of Spotify on Windows via winget in the maintained apps
system. It introduces new configuration and script files, updates output
manifests, and ensures that both install and uninstall processes are
handled silently and robustly.

**Spotify Windows app integration:**

* Added a new manifest `spotify.json` in
`ee/maintained-apps/inputs/winget` to define Spotify's winget package
details, including references to custom install and uninstall scripts.
* Updated `ee/maintained-apps/outputs/apps.json` to register the Spotify
Windows app, enabling it to be discovered and managed by the platform.
* Added a new output manifest
`ee/maintained-apps/outputs/spotify/windows.json` specifying the
installer URL, version, install/uninstall script references, and
detection query for Spotify.

**Installation and uninstallation scripting:**

* Introduced a PowerShell install script `spotify_install.ps1` that
performs a silent installation of Spotify, handling exit codes and
errors gracefully.
* Added a PowerShell uninstall script `spotify_uninstall.ps1` that
locates Spotify's uninstaller via the registry, kills running processes,
and executes the uninstall silently, preserving existing arguments and
handling errors.
2025-12-22 22:19:39 -06:00

31 lines
748 B
PowerShell

# Learn more about .exe install scripts:
# http://fleetdm.com/learn-more-about/exe-install-scripts
$exeFilePath = "${env:INSTALLER_PATH}"
try {
# Add arguments to install silently
# Spotify uses /silent /skip-app-launch for silent installation
# Note: elevationProhibited - do not use -Verb RunAs
$processOptions = @{
FilePath = "$exeFilePath"
ArgumentList = "/silent", "/skip-app-launch"
PassThru = $true
Wait = $true
}
# Start process and track exit code
# Exit code 26 indicates packageInUse, which is expected in some scenarios
$process = Start-Process @processOptions
$exitCode = $process.ExitCode
# Prints the exit code
Write-Host "Install exit code: $exitCode"
Exit $exitCode
} catch {
Write-Host "Error: $_"
Exit 1
}