PowerShellGetv2 icon indicating copy to clipboard operation
PowerShellGetv2 copied to clipboard

PackageManagement\Register-PackageSource : The property 'Name' cannot be found on this object

Open sukhlab opened this issue 6 years ago • 17 comments

Context

PS C:\WINDOWS\system32> Register-PSRepository -Default 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.5\PSModule.psm1:11284 char:17

  • ... $null = PackageManagement\Register-PackageSource @PSBoundParamete ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (Microsoft.Power...erPackageSource:RegisterPackageSource) [Register-PackageSource], Exception
    • FullyQualifiedErrorId : PropertyNotFoundStrict,Microsoft.PowerShell.PackageManagement.Cmdlets.RegisterPackageSource

Your Environment


> $PSVersionTable
Name                           Value                                                                                                                                                                                       
----                           -----                                                                                                                                                                                       
PSVersion                      5.1.15063.1155                                                                                                                                                                              
PSEdition                      Desktop                                                                                                                                                                                     
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                                                                     
BuildVersion                   10.0.15063.1155                                                                                                                                                                             
CLRVersion                     4.0.30319.42000                                                                                                                                                                             
WSManStackVersion              3.0                                                                                                                                                                                         
PSRemotingProtocolVersion      2.3                                                                                                                                                                                         
SerializationVersion           1.1.0.1                                                                                                                                                                                     

> Get-Module
ModuleType Version    Name                                ExportedCommands                                                                                                                                                 
---------- -------    ----                                ----------------                                                                                                                                                 
Script     1.0.0.0    ISE                                 {Get-IseSnippet, Import-IseSnippet, New-IseSnippet}                                                                                                              
Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Content...}                                                                                               
Manifest   3.0.0.0    Microsoft.PowerShell.Security       {ConvertFrom-SecureString, ConvertTo-SecureString, Get-Acl, Get-AuthenticodeSignature...}                                                                        
Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-Object...}                                                                                                        
Manifest   3.0.0.0    Microsoft.WSMan.Management          {Connect-WSMan, Disable-WSManCredSSP, Disconnect-WSMan, Enable-WSManCredSSP...}                                                                                  
Script     1.1.7.2    PackageManagement                   {Find-Package, Find-PackageProvider, Get-Package, Get-PackageProvider...}                                                                                        
Script     1.6.5      PowershellGet                       {Find-Command, Find-DscResource, Find-Module, Find-RoleCapability...}  
> Get-Module -ListAvailable PowerShellGet,PackageManagement
   Directory: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands                                                                                                                                                 
---------- -------    ----                                ----------------                                                                                                                                                 
Script     1.1.7.2    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}                                                                                           
Binary     1.0.0.1    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}                                                                                           
Script     1.6.5      PowerShellGet                       {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability...}                                                                                            
Script     1.0.0.1    PowerShellGet                       {Install-Module, Find-Module, Save-Module, Update-Module...}      
> Get-PackageProvider
Name                     Version          DynamicOptions                                                                                                                                                                   
----                     -------          --------------                                                                                                                                                                   
msi                      3.0.0.0          AdditionalArguments                                                                                                                                                              
msu                      3.0.0.0                                                                                                                                                                                           
NuGet                    2.8.5.201        Destination, ExcludeVersion, Headers, FilterOnTag, Contains, AllowPrereleaseVersions, ConfigFile, SkipValidate                                                                   
PowerShellGet            1.0.0.1          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, Filter, Tag, Includes, DscResource, RoleCapability, Command, PublishLoc...
Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent                                                                                                                                  

> Get-PackageProvider -ListAvailable
Name                     Version          DynamicOptions                                                                                                                                                                   
----                     -------          --------------                                                                                                                                                                   
msi                      3.0.0.0          AdditionalArguments                                                                                                                                                              
msu                      3.0.0.0                                                                                                                                                                                           
nuget                    2.8.5.208                                                                                                                                                                                         
NuGet                    2.8.5.201        Destination, ExcludeVersion, Headers, FilterOnTag, Contains, AllowPrereleaseVersions, ConfigFile, SkipValidate                                                                   
PowerShellGet            1.6.5.0          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, AllowPrereleaseVersions, Filter, Tag, Includes, DscResource, RoleCapabi...
PowerShellGet            1.0.0.1          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, Filter, Tag, Includes, DscResource, RoleCapability, Command, PublishLoc...
Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent               

