Get-PackageSource

Gets a list of package sources that are registered for a package provider.

Syntax

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>]

Description

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.

Examples

Example 1: Get all package sources

The Get-PackageSource cmdlet gets all package sources that are registered with PackageManagement on the local computer.

Get-PackageSource

Name                 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

Example 2: Get all package sources for a specific provider

This command gets package sources that are registered for a specific provider.

Get-PackageSource -ProviderName NuGet

Name                 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.

Example 3: Get sources from a package provider

This command uses a package provider to get package sources.

Get-PackageProvider -Name NuGet | Get-PackageSource

Name                 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.

Parameters

-ConfigFile

Specifies a configuration file.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Force

Forces the command to run without asking for user confirmation.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ForceBootstrap

Indicates that this cmdlet forces PackageManagement to automatically install a package provider.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Location

Specifies the location of a package management source or repository.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Name

Specifies the name of a package management source.

Type:String
Position:0
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-PackageManagementProvider

Specifies a package management provider.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ProviderName

Specifies 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:String[]
Aliases:Provider
Accepted values:Bootstrap, NuGet, PowerShellGet
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-PublishLocation

Specifies the publish location for the package source.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ScriptPublishLocation

Specifies the script publish location.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ScriptSourceLocation

Specifies the script source location.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-SkipValidate

Switch that skips validating the credentials of a package source.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Outputs

PackageSource[]

Specifies one or more package sources.