| external help file | Microsoft.PowerShell.PackageManagement.dll-Help.xml |
|---|---|
| Locale | en-US |
| Module Name | PackageManagement |
| ms.date | 12/12/2022 |
| online version | https://learn.microsoft.com/powershell/module/packagemanagement/get-packagesource?view=powershellget-1.x&WT.mc_id=ps-gethelp |
| schema | 2.0.0 |
| title | Get-PackageSource |
Gets a list of package sources that are registered for a package provider.
Get-PackageSource [[-Name] <String>] [-Location <String>] [-Force] [-ForceBootstrap]
[-ProviderName <String[]>] [-ConfigFile <String>] [-SkipValidate] [<CommonParameters>]
Get-PackageSource [[-Name] <String>] [-Location <String>] [-Force] [-ForceBootstrap]
[-ProviderName <String[]>] [-PackageManagementProvider <String>] [-PublishLocation <String>]
[-ScriptSourceLocation <String>] [-ScriptPublishLocation <String>] [<CommonParameters>]
The Get-PackageSource cmdlet gets a list of package sources that are registered with
PackageManagement on the local computer. If you specify a package provider, Get-PackageSource
gets only those sources that are associated with the specified provider. Otherwise, the command
returns all package sources that are registered with PackageManagement.
The Get-PackageSource cmdlet gets all package sources that are registered with
PackageManagement on the local computer.
Get-PackageSourceName ProviderName IsTrusted Location
---- ------------ --------- --------
LocalPackages NuGet False C:\LocalPkg\
MyNuget NuGet False https://www.nuget.org/api/v2
PSGallery PowerShellGet False https://www.powershellgallery.com/api/v2
This command gets package sources that are registered for a specific provider.
Get-PackageSource -ProviderName NuGetName ProviderName IsTrusted Location
---- ------------ --------- --------
LocalPackages NuGet False C:\LocalPkg\
MyNuget NuGet False https://www.nuget.org/api/v2
Get-PackageSource uses the ProviderName parameter to get package sources that are registered
for the NuGet provider.
This command uses a package provider to get package sources.
Get-PackageProvider -Name NuGet | Get-PackageSourceName ProviderName IsTrusted Location
---- ------------ --------- --------
LocalPackages NuGet False C:\LocalPkg\
MyNuget NuGet False https://www.nuget.org/api/v2
Get-PackageProvider uses the Name parameter specify the provider name, NuGet. The object
is sent down the pipeline to Get-PackageSource.
Specifies a configuration file.
Type: System.String
Parameter Sets: NuGet
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseForces the command to run without asking for user confirmation.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseIndicates that this cmdlet forces PackageManagement to automatically install a package provider.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies the location of a package management source or repository.
Type: System.String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies the name of a package management source.
Type: System.String
Parameter Sets: (All)
Aliases:
Required: False
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies a package management provider.
Type: System.String
Parameter Sets: PowerShellGet
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies one or more package provider names. Separate multiple package provider names with commas.
Use Get-PackageProvider to get a list of available package providers.
Type: System.String[]
Parameter Sets: (All)
Aliases: Provider
Accepted values: Bootstrap, NuGet, PowerShellGet
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: FalseSpecifies the publish location for the package source.
Type: System.String
Parameter Sets: PowerShellGet
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies the script publish location.
Type: System.String
Parameter Sets: PowerShellGet
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies the script source location.
Type: System.String
Parameter Sets: PowerShellGet
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSwitch that skips validating the credentials of a package source.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: NuGet
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
This cmdlet returns a PackageSource object for each registered package source that fulfills the criteria set by the parameters. By default, it returns every registered package source.
Important
As of April 2020, the PowerShell Gallery no longer supports Transport Layer Security (TLS) versions 1.0 and 1.1. If you are not using TLS 1.2 or higher, you will receive an error when trying to access the PowerShell Gallery. Use the following command to ensure you are using TLS 1.2:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
For more information, see the announcement in the PowerShell blog.