次の方法で共有


Import-PSGetRepository

Finds the repositories registered with PowerShellGet and registers them for PSResourceGet.

構文

Default (既定)

Import-PSGetRepository
    [-Force]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

説明

This cmdlet finds the NuGet repositories registered with PowerShellGet v2 and registers them for PSResourceGet. PowerShellGet v2 has a provider model that allows you to register repositories that use different provider protocols. PSResourceGet only supports NuGet repositories, so this cmdlet only imports NuGet repositories.

The PSGallery repository is registered by default. This cmdlet doesn't import the PSGallery repository from PowerShellGet v2. If you need to reregister the PSGallery repository, use the Register-PSResourceRepository cmdlet with the PSGallery parameter.

Example 1 - Show the NuGet repositories registered with PowerShellGet v2

This example uses the Verbose and WhatIf parameters to show the NuGet repositories registered with PowerShell v2.

Import-PSGetRepository -Verbose -WhatIf
VERBOSE: Found 3 registered PowerShellGet repositories.
VERBOSE: Selected 2 NuGet repositories.
What if: Registering LocalGallery at E:\LocalGallery\ -Trusted:$True -Force:$False.
What if: Registering PrivateRepo at https://PrivateRepo:44370/nuget -Trusted:$True -Force:$False.

The cmdlet found three repositories registered with PowerShellGet v2, but will only import two of them. In this case, the third repository is the default PSGallery repository.

Example 2 - Register the NuGet repositories registered with PowerShellGet v2

Import-PSGetRepository
Name         Uri                             Trusted Priority
----         ---                             ------- --------
LocalGallery file:///E:/LocalGallery/        True    50
PrivateRepo  https://PrivateRepo:44370/nuget True    50

Example 3 - Overwrite existing repositories

By default, the cmdlet doesn't import PowerShellGet v2 repositories that have the same name as a registered PSResourceGet repository. Use the Force parameter to overwrite existing repositories.

Import-PSGetRepository
WARNING: Adding to repository store failed: The PSResource Repository 'LocalGallery' already exists.
WARNING: Use the -Force switch to overwrite existing repositories.
WARNING: Adding to repository store failed: The PSResource Repository 'PrivateRepo' already exists.
WARNING: Use the -Force switch to overwrite existing repositories.
Import-PSGetRepository -Force
Name         Uri                             Trusted Priority
----         ---                             ------- --------
LocalGallery file:///E:/LocalGallery/        True    50
PrivateRepo  https://PrivateRepo:44370/nuget True    50

パラメーター

-Confirm

Prompts you for confirmation before running the cmdlet.

パラメーターのプロパティ

型:SwitchParameter
規定値:None
ワイルドカードのサポート:False
DontShow:False
Aliases:cf

パラメーター セット

(All)
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

-Force

Use the Force parameter to overwrite existing repositories.

パラメーターのプロパティ

型:SwitchParameter
規定値:False
ワイルドカードのサポート:False
DontShow:False

パラメーター セット

(All)
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet isn't run.

パラメーターのプロパティ

型:SwitchParameter
規定値:None
ワイルドカードのサポート:False
DontShow:False
Aliases:wi

パラメーター セット

(All)
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値: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.

出力

Microsoft.PowerShell.PSResourceGet.UtilClasses.PSRepositoryInfo

The cmdlet returns a PSRepositoryInfo object for each NuGet repository registered with PowerShellGet v2.