fleet/ee/maintained-apps/inputs/winget/scripts/slack_install.ps1
Allen Houchins 6c82a29709
Support for Slack MSIX installer and scripts in Fleet-maintained app catalog (#43060)
This pull request transitions the Windows Slack package from an
MSI-based installer to an MSIX-based installer, updating the ingestion
logic, install/uninstall scripts, and package metadata to support the
new format. It also updates the Slack version and the associated
detection queries to match the MSIX deployment. The most important
changes are:

**Slack Package Migration to MSIX:**

* Changed the Slack package definition in `slack.json` to use
`installer_type: msix`, set the installer scope to `user`, and
referenced new install/uninstall scripts tailored for MSIX.
* Updated the output package version to `4.49.81`, switched the
installer URL to the MSIX package, and adjusted detection queries to
match the new MSIX app name and publisher.

**Installer/Uninstaller Script Updates:**

* Added a new PowerShell install script (`slack_install.ps1`) that
provisions the MSIX package machine-wide and registers it for the
current user to improve inventory visibility.
* Added a new PowerShell uninstall script (`slack_uninstall.ps1`) that
removes both provisioned and per-user MSIX installations, with a timeout
and error handling.

**Ingestion Logic Enhancements:**

* Updated the `wingetIngester` logic to handle MSIX installers by
populating `ProductCode` from `PackageFamilyName` when needed, and to
extract only the prefix for MSI product codes.
* Extended the `installer` struct to include a `PackageFamilyName` field
for MSIX support.
2026-04-06 20:46:51 -05:00

29 lines
954 B
PowerShell

# MSIX: provision machine-wide, then register for the current user when possible so inventory
# (osquery programs) and FMA validation are more likely to see the app immediately.
try {
$msixPath = $env:INSTALLER_PATH
if (-not $msixPath) {
throw "INSTALLER_PATH is not set"
}
Write-Host "Provisioning MSIX for all users..."
$result = Add-AppxProvisionedPackage -Online -PackagePath $msixPath -SkipLicense -ErrorAction Stop
$result | Out-String | Write-Host
# Per-user registration helps ARP/programs visibility on hosts where validation runs with a user session.
try {
Write-Host "Registering MSIX for current user (best-effort)..."
Add-AppxPackage -Path $msixPath -ErrorAction Stop | Out-String | Write-Host
} catch {
Write-Host "Add-AppxPackage skipped or failed (provisioned install may still be valid): $($_.Exception.Message)"
}
Start-Sleep -Seconds 5
Exit 0
} catch {
Write-Host "Error: $_"
Exit 1
}