Add iTunes Windows FMA - #50031
Closed
kitzy wants to merge 1 commit into
Closed
Conversation
iTunes is a WiX bundle chaining four MSIs, so removal outlives the uninstaller process. The previous script waited a fixed 120s for msiexec and then returned while the removal was still in flight, leaving iTunes registered and failing the validator's post-uninstall check. Wait on the uninstaller itself, then poll the ARP entry until it actually clears. The install script gets the same treatment so an uninstall cannot race an install that is still applying its chained MSIs.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to add (or effectively update) iTunes as a Windows Fleet-maintained app (FMA), primarily by improving the install/uninstall PowerShell scripts to handle WiX/MSI chaining and avoid fixed sleeps by waiting for real completion signals (process exit + ARP polling).
Changes:
- Added a new Windows iTunes maintained-app entry to
apps.json. - Added a new maintained-app output manifest under
outputs/apple-itunes/windows.jsonwith embedded install/uninstall scripts. - Added new Winget input (
apple-itunes.json) and corresponding install/uninstall scripts (apple_itunes_*).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| ee/maintained-apps/outputs/apps.json | Adds a new iTunes catalog entry (currently introduces a duplicate/conflicting iTunes entry). |
| ee/maintained-apps/outputs/apple-itunes/windows.json | New generated output manifest + embedded scripts for the new slug. |
| ee/maintained-apps/inputs/winget/scripts/apple_itunes_uninstall.ps1 | New uninstall script that resolves MSI product code and polls ARP until cleared. |
| ee/maintained-apps/inputs/winget/scripts/apple_itunes_install.ps1 | New install script that polls but currently requires installer process exit before success. |
| ee/maintained-apps/inputs/winget/apple-itunes.json | New Winget input definition for a new slug/package mapping. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+42
to
+53
| $elapsed = 0 | ||
| while (-not $process.HasExited -and ($elapsed -lt $installTimeoutSeconds)) { | ||
| Start-Sleep -Seconds $pollSeconds | ||
| $elapsed += $pollSeconds | ||
| Write-Host "Installing... ($elapsed seconds, registered: $(Test-ITunesRegistered))" | ||
| } | ||
|
|
||
| if (-not $process.HasExited) { | ||
| Write-Host "Installer did not finish within ${installTimeoutSeconds}s." | ||
| Stop-Process -Id $process.Id -Force -ErrorAction SilentlyContinue | ||
| Exit 1 | ||
| } |
Comment on lines
+725
to
+731
| { | ||
| "name": "iTunes", | ||
| "slug": "apple-itunes/windows", | ||
| "platform": "windows", | ||
| "unique_identifier": "iTunes", | ||
| "description": "iTunes is a media player and library for music, video, and podcasts that also syncs and backs up iPhone, iPad, and iPod devices." | ||
| }, |
Comment on lines
+1
to
+8
| { | ||
| "name": "iTunes", | ||
| "slug": "apple-itunes/windows", | ||
| "package_identifier": "Apple.iTunes", | ||
| "unique_identifier": "iTunes", | ||
| "program_publisher": "Apple Inc.", | ||
| "install_script_path": "ee/maintained-apps/inputs/winget/scripts/apple_itunes_install.ps1", | ||
| "uninstall_script_path": "ee/maintained-apps/inputs/winget/scripts/apple_itunes_uninstall.ps1", |
Comment on lines
+1
to
+12
| { | ||
| "versions": [ | ||
| { | ||
| "version": "12.13.10.3", | ||
| "queries": { | ||
| "exists": "SELECT 1 FROM programs WHERE name = 'iTunes' AND publisher = 'Apple Inc.';", | ||
| "patched": "SELECT 1 WHERE NOT EXISTS (SELECT 1 FROM programs WHERE name = 'iTunes' AND publisher = 'Apple Inc.' AND version_compare(version, '12.13.10.3') < 0);" | ||
| }, | ||
| "installer_url": "https://secure-appldnld.apple.com/itunes12/047-76416-20260302-fefe4356-211d-4da1-8bc4-058eb36ea803/iTunes64Setup.exe", | ||
| "install_script_ref": "7170f396", | ||
| "uninstall_script_ref": "42f68f5e", | ||
| "sha256": "cea2a74cae3f061eadc11358eeaae9b40cfdea9ec1ee037b47da54a64219e182", |
Member
Author
|
Closing since we already have an FMA for iTunes |
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issue: #50020
What this does
Adds iTunes as a Windows Fleet-maintained app. One of the 11 apps split out of #48501 that failed the FMA validator; #50016 shipped the 6 that passed.
Why it was failing
Install and detection were already fine — the validator installed it in ~28s and osquery found
iTunes12.13.10.3 atC:\Program Files\iTunes\. Uninstall was the failure:The two-minute gap is the tell: the old script ran the uninstall, then waited a fixed 120 seconds for
msiexecand returned regardless. iTunes is a WiX bundle chaining four MSIs (Apple Application Support x86 and x64, Apple Mobile Device Support, Bonjour, and iTunes), so the removal was still in flight when the script exited and reported success.The fix stops waiting for a fixed interval and waits for the actual outcome:
iTunes,iTunesHelper,AppleMobileDeviceServiceandmDNSResponderfirst — they hold file locks, andStart-Process -Waitwaits for descendants as well as the process itself, so a resident helper would block the script.msiexec /x <code> /quiet /norestartdirectly. The registryUninstallStringcarries no quiet switch, which raises an invisible dialog in session 0 and silently does nothing — the same problem fixed for Google Earth Pro in Add Google Earth Pro as a Windows FMA #50022. If Apple ever registers the burn bundle instead of the MSI, it falls back to running that with/uninstall /quiet /norestart.The install script gets the same treatment — it waits for the ARP entry and for
msiexecto drain — so an uninstall can't race an install that's still applying its chained MSIs.Notes
/quiet /norestartis the documentedSilentswitch set from the winget manifest.DisplayName(iTunes), so exact name matching. PublisherApple Inc..iTunesproduct, which is what the catalog entry and the exists query represent. Apple's companion packages (Apple Application Support, Bonjour, Apple Mobile Device Support) are separate ARP entries shared with other Apple software and are deliberately left in place — same as Windows' own "uninstall iTunes" behavior.itunescatalog icon and website asset — no new icon needed.Checklist for submitter
SELECT *is avoided, SQL injection is prevented (using placeholders for values in statements), JS inline code is prevented especially for url redirects, and untrusted data interpolated into shell scripts/commands is validated against shell metacharacters.Testing
All checks passed)apps.jsonis valid JSON with a description filled in.