Get-InstalledPSResource

Zwraca moduły i skrypty zainstalowane na maszynie za pośrednictwem modułu PowerShellGet.

Składnia

Get-InstalledPSResource
   [[-Name] <String[]>]
   [-Version <String>]
   [-Path <String>]
   [-Scope <ScopeType>]
   [<CommonParameters>]

Opis

To polecenie cmdlet wyszukuje ścieżki instalacji modułu i skryptu oraz zwraca obiekty PSResourceInfo opisujące każdy znaleziony element zasobu. Jest to odpowiednik połączonych danych wyjściowych poleceń cmdlet i Get-InstalledScript z modułu Get-InstalledModulePowerShellGet w wersji 2.

Przykłady

Przykład 1

W tym przykładzie są zwracane wszystkie wersje modułów i skryptów zainstalowanych na maszynie.

Get-InstalledPSResource

Przykład 2

Ten przykład zwraca wszystkie wersje modułu Az zainstalowanego przy użyciu modułu PowerShellGet.

Get-InstalledPSResource Az

Przykład 3

Ten przykład zwraca wszystkie wersje modułu Az zainstalowanego w bieżącym katalogu.

Get-InstalledPSResource Az -Path .

Przykład 4

Ten przykład zwraca określoną wersję modułu Az, jeśli jest on zainstalowany w systemie.

Get-InstalledPSResource Az -Version 9.4.0

Przykład 5

Ten przykład zwraca wszystkie zainstalowane wersje modułu Az w określonym zakresie wersji.

Get-InstalledPSResource Az -Version "(1.0.0, 3.0.0)"

Przykład 6

W tym przykładzie jest zwracana określona wersja zapoznawcza modułu PowerShellGet , jeśli jest zainstalowana w systemie.

Get-InstalledPSResource PowerShellGet -Version 3.0.19-beta19

Name          Version Prerelease Repository Description
----          ------- ---------- ---------- -----------
PowerShellGet 3.0.19  beta19     PSGallery  PowerShell module with commands for discovering, installing, updating and p…

Przykład 6

W poprzednim przykładzie pokazano, że program PowerShellGet w wersji 3.0.14-beta14 został zainstalowany w systemie. W tym przykładzie pokazano, że musisz podać pełną wersję, w tym etykietę Wersja wstępna , aby zidentyfikować zainstalowany moduł według wersji.

Get-InstalledPSResource PowerShellGet -Version 3.0.19

W tym poleceniu nie ma żadnych danych wyjściowych.

Przykład 7

W tym przykładzie widać, że w systemie zainstalowano cztery wersje elementu PSReadLine . Drugie polecenie wyszukuje zakres wersji między 2.2.0 i 2.3.0.

Get-InstalledPSResource PSReadLine

Name       Version Prerelease Repository Description
----       ------- ---------- ---------- -----------
PSReadLine 2.3.0   beta0      PSGallery  Great command line editing in the PowerShell console host
PSReadLine 2.2.6              PSGallery  Great command line editing in the PowerShell console host
PSReadLine 2.2.5              PSGallery  Great command line editing in the PowerShell console host
PSReadLine 2.2.2              PSGallery  Great command line editing in the PowerShell console host
PSReadLine 2.2.0   beta4      PSGallery  Great command line editing in the PowerShell console host

Get-InstalledPSResource PSReadLine -Version '[2.2.0, 2.3.0]'

Name       Version Prerelease Repository Description
----       ------- ---------- ---------- -----------
PSReadLine 2.3.0   beta0      PSGallery  Great command line editing in the PowerShell console host
PSReadLine 2.2.6              PSGallery  Great command line editing in the PowerShell console host
PSReadLine 2.2.5              PSGallery  Great command line editing in the PowerShell console host
PSReadLine 2.2.2              PSGallery  Great command line editing in the PowerShell console host

Zgodnie z regułami wersji NuGet wersja wstępna jest mniejsza niż stabilna wersja, więc 2.2.0-beta4 jest mniejsza niż 2.2.0 wersja w określonym zakresie wersji.

Parametry

-Name

Nazwa zasobu do znalezienia. Symbole wieloznaczne są obsługiwane, ale program NuGet akceptuje * tylko znak. Pakiet NuGet nie obsługuje wyszukiwania wieloznacznych repozytoriów lokalnych (opartych na plikach).

Type:String[]
Position:0
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:True

-Path

Określa ścieżkę do wyszukiwania.

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

-Scope

Określa zakres zasobu.

Type:Microsoft.PowerShell.PSResourceGet.UtilClasses.ScopeType
Accepted values:CurrentUser, AllUsers
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Version

Określa wersję zasobu do zwrócenia. Wartość może być dokładną wersją lub zakresem wersji przy użyciu składni przechowywania wersji NuGet.

Aby uzyskać więcej informacji na temat zakresów wersji NuGet, zobacz Przechowywanie wersji pakietów.

Moduł PowerShellGet obsługuje wszystkie, ale minimalną wersję inkluzywną wymienioną w dokumentacji zakresu wersji NuGet. Użycie 1.0.0.0 jako wersji nie daje wersji 1.0.0.0.0 i nowszych (minimalny zakres inkluzywny). Zamiast tego wartość jest uważana za wymaganą wersję. Aby wyszukać minimalny zakres inkluzywny, użyj go [1.0.0.0, ] jako zakresu wersji.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:True

Dane wejściowe

String[]

Dane wyjściowe

Microsoft.PowerShell.PSResourceGet.UtilClasses.PSResourceInfo

Uwagi

Moduł definiuje Get-PSResource alias dla Get-InstalledPSResourceelementu .