Udostępnij za pośrednictwem


Get-PackageProvider

Returns a list of package providers that are connected to Package Management.

Składnia

Default (Domyślna)

Get-PackageProvider
    [[-Name] <String[]>]
    [-ListAvailable]
    [-Force]
    [-ForceBootstrap]
    [<CommonParameters>]

Opis

The Get-PackageProvider cmdlet returns a list of package providers that are connected to Package Management. Examples of these providers include PSModule, NuGet, and Chocolatey. You can filter the results based on all or part of one or more provider names.

Przykłady

Example 1: Get all currently loaded package providers

Get-PackageProvider

This command gets a list of all the package providers that are currently loaded on the local computer.

Example 2: Get all available package providers

Get-PackageProvider -ListAvailable

This command gets a list of all package providers that are available on the local computer.

Example 3: Dynamically get a package provider

Get-PackageProvider -Name "Chocolatey" -ForceBootstrap

This command automatically installs the Chocolatey provider if your computer does not have the Chocolatey provider installed.

Parametry

-Force

Indicates that this cmdlet forces all other actions with this cmdlet that can be forced. In Get-PackageProvider, this means the Force parameter acts the same as the ForceBootstrap parameter.

Właściwości parametru

Typ:SwitchParameter
Domyślna wartość:None
Obsługuje symbole wieloznaczne:False
DontShow:False

Zestawy parametrów

(All)
Position:Named
Obowiązkowy:False
Wartość z potoku:False
Wartość z potoku według nazwy właściwości:False
Wartość z pozostałych argumentów:False

-ForceBootstrap

Indicates that this cmdlet forces Package Management to automatically install the package provider.

Właściwości parametru

Typ:SwitchParameter
Domyślna wartość:None
Obsługuje symbole wieloznaczne:False
DontShow:False

Zestawy parametrów

(All)
Position:Named
Obowiązkowy:False
Wartość z potoku:False
Wartość z potoku według nazwy właściwości:False
Wartość z pozostałych argumentów:False

-ListAvailable

Gets all installed providers. Get-PackageProvider gets provider in paths listed in the PSModulePath environment variable as well as the package provider assembly folders:

  • $env:ProgramFiles\PackageManagement\ProviderAssemblies
  • $env:LOCALAPPDATA\PackageManagement\ProviderAssemblies

Without this parameter, Get-PackageProvider gets only the providers loaded in the current session.

Właściwości parametru

Typ:SwitchParameter
Domyślna wartość:None
Obsługuje symbole wieloznaczne:False
DontShow:False

Zestawy parametrów

(All)
Position:Named
Obowiązkowy:False
Wartość z potoku:False
Wartość z potoku według nazwy właściwości:False
Wartość z pozostałych argumentów:False

-Name

Specifies one or more provider names, or partial provider names. Separate multiple provider names with commas. Valid values for this parameter include names of providers that you have installed with packages; PackageManagement ships with a set of default providers, including the PSModule and MSI providers.

Właściwości parametru

Typ:

String[]

Domyślna wartość:None
Obsługuje symbole wieloznaczne:False
DontShow:False

Zestawy parametrów

(All)
Position:0
Obowiązkowy:False
Wartość z potoku:False
Wartość z potoku według nazwy właściwości:False
Wartość z pozostałych argumentów:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Dane wyjściowe

Microsoft.PackageManagement.Implementation.PackageProvider

This cmdlet returns a PackageProvider object for each installed package provider matching the parameters. By default, it returns every installed package provider.

Uwagi

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.