sukhlab avatar Jun 18 '18 03:06 sukhlab

Any help to fix this issue is highly appreciated. Regards Sukh

sukhlab avatar Jun 18 '18 03:06 sukhlab

@sueimi2015 Can you please get more details to reproduce the reported issue? Also get the output of below commands from a new PowerShell console.

Register-PSRepository -Default -Verbose -Debug
Get-PSRepository -Verbose -Debug
Get-Module
Get-PackageProvider

bmanikm avatar Jun 19 '18 06:06 bmanikm

Can you please share the contents of $env:LOCALAPPDATA\Microsoft\Windows\PowerShell\PowerShellGet\PSRepositories.xml file? As a workaround, run Get-PSRepository command after deleting the $env:LOCALAPPDATA\Microsoft\Windows\PowerShell\PowerShellGet\PSRepositories.xml file.

bmanikm avatar Jun 19 '18 06:06 bmanikm

@bmanikm Thanks for replying and please find details as asked. I have updated some of the packages from last update and looks like [The property 'Name' cannot be found on this object] issue has fixed. but I am hit by another one.

PackageManagement\Register-PackageSource : The specified Uri ',url.' for parameter 'Location' is an invalid Web Uri. Please ensure that it meets the Web Uri requirements.

PS C:\WINDOWS\system32> Register-PSRepository -Default -Verbose -Debug DEBUG: 00:00:00.0000003 Calling New() : MethodName = 'GetDynamicOptions' DEBUG: 00:00:00.0000670 Verbose: True DEBUG: 00:00:00.0001122 Debug: True DEBUG: 00:00:00.0001536 Name: PSGallery DEBUG: 00:00:00.0015174 INVOKING PowerShell Fn Get-DynamicOptions with args Provider that has length 1 DEBUG: 00:00:00.0110676 In PowerShellGet Provider - 'Get-DynamicOptions'. DEBUG: 00:00:00.0135605 Done calling powershell «Get-DynamicOptions» «PSModule» DEBUG: 00:00:00.0221084 Calling New() : MethodName = 'GetDynamicOptions' DEBUG: 00:00:00.0221668 Verbose: True DEBUG: 00:00:00.0222110 Debug: True DEBUG: 00:00:00.0222518 Name: PSGallery DEBUG: 00:00:00.0231358 INVOKING PowerShell Fn Get-DynamicOptions with args Source that has length 1 DEBUG: 00:00:00.0241588 In PowerShellGet Provider - 'Get-DynamicOptions'. DEBUG: 00:00:00.0273690 Done calling powershell «Get-DynamicOptions» «PSModule» DEBUG: 00:00:03.5114844 Calling New() : MethodName = 'ResolvePackageSources' DEBUG: 00:00:03.5180056 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString DEBUG: 00:00:03.5194909 ProviderName: PowerShellGet DEBUG: 00:00:03.5203671 Verbose: True DEBUG: 00:00:03.5207276 Debug: True DEBUG: 00:00:03.5218116 Name: PSGallery DEBUG: 00:00:03.5227425 INVOKING PowerShell Fn Resolve-PackageSource with args that has length 0 DEBUG: 00:00:03.5237244 In PowerShellGet Provider - 'Resolve-PackageSource'. VERBOSE: Repository details, Name = 'JFrog', Location = 'url'; IsTrusted = 'False'; IsRegistered = 'True'. DEBUG: 00:00:03.5262739 Yielding package source for JFrog at location url DEBUG: 00:00:03.5273517 Done calling powershell «Resolve-PackageSource» «PSModule» DEBUG: 00:00:05.8775192 Calling New() : MethodName = 'AddPackageSource' DEBUG: 00:00:05.8823155 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString DEBUG: 00:00:05.8833274 ProviderName: PowerShellGet DEBUG: 00:00:05.8842448 Verbose: True DEBUG: 00:00:05.8862142 Debug: True DEBUG: 00:00:05.8873298 Name: PSGallery DEBUG: 00:00:05.8891783 INVOKING PowerShell Fn Add-PackageSource with args PSGallery, , False that has length 3 DEBUG: 00:00:05.8904732 In PowerShellGet Provider - 'Add-PackageSource'. DEBUG: 00:00:05.8914743 OPTION: MessageResolver => Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString DEBUG: 00:00:05.8922692 OPTION: ProviderName => PowerShellGet DEBUG: 00:00:05.8930629 OPTION: Verbose => True DEBUG: 00:00:05.8940188 OPTION: Debug => True DEBUG: 00:00:05.8949161 OPTION: Name => PSGallery DEBUG: 00:00:07.1625400 Ping-Endpoint: location=https://go.microsoft.com/fwlink/?LinkID=397631&clcid=0x409, statuscode=200, resolvedLocation=https://www.powershellgallery.com/api/v2/ DEBUG: 00:00:08.3984320 Ping-Endpoint: location=https://go.microsoft.com/fwlink/?LinkID=622995&clcid=0x409, statuscode=200, resolvedLocation=https://www.powershellgallery.com/api/v2/items/psscript/ VERBOSE: Repository details, Name = 'PSGallery', Location = 'https://www.powershellgallery.com/api/v2/'; IsTrusted = 'False'; IsRegistered = 'True'. DEBUG: 00:00:09.4461683 Yielding package source for PSGallery at location https://www.powershellgallery.com/api/v2/ DEBUG: 00:00:09.4471954 Done calling powershell «Add-PackageSource» «PSModule»

