Sample_AddRemoveSource.ps1 (684B)
1 <# 2 .SYNOPSIS 3 Example for 'Get-WinGetSource', 'Add-WinGetSource', 'Remove-WinGetSource', and 'Reset-WinGetSource' cmdlet. 4 Cmdlets to allow you to manage sources for the Windows Package Manager. 5 #> 6 7 # TODO: Replace parameter with actual module name from PSGallery once module is released. 8 Param ( 9 [Parameter(Mandatory)] 10 $ModulePath 11 ) 12 13 Import-Module -Name $ModulePath 14 15 # List current sources. 16 Get-WinGetSource 17 18 # Add REST source 19 Add-WinGetSource -Name 'Contoso' -Argument 'https://www.contoso.com/cache' -Type 'Microsoft.Rest' 20 21 # Remove source by name 22 Remove-WinGetSource -Name 'Contoso' 23 24 # Reset to default sources 25 Reset-WinGetSource