Fix versionless install/uninstall scripts to include full winget args#251
Merged
svrooij merged 3 commits intoJun 16, 2026
Merged
Conversation
When using -version latest with -PackageScript, the generated scripts were missing --source, --silent, --accept-package-agreements, --accept-source-agreements and --scope. Replace the minimal hardcoded command builders with WingetHelper.GetInstallArgumentsForPackage and GetUninstallArgumentsForPackage, which already produce the correct full argument list. Remove the now-unused GetWingetInstallCmd and GetWingetUninstallCmd helpers from IntuneManagerConstants. Fixes svrooij#240
Add a parameterised test covering InstallerContext User, System and Unknown to assert that the generated install.ps1 and uninstall.ps1 for versionless packages contain --source, --silent, --accept-package-agreements, --accept-source-agreements and the correct --scope value (or none when context is Unknown).
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.
Fixes #240
When running
New-WtWingetPackage -version latest -PackageScript, the generated scripts were missing most of the winget arguments:The versionless path had its own hardcoded command builders that never got the
--source,--silent,--accept-*and--scopetreatment. The non-versionless path was already usingWingetHelper.GetInstallArgumentsForPackagewhich does all of that correctly so the fix is just making both paths use the same thing.Removed
GetWingetInstallCmdandGetWingetUninstallCmdfromIntuneManagerConstantssince nothing else used them.Added tests for
InstallerContext.User,SystemandUnknownto make sure the right flags (including--scope) end up in the generated scripts.