Powershell 注册PsRepository:属性';名称';在此对象上找不到
尝试运行Register PsRepository时出现以下错误 我试过:Powershell 注册PsRepository:属性';名称';在此对象上找不到,powershell,powershellget,Powershell,Powershellget,尝试运行Register PsRepository时出现以下错误 我试过: 重新安装WMF 5、PowerShellGet和PackageManagement模块 更新所述模块 调试PowerShellGet模块我可以看到PsBoundParameters确实将名称值传递给Register PackageSource命令 当我手动运行Register PackageSource时,它工作正常 有什么想法吗 PS C:\> Register-PSRepository -Name MyRe
- 重新安装WMF 5、PowerShellGet和PackageManagement模块
- 更新所述模块
- 调试PowerShellGet模块我可以看到PsBoundParameters确实将名称值传递给Register PackageSource命令李>
- 当我手动运行Register PackageSource时,它工作正常李>
PS C:\> Register-PSRepository -Name MyRepo -SourceLocation https://MyRepo.com/api/Myrepo -Credential $c
PackageManagement\Register-PackageSource : The property 'Name' cannot be
found on this object. Verify that the property exists.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.6.0\PSModule.psm1:4631 char:17
请检查PSRepository配置xml文件: %localappdata%\Microsoft\windows\PowerShell\PowerShellGet\PSRepositories.xml
文件可能已损坏,这可能会导致您遇到错误。
注册PackageSource在我手动运行时工作正常。
为什么不使用它呢?因为一些独立于我的函数需要注册psrepository,而不仅仅是PackageSource是的,谢谢Lukas!该文件已损坏,我已重新创建该文件-一切工作都像一个魅力!你,救了我一天,这才是真正的问题!在我的例子中,我的代码是通过在系统帐户下运行的DSC运行的,PSRepository.xml
将位于C:\Windows\System32\config\systemprofile\AppData\Local\Microsoft\Windows\PowerShell\PowerShell\PSRepositories.xml