共用方式為


Find-Module

在符合指定準則的存放庫中尋找模組。

語法

All

Find-Module
    [[-Name] <string[]>]
    [-MinimumVersion <string>]
    [-MaximumVersion <string>]
    [-RequiredVersion <string>]
    [-AllVersions]
    [-IncludeDependencies]
    [-Filter <string>]
    [-Tag <string[]>]
    [-Includes <string[]>]
    [-DscResource <string[]>]
    [-RoleCapability <string[]>]
    [-Command <string[]>]
    [-Proxy <uri>]
    [-ProxyCredential <pscredential>]
    [-Repository <string[]>]
    [-Credential <pscredential>]
    [-AllowPrerelease]
    [<CommonParameters>]

Description

Cmdlet 會在 Find-Module 符合指定準則的存放庫中尋找模組。 Find-Module 會針對找到的每個模組傳回 PSRepositoryItemInfo 物件。 物件可以向下傳送至 Cmdlet,例如 Install-Module

這是 Find-PSResource 中 Cmdlet 的 Proxy Cmdlet。 如需詳細資訊,請參閱 Find-PSResource

範例

範例 1:依名稱尋找模組

此範例會在預設存放庫中尋找模組。

Find-Module -Name PowerShellGet
Version   Name              Repository           Description
-------   ----              ----------           -----------
2.1.0     PowerShellGet     PSGallery            PowerShell module with commands for discovering...

Cmdlet Find-Module 會使用 Name 參數來指定 PowerShellGet 模組。

範例 2:尋找具有類似名稱的模組

此範例使用星號 (*) 通配符來尋找具有類似名稱的模組。

Find-Module -Name PowerShell*
Version   Name                            Repository    Description
-------   ----                            ----------    -----------
0.4.0     powershell-yaml                 PSGallery     Powershell module for serializing and...
2.1.0     PowerShellGet                   PSGallery     PowerShell module with commands for...
1.9       Powershell.Helper.Extension     PSGallery     # Powershell.Helper.Extension...
3.1       PowerShellHumanizer             PSGallery     PowerShell Humanizer wraps Humanizer...
4.0       PowerShellISEModule             PSGallery     a module that adds capability to the ISE

Cmdlet Find-Module 會使用 Name 參數搭配星號 (*) 通配符來尋找包含 PowerShell 的所有模組。

範例 3:依最低版本尋找模組

此範例會搜尋模組的最低版本。 如果存放庫包含較新版本的模組,則會傳回較新版本。

Find-Module -Name PowerShellGet -MinimumVersion 1.6.5
Version   Name             Repository     Description
-------   ----             ----------     -----------
2.1.0     PowerShellGet    PSGallery      PowerShell module with commands for discovering...

Cmdlet Find-Module 會使用 Name 參數來指定 PowerShellGet 模組。 MinimumVersion 指定 1.6.5 版。 Find-Module 會傳回 PowerShellGet 2.1.0 版,因為它超過最低版本,而且是最新的版本。

範例 4:依特定版本尋找模組

此範例示範如何安裝模組的特定發行前版本。 發行前版本的格式為 <version_number>-<prerelease_label>

Find-Module PSReadLine -AllowPrerelease -RequiredVersion 2.2.4-beta1
Version        Name             Repository       Description
-------        ----             ----------       -----------
2.2.4-beta1    PSReadLine       PSGallery        Great command line editing in the PowerS…

範例 5:在特定存放庫中尋找模組

此範例會使用 Repository 參數來尋找特定存放庫中的模組。

Find-Module -Name PowerShellGet -Repository PSGallery
Version   Name             Repository     Description
-------   ----             ----------     -----------
2.1.0     PowerShellGet    PSGallery      PowerShell module with commands for discovering...

Cmdlet Find-Module 會使用 Name 參數來指定 PowerShellGet 模組。 Repository 參數會指定搜尋 PSGallery 存放庫。

範例 6:在多個存放庫中尋找模組

這個範例會使用 Register-PSRepository 來指定存放庫。 Find-Module 會使用存放庫來搜尋模組。

