Import-PSGetRepository 
	查找已注册到 PowerShellGet 的存储库,并为 PSResourceGet 注册它们。
语法
Default (默认值)
Import-PSGetRepository
    [-Force]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]
说明
此 cmdlet 查找向 PowerShellGet v2 注册的 NuGet 存储库,并将其注册到 PSResourceGet。 PowerShellGet v2 具有提供程序模型,可用于注册使用不同提供程序协议的存储库。 PSResourceGet 仅支持 NuGet 存储库,因此此 cmdlet 仅导入 NuGet 存储库。
默认情况下,PSGallery 存储库已注册。 此 cmdlet 不会从 PowerShellGet v2 导入 PSGallery 存储库。 如果需要重新注册 PSGallery 存储库,请使用 Register-PSResourceRepository cmdlet 和 PSGallery 参数。
示例
示例 1 - 显示向 PowerShellGet v2 注册的 NuGet 存储库   
	此示例使用 Verbose 和 WhatIf 参数来显示向 PowerShell v2 注册的 NuGet 存储库。
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.
该 cmdlet 找到了已注册到 PowerShellGet v2 的三个存储库,但只会导入其中两个存储库。 在这种情况下,第三个存储库是 PSGallery 存储库的默认。
示例 2 - 注册使用 PowerShellGet v2 注册的 NuGet 存储库   
	Import-PSGetRepository
Name         Uri                             Trusted Priority
----         ---                             ------- --------
LocalGallery file:///E:/LocalGallery/        True    50
PrivateRepo  https://PrivateRepo:44370/nuget True    50
示例 3 - 覆盖现有存储库
默认情况下,cmdlet 不会导入与已注册的 PSResourceGet 存储库同名的 PowerShellGet v2 存储库。 使用 Force 参数覆盖现有存储库。
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
在运行 cmdlet 之前,提示你进行确认。
参数属性
| 类型: | SwitchParameter | 
| 默认值: | None | 
| 支持通配符: | False | 
| 不显示: | False | 
| 别名: | cf | 
参数集
(All)
| Position: | Named | 
| 必需: | False | 
| 来自管道的值: | False | 
| 来自管道的值(按属性名称): | False | 
| 来自剩余参数的值: | False | 
-Force
使用 Force 参数覆盖现有存储库。
参数属性
| 类型: | SwitchParameter | 
| 默认值: | False | 
| 支持通配符: | False | 
| 不显示: | False | 
参数集
(All)
| Position: | Named | 
| 必需: | False | 
| 来自管道的值: | False | 
| 来自管道的值(按属性名称): | False | 
| 来自剩余参数的值: | False | 
-WhatIf 
		显示 cmdlet 运行时会发生什么情况。 cmdlet 未能运行。
参数属性
| 类型: | SwitchParameter | 
| 默认值: | 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。
输出
Microsoft.PowerShell.PSResourceGet.UtilClasses.PSRepositoryInfo
该 cmdlet 为注册到 PowerShellGet v2 的每个 NuGet 存储库返回 PSRepositoryInfo 对象。