Register-PsRepository : The property 'Name' cannot be found on this object

4.2k Views Asked by At

I'm getting below error when trying to run Register-PsRepository

I have tried:

  • re-installing WMF 5, PowerShellGet and PackageManagement modules
  • updating said modules
  • debugging PowerShellGet module I can see that PsBoundParameters does pass the Name value to Register-PackageSource command.
  • Register-PackageSource does work correctly when I run it manually.

Any Ideas?

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
1

There are 1 best solutions below

3
On BEST ANSWER

Please check PSRepository configuration xml file:

%localappdata%\Microsoft\windows\PowerShell\PowerShellGet\PSRepositories.xml

It's possible that file is corrupt and that could lead to an error you are getting.