Register-PSRepository -Name MySource -SourceLocation https://www.myget.org/F/powershellgetdemo/
Find-Module -Name Contoso* -Repository PSGallery, MySource
Repository    Version   Name             Description
----------    -------   ----             -----------
PSGallery     2.0.0.0   ContosoServer    Cmdlets and DSC resources for managing Contoso Server...
MySource      1.2.0.0   ContosoClient    Cmdlets and DSC resources for managing Contoso Client...

Cmdlet Register-PSRepository 會註冊新的存放庫。 Name 參數會指派 MySource 名稱。 SourceLocation 參數會指定存放庫的位址。

Cmdlet Find-Module 使用 Name 參數搭配星號 (*) 通配符來指定 Contoso 模組。 Repository 參數會指定搜尋兩個存放庫 PSGalleryMySource

範例 7:尋找包含 DSC 資源的模組

此命令會傳回包含 DSC 資源的模組。 Includes 參數有四個預先定義的功能,可用來搜尋存放庫。 使用 Tab 鍵完成來顯示 Includes 參數支援的四項功能。

Find-Module -Repository PSGallery -Includes DscResource
Version     Name                            Repository    Description
-------     ----                            ----------    -----------
2.7.0       Carbon                          PSGallery     Carbon is a PowerShell module...
8.5.0.0     xPSDesiredStateConfiguration    PSGallery     The xPSDesiredStateConfiguration module...
1.3.1       PackageManagement               PSGallery     PackageManagement (a.k.a. OneGet) is...
2.7.0.0     xWindowsUpdate                  PSGallery     Module with DSC Resources...
3.2.0.0     xCertificate                    PSGallery     This module includes DSC resources...
3.1.0.0     xPowerShellExecutionPolicy      PSGallery     This DSC resource can change the user...

Cmdlet Find-Module 會使用 Repository 參數來搜尋 存放庫 PSGalleryIncludes 參數會指定 DscResource,這是參數可以在存放庫中搜尋的功能。

範例 8:尋找具有篩選條件的模組

在此範例中,若要尋找模組,會使用篩選來搜尋存放庫。

針對以 NuGet 為基礎的存放庫, Filter 參數會搜尋自變數的名稱、描述和標籤。

Find-Module -Filter AppDomain
Version    Name              Repository           Description
-------    ----              ----------           -----------
1.0.0.0  AppDomainConfig     PSGallery            Manipulate AppDomain configuration...
1.1.0    ClassExplorer       PSGallery            Quickly search the AppDomain for classes...

Cmdlet Find-Module 會使用 Filter 參數來搜尋 AppDomain 的存放庫。

範例 9:依標記尋找模組

此範例示範如何依標記尋找模組。 值 CrescendoBuilt 是標記,會自動新增至使用 Microsoft.PowerShell.Crescendo 模組建立的模組。

Find-Module -Tag CrescendoBuilt
Version Name            Repository Description
------- ----            ---------- -----------
0.1.0   Foil            PSGallery  A PowerShell Crescendo wrapper for Chocolatey
0.3.1   Cobalt          PSGallery  A PowerShell Crescendo wrapper for WinGet
1.1.0   SysInternals    PSGallery  PowerShell cmdlets for SysInternal tools
0.0.4   Croze           PSGallery  A PowerShell Crescendo wrapper for Homebrew
0.0.2   AptPackage      PSGallery  PowerShell Crescendo-generated Module to query APT-Package Information
1.0.1   RoboCopy        PSGallery  PowerShell cmdlet for the official RoboCopy.exe
1.0.2   TShark          PSGallery  PowerShell cmdlet for tshark.exe
1.0.0   SpeedTestCLI    PSGallery  PowerShell cmdlets speedtest-cli
1.0.0   SpeedTest-CLI   PSGallery  PowerShell cmdlets for Internet Speed Test
1.0.2   Image2Text      PSGallery  PowerShell Images into ASCII art
0.1.1   Quser.Crescendo PSGallery  This module displays session information of users logged onto a local or remote m...
1.0.2   Takeown         PSGallery  Crescendo Powershell wrapper of takeown.exe

參數

-AllowPrerelease

在標示為發行前版本的結果模組中包含 。

Proxy Cmdlet 會將此參數對應至 的Find-PSResource參數。

參數屬性

類型:SwitchParameter
預設值:None
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-AllVersions

指定在結果中包含模組的所有版本。 您無法搭配 MinimumVersionMaximumVersionRequiredVersion 參數使用 AllVersions 參數。