PS C:\WINDOWS\system32> Get-PSRepository -Verbose -Debug DEBUG: 00:00:00.0000003 Calling New() : MethodName = 'GetDynamicOptions' DEBUG: 00:00:00.0000639 Debug: True DEBUG: 00:00:00.0001079 Verbose: True DEBUG: 00:00:00.0014104 INVOKING PowerShell Fn Get-DynamicOptions with args Provider that has length 1 DEBUG: 00:00:00.0028861 In PowerShellGet Provider - 'Get-DynamicOptions'. DEBUG: 00:00:00.0055086 Done calling powershell «Get-DynamicOptions» «PSModule» DEBUG: 00:00:00.0148257 Calling New() : MethodName = 'GetDynamicOptions' DEBUG: 00:00:00.0148860 Debug: True DEBUG: 00:00:00.0149382 Verbose: True DEBUG: 00:00:00.0161913 INVOKING PowerShell Fn Get-DynamicOptions with args Source that has length 1 DEBUG: 00:00:00.0172379 In PowerShellGet Provider - 'Get-DynamicOptions'. DEBUG: 00:00:00.0206129 Done calling powershell «Get-DynamicOptions» «PSModule» DEBUG: 00:00:01.9886302 Calling New() : MethodName = 'ResolvePackageSources' DEBUG: 00:00:01.9939333 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString DEBUG: 00:00:01.9946555 ProviderName: PowerShellGet DEBUG: 00:00:01.9955203 Verbose: True DEBUG: 00:00:01.9964153 Debug: True DEBUG: 00:00:01.9972622 INVOKING PowerShell Fn Resolve-PackageSource with args that has length 0 DEBUG: 00:00:01.9980234 In PowerShellGet Provider - 'Resolve-PackageSource'. VERBOSE: Repository details, Name = 'PSGallery', Location = 'https://www.powershellgallery.com/api/v2/'; IsTrusted = 'False'; IsRegistered = 'True'. DEBUG: 00:00:02.0005209 Yielding package source for PSGallery at location https://www.powershellgallery.com/api/v2/ VERBOSE: Repository details, Name = 'JFrog', Location = 'url'; IsTrusted = 'False'; IsRegistered = 'True'. DEBUG: 00:00:02.0025763 Yielding package source for JFrog at location url DEBUG: 00:00:02.0038440 Done calling powershell «Resolve-PackageSource» «PSModule»

Name InstallationPolicy SourceLocation


PSGallery Untrusted https://www.powershellgallery.com/api/v2/
JFrog Untrusted

PS C:\WINDOWS\system32> Get-Module

ModuleType Version Name ExportedCommands


