次の方法で共有


Get-PSRepository

PowerShell リポジトリを取得します。

構文

Get-PSRepository
   [[-Name] <String[]>]
   [<CommonParameters>]

説明

Get-PSRepository コマンドレットは、現在のユーザーに登録されている PowerShell モジュール リポジトリを取得します。

例 1: すべてのモジュール リポジトリを取得する

PS C:\> Get-PSRepository
Name                                     SourceLocation                                     OneGetProvider       InstallationPolicy
----                                     --------------                                     --------------       ------------------
PSGallery                                http://go.micro...                                 NuGet                Untrusted
myNuGetSource                            https://myget.c...                                 NuGet                Trusted

このコマンドは、現在のユーザーに登録されているすべてのモジュール リポジトリを取得します。

例 2: 名前でモジュール リポジトリを取得する

PS C:\> Get-PSRepository -Name "*NuGet*"

このコマンドは、名前に NuGet を含むすべてのモジュール リポジトリを取得します。

例 3: モジュール リポジトリを取得し、出力を書式設定する

PS C:\> Get-PSRepository -Name "Local01" | Format-List * -Force
Name                      : local01
SourceLocation            : http://manikb-dev:8765/api/v2/
Trusted                   : True
Registered                : True
InstallationPolicy        : Trusted
PackageManagementProvider : NuGet
PublishLocation           : http://pattif-dev:8765/api/v2/package/
ScriptSourceLocation      : http://pattif-dev:8765/api/v2/artifacts/psscript
ScriptPublishLocation     : http://pattif-dev:8765/api/v2/package/
ProviderOptions           : {}

このコマンドは Local01 という名前のリポジトリを取得し、パイプライン演算子を使用してそのオブジェクトを Format-List コマンドレットに渡します。

パラメーター

-Name

取得するリポジトリの名前を指定します。

型:String[]
配置:0
規定値:None
必須:False
パイプライン入力を受け取る:True
ワイルドカード文字を受け取る:False