Proxy Cmdlet 會先將此參數 -Version * 轉換成 ,再呼叫 Find-PSResource

參數屬性

類型:SwitchParameter
預設值:None
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-Command

Proxy Cmdlet 會忽略此參數,因為 NameParameterSetFind-PSResource不支援此參數。

參數屬性

類型:

String[]

預設值:None
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-Credential

指定有權為指定的套件提供者或來源安裝模組的用戶帳戶。

參數屬性

類型:PSCredential
預設值:None
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:True
來自剩餘引數的值:False

-DscResource

Proxy Cmdlet 會忽略此參數,因為 NameParameterSetFind-PSResource不支援此參數。

參數屬性

類型:

String[]

預設值:None
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-Filter

Proxy Cmdlet 會忽略此參數,因為 NameParameterSetFind-PSResource不支援此參數。

參數屬性

類型:String
預設值:None
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-IncludeDependencies

表示這項作業包含所有相依於 Name 參數中所指定模組的模組。

參數屬性

類型:SwitchParameter
預設值:None
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-Includes

Proxy Cmdlet 會忽略此參數,因為 NameParameterSetFind-PSResource不支援此參數。

參數屬性

類型:

String[]

預設值:None
接受的值:DscResource, Cmdlet, Function, RoleCapability
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-MaximumVersion

Proxy Cmdlet 會使用此參數的值來建立 NuGet 版本搜尋字串,以搭配 的 Version 參數 Find-PSResource使用。

參數屬性

類型:String
預設值:None
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:True
來自剩餘引數的值:False

-MinimumVersion

Proxy Cmdlet 會使用此參數的值來建立 NuGet 版本搜尋字串,以搭配 的 Version 參數 Find-PSResource使用。

參數屬性

類型:String
預設值:None
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:True
來自剩餘引數的值:False

-Name

指定要在存放庫中搜尋的模組名稱。 接受以逗號分隔的模組名稱清單。 接受通配符。

參數屬性

類型:

String[]

預設值:None
支援萬用字元:True
不要顯示:False

參數集

(All)
Position:0
必要:False
來自管線的值:False
來自管線按屬性名稱的值:True
來自剩餘引數的值:False

-Proxy

Proxy Cmdlet 會忽略此參數,因為 NameParameterSetFind-PSResource不支援此參數。

參數屬性

類型:Uri
預設值:None
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:True
來自剩餘引數的值:False

-ProxyCredential

Proxy Cmdlet 會忽略此參數,因為 NameParameterSetFind-PSResource不支援此參數。

參數屬性

類型:PSCredential
預設值:None
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:True
來自剩餘引數的值:False

-Repository

使用 Repository 參數指定要搜尋模組的存放庫。 註冊多個存放庫時使用。 接受以逗號分隔的存放庫清單。 若要註冊存放庫,請使用 Register-PSRepository。 若要顯示已註冊的存放庫,請使用 Get-PSRepository

參數屬性

類型:

String[]

預設值:None
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-RequiredVersion

Proxy Cmdlet 會使用此參數的值來建立 NuGet 版本搜尋字串,以搭配 的 Version 參數 Find-PSResource使用。

參數屬性

類型:String
預設值:None
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:True
來自剩餘引數的值:False

-RoleCapability

Proxy Cmdlet 會忽略此參數,因為 NameParameterSetFind-PSResource不支援此參數。

參數屬性

類型:

String[]

預設值:None
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-Tag

指定一組標記的陣列。 範例卷標包括 DesiredStateConfigurationDSC、DSCResourceKitPSModule

參數屬性

類型:

String[]

預設值:None
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

CommonParameters

此 Cmdlet 支援一般參數:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 如需詳細資訊,請參閱 about_CommonParameters

輸入

String

String

Uri

PSCredential

輸出

PSRepositoryItemInfo

Find-Module 會建立可將管線向下傳送至 Cmdlet 的 PSRepositoryItemInfo 物件,例如 Install-Module

備註

PowerShell 包含下列 Find-Module的別名:

  • 所有平臺:
    • fimo

PowerShell 資源庫不再支援傳輸層安全性 (TLS) 1.0 和 1.1 版。 您必須使用 TLS 1.2 或更高版本。 使用下列命令以確保您使用 TLS 1.2:

[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12