Script 1.0 GroupSet {BuildResourceCommonParameters, BuildResourceString, GroupSet}
Script 1.0.0.0 ISE {Get-IseSnippet, Import-IseSnippet, New-IseSnippet}
Manifest 3.1.0.0 Microsoft.PowerShell.Management {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Content...}
Manifest 3.1.0.0 Microsoft.PowerShell.Utility {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
Script 1.1.7.2 PackageManagement {Find-Package, Find-PackageProvider, Get-Package, Get-PackageProvider...}
Script 1.1.1.0 PowerShellGet {Find-Command, Find-DscResource, Find-Module, Find-RoleCapability...}
Script 1.0 ProcessSet {BuildResourceCommonParameters, BuildResourceString, ProcessSet}
Manifest 1.1 PSDesiredStateConfiguration {Invoke-DscResource, Publish-DscConfiguration, Set-DscLocalConfigurationManager, Start-DscConfiguration...}
Script 1.0 ServiceSet {BuildResourceCommonParameters, BuildResourceString, ServiceSet}
Script 1.0 WindowsFeatureSet {BuildResourceCommonParameters, BuildResourceString, WindowsFeatureSet}
Script 1.0 WindowsOptionalFeatureSet {BuildResourceCommonParameters, BuildResourceString, WindowsOptionalFeatureSet}

PS C:\WINDOWS\system32> Get-PackageProvider

Name Version DynamicOptions


msi 3.0.0.0 AdditionalArguments
msu 3.0.0.0
NuGet 2.8.5.210 Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag, Contains, AllowPrereleaseVersions, ConfigFile, SkipValidate
PowerShellGet 1.1.1.0 PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, Filter, Tag, Includes, DscResource, RoleCapability, Command, PublishLoc... Programs 3.0.0.0 IncludeWindowsInstaller, IncludeSystemComponent

content of PSRepository.xml

System.Collections.Hashtable System.Object PSGallery Microsoft.PowerShell.Commands.PSRepository System.Management.Automation.PSCustomObject System.Object PSGallery https://www.powershellgallery.com/api/v2/ https://www.powershellgallery.com/api/v2/package/ https://www.powershellgallery.com/api/v2/items/psscript/ https://www.powershellgallery.com/api/v2/package/ System.Management.Automation.SwitchParameter System.ValueType System.Object False false true Untrusted NuGet JFrog Deserialized.Microsoft.PowerShell.Commands.PSRepository Deserialized.System.Management.Automation.PSCustomObject Deserialized.System.Object JFrog url url url false true Untrusted NuGet Deserialized.System.Collections.Hashtable Deserialized.System.Object

sukhlab avatar Jun 19 '18 22:06 sukhlab

@sueimi2015 Below error can also happen when you try to register a source location which needs your credentials. It looks like your JFrog repository requires your credentials.

PackageManagement\Register-PackageSource : The specified Uri ',url.' for parameter 'Location' is an invalid Web Uri. Please ensure that it meets the Web Uri
requirements.

bmanikm avatar Jun 19 '18 22:06 bmanikm

@bmanikm Thanks for update. I have tried with -credentials and got same error. I have also tried same with powershell core and looks like its working well with powershell core.

Now, the last roadblock I hit by in even powershell core is while publishing the modules to artifactory nuget repository.

PS C:\Program Files\PowerShell\Modules\dbsize> Publish-Module -Path "C:\Program Files\PowerShell\Modules\dbsize" -Repository "repos_name" -NuGetApiKey "username:key" WARNING: This module 'C:\Users\user\AppData\Local\Temp\2067324619\dbsize\dbsize.psd1' has exported functions. As a best practice, include exported functions in the module manifest file(.psd1). You can run Update-ModuleManifest -FunctionsToExport to update the manifest with ExportedFunctions field. Publish-PSArtifactUtility : Failed to publish module 'dbsize': 'Cannot prompt for input in non-interactive mode. '. At C:\program files\powershell\6-preview\Modules\PowerShellGet\1.6.0\PSModule.psm1:1447 char:17

  • ... Publish-PSArtifactUtility @PublishPSArtifactUtility_Param ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
  • CategoryInfo : InvalidOperation: (:) [Write-Error], WriteErrorException
  • FullyQualifiedErrorId : FailedToPublishTheModule,Publish-PSArtifactUtility

sukhlab avatar Jun 20 '18 00:06 sukhlab

Please take a look at https://github.com/PowerShell/PowerShellGet/issues/245#issuecomment-376694015 to resolve the 'Cannot prompt for input in non-interactive mode.' issue.

bmanikm avatar Jun 20 '18 01:06 bmanikm

@bmanikm I think #245 is talking about usage of -Credential and which I am already using it as -NuGetApiKey "username:key". I couldn't get straight instruction for any other workaround to wrap credentials. could you please help me to provide the same.

I have added source and credentials using nuget.exe already

C:\Program Files\Nuget>nuget setapikey username:key -Source repo_name The API Key 'username:key' was saved for 'url'.

Also please keep in mind that save-module, find-module is working fine with -credential and registered repository. issue is with publish-module

sukhlab avatar Jun 20 '18 02:06 sukhlab

@bmanikm The last I tried today is as follows: pasting output with verbose

PS C:\WorkData\MyModules\dbsize> Publish-Module -Name dbsize -Repository -Verbose -NuGetApiKey "user:key"

VERBOSE: Repository details, Name = '', Location = 'url'; IsTrusted = 'False'; IsRegistered = 'True'. VERBOSE: Repository details, Name = '', Location = 'url'; IsTrusted = 'False'; IsRegistered = 'True'. VERBOSE: Publish Location:'url'. VERBOSE: Module 'dbsize' was found in 'C:\WorkData\MyModules\dbsize'. VERBOSE: Loading module from path 'C:\Users\username\AppData\Local\Temp\1209052033\dbsize\dbsize.psm1'. VERBOSE: Repository details, Name = '', Location = 'url'; IsTrusted = 'False'; IsRegistered = 'True'. VERBOSE: Using the provider 'PowerShellGet' for searching packages. VERBOSE: Using the specified source names : ''. VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'. VERBOSE: The specified Location is 'url' and PackageManagementProvider is 'NuGet'. VERBOSE: Searching repository 'urlFindPackagesById()?id='dbsize'' for ''. VERBOSE: Retry downloading 'urlFindPackagesById()?id='dbsize'&$skip=0&$top=40' for '2' more times VERBOSE: Retry downloading 'urlFindPackagesById()?id='dbsize'&$skip=0&$top=40' for '1' more times VERBOSE: Retry downloading 'urlFindPackagesById()?id='dbsize'&$skip=0&$top=40' for '0' more times VERBOSE: Total package yield:'0' for the specified package 'dbsize'. VERBOSE: Performing the operation "Publish-Module" on target "Version '0.0.1' of module 'dbsize'". WARNING: This module 'C:\Users\username\AppData\Local\Temp\1209052033\dbsize\dbsize.psd1' has exported functions. As a best practice, include exported functions in the module manifest file(.psd1). You can run Update-ModuleManifest -FunctionsToExport to update the manifest with ExportedFunctions field. Publish-PSArtifactUtility : Failed to publish module 'dbsize': 'Cannot prompt for input in non-interactive mode. '. At C:\program files\powershell\6-preview\Modules\PowerShellGet\1.6.0\PSModule.psm1:1447 char:17

  • ... Publish-PSArtifactUtility @PublishPSArtifactUtility_Param ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
  • CategoryInfo : InvalidOperation: (:) [Write-Error], WriteErrorException
  • FullyQualifiedErrorId : FailedToPublishTheModule,Publish-PSArtifactUtility

sukhlab avatar Jun 20 '18 05:06 sukhlab

Since the credential option is not supported on NuGet.exe, below command is required for publishing to an authenticated sources/repositories.

.\NuGet.exe sources Add -Name "psgettestfeed" -Source "https://myrepo.pkgs.visualstudio.com/_packaging/psgettestfeed/nuget/v2" -UserName [email protected] -Password $myPatToken

Take a look at below URLs for more details on 'Cannot prompt for input in non-interactive mode.' error

  • https://stackoverflow.com/questions/27771574/nuget-push-cannot-prompt-for-input-in-non-interactive-mode
  • https://stackoverflow.com/questions/22945314/nuget-exe-cannot-prompt-for-input-in-non-interactive-mode
  • http://www.robinosborne.co.uk/2014/09/15/nuget-cannot-prompt-for-input-in-non-interactive-mode/
  • https://www.xavierdecoster.com/post/2012/12/12/nuget-package-restore-from-a-secured-feed.html

After setting the apikey using NuGet.exe, can you try whether you can push a nupkg file to your source without getting any prompt for entering the credentials.

bmanikm avatar Jun 20 '18 08:06 bmanikm

@bmanikm I have tried few workaround today.

Solution 1: worked successfully -- tried with powershell core

PS C:\WorkData\MyModules\dbsize> nuget sources add -Name JRepo -Source "Repo_URL" -User username -pass password Package Source with Name: JRepo added successfully.

PS C:\WorkData\MyModules\dbsize> nuget setapikey username:apikey -Source JRepo The API Key 'username:apikey' was saved for 'Repo_URL'.

PS C:\WorkData\MyModules\dbsize> Publish-Module -Name dbsize -Repository Artifactory_Repo_Name -Verbose -NuGetApiKey "username:apikey" VERBOSE: Repository details, Name = 'Artifactory_Repo_Name', Location = 'Repo_URL'; IsTrusted = 'False'; IsRegistered = 'True'. VERBOSE: Repository details, Name = 'Artifactory_Repo_Name', Location = 'Repo_URL'; IsTrusted = 'False'; IsRegistered = 'True'. VERBOSE: Publish Location:'Repo_URL'. VERBOSE: Module 'dbsize' was found in 'C:\WorkData\MyModules\dbsize'. VERBOSE: Loading module from path 'C:\Users\username\AppData\Local\Temp\388052388\dbsize\dbsize.psm1'. VERBOSE: Repository details, Name = 'Artifactory_Repo_Name', Location = 'Repo_URL'; IsTrusted = 'False'; IsRegistered = 'True'. VERBOSE: Using the provider 'PowerShellGet' for searching packages. VERBOSE: Using the specified source names : 'Artifactory_Repo_Name'. VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'. VERBOSE: The specified Location is 'Repo_URL' and PackageManagementProvider is 'NuGet'. VERBOSE: Searching repository 'Repo_URLFindPackagesById()?id='dbsize'' for ''. VERBOSE: Retry downloading 'Repo_URLFindPackagesById()?id='dbsize'&$skip=0&$top=40' for '2' more times VERBOSE: Retry downloading 'Repo_URLFindPackagesById()?id='dbsize'&$skip=0&$top=40' for '1' more times VERBOSE: Retry downloading 'Repo_URLFindPackagesById()?id='dbsize'&$skip=0&$top=40' for '0' more times VERBOSE: Total package yield:'0' for the specified package 'dbsize'. VERBOSE: Performing the operation "Publish-Module" on target "Version '0.0.1' of module 'dbsize'". WARNING: This module 'C:\Users\username\AppData\Local\Temp\388052388\dbsize\dbsize.psd1' has exported functions. As a best practice, include exported functions in the module manifest file(.psd1). You can run Update-ModuleManifest -FunctionsToExport to update the manifest with ExportedFunctions field. VERBOSE: Successfully published module 'dbsize' to the module publish location 'Repo_URL'. Please allow few minutes for 'dbsize' to show up in the search results.

sukhlab avatar Jun 21 '18 01:06 sukhlab

Solution2: worked successfully for me! -- tried with powershell core

  1. updated user and pass for nuget in nuget.config nuget setapikey username:apikey -Source "Repo_URL" -configfile "configfilepath\nuget.config" --- if nuget.config file does not exists then create it under any folder on your machine from sample https://docs.microsoft.com/en-us/nuget/reference/nuget-config-file

  2. updated source in nuget.config nuget sources add -Name -Source "Repo_URL" -User -pass -configFile "configfilepath\nuget.config" -StorePasswordInClearText

  3. tried publish Publish-Module -Name dbsize -Repository artifactory_reponame -Verbose -NuGetApiKey "username:apikey"

Publish-PSArtifactUtility : Failed to publish module 'dbsize': 'Cannot prompt for input in non-interactive is fixed.

sukhlab avatar Jun 21 '18 01:06 sukhlab

Solution3: worked successfully with push using nuget only. In this solution I am not using password and username -- tried with powershell core

  1. NuGet.exe sources Add -Name "nuget_sourcename" -Source "artifactory_repo_url"

  2. nuget setapikey : -Source nuget_sourcename

  3. tried to publish module Publish-Module -Name dbsize -Repository JFrog -Verbose -NuGetApiKey ":" Failed with following: Publish-PSArtifactUtility : Failed to publish module 'dbsize': 'Cannot prompt for input in non-interactive mode.

  4. Try to push package using nuget nuget push .\pckgname.nupkg -Source nuget_sourcename worked!

sukhlab avatar Jun 21 '18 01:06 sukhlab

It is crazy. How its possible that I have left everything working last week and Trying it today getting same error as below. PackageManagement\Register-PackageSource : The property 'Name' cannot be found on this object. Verify that the property exists.

PS C:\WINDOWS\system32> get-module

ModuleType Version Name ExportedCommands


Script 1.0.0.0 ISE {Get-IseSnippet, Import-IseSnippet, New-IseSnippet}
Manifest 3.1.0.0 Microsoft.PowerShell.Management {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Content...}
Manifest 3.1.0.0 Microsoft.PowerShell.Utility {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
Script 1.1.7.2 PackageManagement {Find-Package, Find-PackageProvider, Get-Package, Get-PackageProvider...}
Script 1.6.5 PowerShellGet {Find-Command, Find-DscResource, Find-Module, Find-RoleCapability...}

PS C:\WINDOWS\system32> Get-PackageProvider

Name Version DynamicOptions


msi 3.0.0.0 AdditionalArguments
msu 3.0.0.0
NuGet 2.8.5.210 Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag, Contains, AllowPrereleaseVersions, ConfigFile, SkipValidate
PowerShellGet 1.6.5.0 PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, AllowPrereleaseVersions, Filter, Tag, Includes, DscResource, RoleCapabi... Programs 3.0.0.0 IncludeWindowsInstaller, IncludeSystemComponent

any clue?

sukhlab avatar Jul 02 '18 05:07 sukhlab

@sueimi2015 are you still running into this issue-- "Register-PackageSource : The property 'Name' cannot be found on this object"? Trying to go through inactive issues and determine which are still problems after our updates-thanks!

SydneyhSmith avatar Jan 03 '19 19:01 SydneyhSmith

I read through here because I am facing a very similar issue. I am on Linux and I was able to fix this by doing this:

rm -rf ~/.cache/powershell

Prior to doing that I re-installed powershell from apt to snap as well as blew away ~/.config/powershell as well as ~/.local/lib/powershell. The cache directory seemed to be doing something that perma-broke Register-PSRepository. I was testing out our own repository and was calling Register/Unregister many times before this broke.

The line number on my end is slightly different from the original post, but same module and column.

   PS /home/dillon> Register-PSRepository -Name xxxxx -SourceLocation "xxxxx"                                                                 
PackageManagement\Register-PackageSource : The property 'Name' cannot be found on this object. Verify that the property exists.                                                                        
At /snap/powershell/17/opt/powershell/Modules/PowerShellGet/PSModule.psm1:11407 char:17                                                                                                         
+ ...     $null = PackageManagement\Register-PackageSource @PSBoundParamete ...                                                                                                                                   
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                                 
    
+ CategoryInfo          : NotSpecified: (Microsoft.Power...erPackageSource:RegisterPackageSource) [Register-PackageSource], Exception                                                                             
+ FullyQualifiedErrorId :         PropertyNotFoundStrict,Microsoft.PowerShell.PackageManagement.Cmdlets.RegisterPackageSource                                                                                
                                                                                                                                                                                                                       

iridian-ks avatar Jan 31 '19 00:01 iridian-ks

@sueimi2015 are you still running into this issue-- "Register-PackageSource : The property 'Name' cannot be found on this object"? Trying to go through inactive issues and determine which are still problems after our updates-thanks!

I'm still having this issue on all current versions of PowerShell (5.1, 6.2.2, and 7.0.0-Preview.5):

PS H:\> Register-PSRepository -Default
PackageManagement\Register-PackageSource : The property 'Name' cannot be found on this object. Verify that the
property exists.
At C:\Users\...\Documents\WindowsPowerShell\Modules\PowerShellGet\2.2.1\PSModule.psm1:11527 char:17
+ ...     $null = PackageManagement\Register-PackageSource @PSBoundParamete ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Microsoft.Power...erPackageSource:RegisterPackageSource) [Register-Packag
   eSource], Exception
    + FullyQualifiedErrorId : PropertyNotFoundStrict,Microsoft.PowerShell.PackageManagement.Cmdlets.RegisterPackageSou
   rce

PS H:\> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.16299.1146
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.16299.1146
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1


PS H:\> Get-Module

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     0.0        chocolateyProfile                   {TabExpansion, Update-SessionEnvironment, refreshenv}
Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Con...
Manifest   3.0.0.0    Microsoft.PowerShell.Security       {ConvertFrom-SecureString, ConvertTo-SecureString, Get-Acl...
Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
Manifest   3.0.0.0    Microsoft.WSMan.Management          {Connect-WSMan, Disable-WSManCredSSP, Disconnect-WSMan, En...
Script     1.4.5      PackageManagement                   {Find-Package, Find-PackageProvider, Get-Package, Get-Pack...
Script     2.2.1      PowerShellGet                       {Find-Command, Find-DscResource, Find-Module, Find-RoleCap...
Script     1.2        PSReadline                          {Get-PSReadlineKeyHandler, Get-PSReadlineOption, Remove-PS...


PS H:\> Get-Module -ListAvailable PowerShellGet,PackageManagement


    Directory: C:\Users\...\Documents\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.4.5      PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-Packa...
Script     1.4.4      PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-Packa...
Script     1.3.1      PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-Packa...
Script     2.2.1      PowerShellGet                       {Find-Command, Find-DSCResource, Find-Module, Find-RoleCap...
Script     2.2        PowerShellGet                       {Find-Command, Find-DSCResource, Find-Module, Find-RoleCap...
Script     2.1.5      PowerShellGet                       {Find-Command, Find-DSCResource, Find-Module, Find-RoleCap...


    Directory: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.4.2      PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-Packa...
Script     1.2.4      PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-Packa...
Binary     1.0.0.1    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-Packa...
Script     1.0.0.1    PowerShellGet                       {Install-Module, Find-Module, Save-Module, Update-Module...}


PS H:\> Get-PackageProvider

Name                     Version          DynamicOptions
----                     -------          --------------
msi                      3.0.0.0          AdditionalArguments
msu                      3.0.0.0
NuGet                    3.0.0.1          Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag...
PowerShellGet            2.2.1.0          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, ...
Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent
PS H:\> Register-PSRepository -Default
Register-PackageSource: C:\Users\...\Documents\PowerShell\Modules\PowerShellGet\2.2.1\PSModule.psm1
 Line |
11527 |         $null = PackageManagement\Register-PackageSource @PSBoundParameters
      |                 ^ The property 'Name' cannot be found on this object. Verify that the property exists.


Suggestion [4,General]: The most similar commands are: dsget.exe, net.exe, net1.exe, nltest.exe, quser.exe, reset.exe, subst.exe, git.exe, regset.exe, hugo.exe.
PS H:\> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.0.0-preview.5
PSEdition                      Core
GitCommitId                    7.0.0-preview.5
OS                             Microsoft Windows 10.0.16299
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

PS H:\> Get-Module

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Manifest   7.0.0.0               Microsoft.PowerShell.Management     {Add-Content, Clear-Content, Clear-Item, Clear-It…
Manifest   7.0.0.0               Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-Ob…
Script     1.4.5                 PackageManagement                   {Find-Package, Find-PackageProvider, Get-Package,…
Script     2.2.1                 PowerShellGet                       {Find-Command, Find-DscResource, Find-Module, Fin…
Script     2.0.0      beta5      PSReadLine                          {Get-PSReadLineKeyHandler, Get-PSReadLineOption, …

PS H:\> Get-Module -ListAvailable PowerShellGet,PackageManagement


    Directory: C:\Users\...\Documents\PowerShell\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Script     1.4.5                 PackageManagement                   Desk      {Find-Package, Get-Package, Get-Package…
Script     1.4.4                 PackageManagement                   Desk      {Find-Package, Get-Package, Get-Package…
Script     2.2.1                 PowerShellGet                       Desk      {Find-Command, Find-DSCResource, Find-M…
Script     2.2                   PowerShellGet                       Desk      {Find-Command, Find-DSCResource, Find-M…

    Directory: C:\program files\powershell\7-preview\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Script     1.4.5                 PackageManagement                   Desk      {Find-Package, Get-Package, Get-Package…
Script     2.2.1                 PowerShellGet                       Desk      {Find-Command, Find-DSCResource, Find-M…

PS H:\>
PS H:\> Get-PackageProvider

Name                     Version          DynamicOptions
----                     -------          --------------
NuGet                    3.0.0.1          Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag, …
PowerShellGet            2.2.1.0          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, In…

PS H:\> Get-PackageProvider -ListAvailable

Name                     Version          DynamicOptions
----                     -------          --------------
NuGet                    3.0.0.1          Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag, …
PowerShellGet            2.2.1.0          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, In…
PowerShellGet            2.2.0.0

WizzardS10 avatar Nov 12 '19 16:11 WizzardS10