src/PowerShell/Help/Microsoft.WinGet.Client/Assert-WinGetPackageManager.md
Verifies that WinGet is installed properly.
Assert-WinGetPackageManager [-Version <String>] [<CommonParameters>]
Assert-WinGetPackageManager [-Latest] [-IncludePrerelease] [<CommonParameters>]
Verifies that WinGet is installed properly.
[!NOTE] The cmdlet doesn't ensure that the latest version of WinGet is installed. It just verifies that the installed version of Winget is supported by installed version of the Microsoft.WinGet.Client module.
Assert-WinGetPackageManager
If the current version of WinGet is installed correctly, the command returns without error.
Assert-WinGetPackageManager -Latest
If the latest version of WinGet is compatible with the installed Microsoft.WinGet.Client module, the command returns without error.
Assert-WinGetPackageManager -IncludePreRelease
If the prerelease version of WinGet is compatible with the installed Microsoft.WinGet.Client module, the command returns without error.
Assert-WinGetPackageManager -Version v1.8.1911
If the specified version of WinGet is compatible with the installed Microsoft.WinGet.Client module, the command returns without error.
Include preview versions of WinGet.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: IntegrityLatestSet
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
Verify that the latest version of WinGet is compatible with the installed version of the Microsoft.WinGet.Client module.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: IntegrityLatestSet
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
Verify that a specific version of WinGet is installed correctly.
Type: System.String
Parameter Sets: IntegrityVersionSet
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
When using the -Latest or -Version parameters, this cmdlet makes GitHub API requests to query
release information. Unauthenticated requests are subject to
GitHub API rate limits,
which can cause failures in CI/CD pipelines. If the GH_TOKEN or GITHUB_TOKEN environment
variable is set, the cmdlet automatically uses it to authenticate requests, which significantly
increases the rate limit.
GH_TOKEN takes precedence over GITHUB_TOKEN, matching
GitHub CLI behavior. In GitHub Actions,
you can make GITHUB_TOKEN available to the cmdlet by mapping it as an environment variable in
your workflow step (e.g., env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}).
Use -Verbose to see which token source is being used.