PowerShell / PowerShellGetv2

PowerShellGet is the Package Manager for PowerShell
https://www.PowerShellGallery.com
MIT License
430 stars 138 forks source link

The property 'Name' cannot be found on this object. Verify that the property exists. #522

Open Outek opened 5 years ago

Outek commented 5 years ago

Steps to reproduce

configuration PSRepository_AddRepositoryConfig
{
    param
    (
        [Parameter()]
        [System.String[]]
        $NodeName = 'localhost'
    )

    Import-DscResource -ModuleName 'PowerShellGet'

    Node $nodeName
    {
        PSRepository 'AddRepository'
        {
            Name                  = 'TestRepo'
            SourceLocation        = 'https://<validreponame>/'
            InstallationPolicy    = 'Trusted'
        }
    }
}

PSRepository_AddRepositoryConfig -OutputPath C:\Temp

Start-DscConfiguration -Path C:\Temp -Wait -Force -Verbose

Expected behavior

A new source should be registered after the Dsc

Actual behavior

An Error occured.

PS C:\Windows\system32> C:\Temp\Untitled1.ps1

    Directory: C:\Temp

Mode                LastWriteTime         Length Name                                                                                                                                    
----                -------------         ------ ----                                                                                                                                    
-a----       12.08.2019     10:01           2270 localhost.mof                                                                                                                           
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Mic
rosoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer Testserver with user sid S-1-8-21-1117444035-483950394-1849977318-80053.
VERBOSE: [Testserver]: LCM:  [ Start  Set      ]
VERBOSE: [Testserver]: LCM:  [ Start  Resource ]  [[PSRepository]AddRepository]
VERBOSE: [Testserver]: LCM:  [ Start  Test     ]  [[PSRepository]AddRepository]
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Determining if the repository 'TestRepo' is in the desired state.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Return the current state of the repository 'TestRepo'.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Populating RepositorySourceLocation property for module PackageManagement.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\PackageManagement\1.4.3\PackageM
anagement.psm1'.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\PackageManagement\1.4.3\PackageM
anagement.psd1'.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Loading 'FormatsToProcess' from path 'C:\Program Files\WindowsPowerShell\Modules\PackageManagement\1.
4.3\PackageManagement.format.ps1xml'.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Populating RepositorySourceLocation property for module PackageManagement.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\PackageManagement\1.4.3\PackageM
anagement.psm1'.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Find-Package'.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Find-PackageProvider'.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Get-Package'.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Get-PackageProvider'.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Get-PackageSource'.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Import-PackageProvider'.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Install-Package'.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Install-PackageProvider'.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Register-PackageSource'.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Save-Package'.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Set-PackageSource'.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Uninstall-Package'.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Unregister-PackageSource'.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Importing cmdlet 'Find-Package'.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Importing cmdlet 'Find-PackageProvider'.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Importing cmdlet 'Get-Package'.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Importing cmdlet 'Get-PackageProvider'.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Importing cmdlet 'Get-PackageSource'.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Importing cmdlet 'Import-PackageProvider'.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Importing cmdlet 'Install-Package'.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Importing cmdlet 'Install-PackageProvider'.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Importing cmdlet 'Register-PackageSource'.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Importing cmdlet 'Save-Package'.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Importing cmdlet 'Set-PackageSource'.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Importing cmdlet 'Uninstall-Package'.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Importing cmdlet 'Unregister-PackageSource'.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] The repository 'TestRepo' was not found.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Repository 'TestRepo' is not in the desired state.
VERBOSE: [Testserver]: LCM:  [ End    Test     ]  [[PSRepository]AddRepository]  in 3.8910 seconds.
VERBOSE: [Testserver]: LCM:  [ Start  Set      ]  [[PSRepository]AddRepository]
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Return the current state of the repository 'TestRepo'.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] The repository 'TestRepo' was not found.
VERBOSE: [Testserver]:                            [[PSRepository]AddRepository] Creating the repository 'TestRepo'.
VERBOSE: [Testserver]: LCM:  [ End    Set      ]  [[PSRepository]AddRepository]  in 3.2560 seconds.
PowerShell DSC resource MSFT_PSRepository  failed to execute Set-TargetResource functionality with error message: The running command stopped because the preference variable 
"ErrorActionPreference" or common parameter is set to Stop: The property 'Name' cannot be found on this object. Verify that the property exists. 
    + CategoryInfo          : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : ProviderOperationExecutionFailure
    + PSComputerName        : localhost

VERBOSE: [Testserver]: LCM:  [ End    Set      ]
The SendConfigurationApply function did not succeed.
    + CategoryInfo          : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException
    + FullyQualifiedErrorId : MI RESULT 1
    + PSComputerName        : localhost

VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 133.591 seconds

Environment data

> $PSVersionTable
PS C:\Windows\system32> $PSVersionTable

Name                           Value                                                                                                                                                     
----                           -----                                                                                                                                                     
PSVersion                      5.1.17763.592                                                                                                                                             
PSEdition                      Desktop                                                                                                                                                   
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                                   
BuildVersion                   10.0.17763.592                                                                                                                                            
CLRVersion                     4.0.30319.42000                                                                                                                                           
WSManStackVersion              3.0                                                                                                                                                       
PSRemotingProtocolVersion      2.3                                                                                                                                                       
SerializationVersion           1.1.0.1       
> Get-Module -ListAvailable PowerShellGet,PackageManagement
PS C:\Windows\system32> Get-Module -ListAvailable PowerShellGet,PackageManagement

    Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    Name                                ExportedCommands                                                                                                               
---------- -------    ----                                ----------------                                                                                                               
Script     1.4.3      PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}                                                         
Binary     1.0.0.1    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}                                                         
Script     2.2        powershellget                       {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability...}      
> Get-PackageProvider -ListAvailable
PS C:\Windows\system32>  Get-PackageProvider -ListAvailable
WARNING: MSG:UnableToDownload «https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409» «»
WARNING: Unable to download the list of available providers. Check your internet connection.

Name                     Version          DynamicOptions                                                                                                                                 
----                     -------          --------------                                                                                                                                 
msi                      3.0.0.0          AdditionalArguments                                                                                                                            
msu                      3.0.0.0                                                                                                                                                         
nuget                    2.8.5.208                                                                                                                                                       
NuGet                    3.0.0.1          Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag, Contains, AllowPrereleaseVersions, ConfigFile, SkipValidate        
PowerShellGet            2.2.0.0          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, AllowPrereleaseVersions, Filter, Tag,...
Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent 
SydneyhSmith commented 5 years ago

@Outek thanks for opening this issue...we are having some trouble reproducing it...could you please provide the full error message by piping the output $Error[0] | Format-List * -Force

Outek commented 5 years ago
writeErrorStream      : True
PSMessageDetails      : 
OriginInfo            : localhost
Exception             : Microsoft.Management.Infrastructure.CimException: The SendConfigurationApply function did not succeed.
                           at Microsoft.Management.Infrastructure.Internal.Operations.CimAsyncObserverProxyBase`1.ProcessNativeCallback(OperationCallbackProcessingContext callbackProcessingContext, T currentItem, Boolean 
                        moreResults, MiResult operationResult, String errorMessage, InstanceHandle errorDetailsHandle)
TargetObject          : root/Microsoft/Windows/DesiredStateConfiguration:MSFT_DSCLocalConfigurationManager
CategoryInfo          : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException
FullyQualifiedErrorId : MI RESULT 1
ErrorDetails          : 
InvocationInfo        : 
ScriptStackTrace      : 
PipelineIterationInfo : {}
Outek commented 5 years ago

Is this maybe a problem with a provider or something like this? I tried everything from without luck, With our current configuration, we cannot deploy new Powershell modules.

I altered the current PowershellGet Module to use this line: https://github.com/PowerShell/PowerShellGet/blob/development/DSC/DscResources/MSFT_PSRepository/MSFT_PSRepository.psm1#L297

with this:


Register-PSRepository -Name 'TestRepo' -SourceLocation 'https://<validreponame>/' -InstallationPolicy 'Trusted' -PackageManagementProvider 'NuGet' -Verbose

Without any luck.. if i execute this exact line in a shell, everything is working correctly.

VERBOSE: Performing the operation "Register Module Repository." on target "Module Repository 'TestRepo' (https://<validreponame>) in provider 'PowerShellGet'.".
VERBOSE: The specified PackageManagement provider name 'NuGet'.
VERBOSE: Successfully registered the repository 'TestRepo' with source location 'https://<validreponame>/'.
VERBOSE: Repository details, Name = 'TestRepo', Location = 'https://repo.pnet.ch/artifactory/api/nuget/windows-powershellgallery-local'; IsTrusted = 'True'; IsRegistered = 'True'.

Maybe a Nuget feed from Artifactory is the problem?

gaelcolas commented 5 years ago

Hey @Outek, I've seen authentication issues previously (ProGet) when doing this as System, because the Computer account needs to authenticate to the feed's server (which, iirc, is not straight forward with say IIS & Windows Auth).

Can you also share the content of the Generated MOF, just to be sure? Also, maybe @johlju has seen this before?

Outek commented 5 years ago
/*
@TargetNode='localhost'
@GeneratedBy=<username>
@GenerationDate=09/11/2019 10:55:33
@GenerationHost=<hostname>
*/

instance of MSFT_PSRepository as $MSFT_PSRepository1ref
{
ResourceID = "[PSRepository]AddRepository";
 InstallationPolicy = "Trusted";
 SourceInfo = "C:\\Temp\\PSRepo.ps1::18::9::PSRepository";
 Name = "TestRepo";
 ModuleName = "PowerShellGet";
 SourceLocation = "https://<reponame>";
 ModuleVersion = "2.1.2";

 ConfigurationName = "PSRepository_AddRepositoryConfig";

};
instance of OMI_ConfigurationDocument

                    {
 Version="2.0.0";

                        MinimumCompatibleVersion = "1.0.0";

                        CompatibleVersionAdditionalProperties= {"Omi_BaseResource:ConfigurationName"};

                        Author="<username>";

                        GenerationDate="09/11/2019 10:55:33";

                        GenerationHost="<hostname>";

                        Name="PSRepository_AddRepositoryConfig";

                    };
Outek commented 5 years ago

If the problem is the authentication, i think this is the same problem #534

gaelcolas commented 5 years ago

Well, could be but I wonder if it's because of what I mentioned. You said it's working when running in a Shell. Could you also try the DSC Resource using PSDscRunAsCredential, using your user account?

Then for the error, it's not very convenient in DSC so try something like $Error[0..5] | FL *, pretty please ;)

Outek commented 5 years ago

This is the output with my user Credentials..

$Error[0] | Format-List * -Force

PSMessageDetails      : 
Exception             : System.Management.Automation.ItemNotFoundException: Cannot find path 'HKLM:\SOFTWARE\Microsoft\PowerShell\3\DSC' because it does not exist.
                           at System.Management.Automation.LocationGlobber.ExpandMshGlobPath(String path, Boolean allowNonexistingPaths, PSDriveInfo drive, ContainerCmdletProvider provider, CmdletProviderContext context)
                           at System.Management.Automation.LocationGlobber.ResolveDriveQualifiedPath(String path, CmdletProviderContext context, Boolean allowNonexistingPaths, CmdletProvider& providerInstance)
                           at System.Management.Automation.LocationGlobber.GetGlobbedMonadPathsFromMonadPath(String path, Boolean allowNonexistingPaths, CmdletProviderContext context, CmdletProvider& providerInstance)
                           at System.Management.Automation.LocationGlobber.GetGlobbedProviderPathsFromMonadPath(String path, Boolean allowNonexistingPaths, CmdletProviderContext context, ProviderInfo& provider, 
                        CmdletProvider& providerInstance)
                           at System.Management.Automation.SessionStateInternal.GetProperty(String[] paths, Collection`1 providerSpecificPickList, CmdletProviderContext context)
                           at Microsoft.PowerShell.Commands.GetItemPropertyCommand.ProcessRecord()
TargetObject          : HKLM:\SOFTWARE\Microsoft\PowerShell\3\DSC
CategoryInfo          : ObjectNotFound: (HKLM:\SOFTWARE\...owerShell\3\DSC:String) [Get-ItemProperty], ItemNotFoundException
FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemPropertyCommand
ErrorDetails          : 
InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : at ConvertTo-MOFInstance, C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\PSDesiredStateConfiguration.psm1: line 614
                        at <ScriptBlock>, <No file>: line 341
                        at <ScriptBlock>, C:\Temp\PSRepo.ps1: line 21
                        at Node, C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\PSDesiredStateConfiguration.psm1: line 1026
                        at <ScriptBlock>, C:\Temp\PSRepo.ps1: line 19
                        at Configuration, C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\PSDesiredStateConfiguration.psm1: line 2232
                        at <ScriptBlock>, C:\Temp\PSRepo.ps1: line 5
                        at <ScriptBlock>, C:\Temp\PSRepo.ps1: line 41
PipelineIterationInfo : {0, 1}

$Error[0..5] | FL *

Get-ItemProperty : Cannot find path 'HKLM:\SOFTWARE\Microsoft\PowerShell\3\DSC' because it does not exist.
At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\PSDesiredStateConfiguration.psm1:614 char:32
+ ...      $reg = Get-ItemProperty -path $key -name "PSDscAllowDomainUser"  ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (HKLM:\SOFTWARE\...owerShell\3\DSC:String) [Get-ItemProperty], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemPropertyCommand

Get-ItemProperty : Cannot find path 'HKLM:\SOFTWARE\Microsoft\PowerShell\3\DSC' because it does not exist.
At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\PSDesiredStateConfiguration.psm1:607 char:32
+ ...      $reg = Get-ItemProperty -path $key -name "PSDscAllowPlainTextPas ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (HKLM:\SOFTWARE\...owerShell\3\DSC:String) [Get-ItemProperty], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemPropertyCommand

Get-ItemProperty : Cannot find path 'HKLM:\SOFTWARE\Microsoft\PowerShell\3\DSC' because it does not exist.
At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\PSDesiredStateConfiguration.psm1:614 char:32
+ ...      $reg = Get-ItemProperty -path $key -name "PSDscAllowDomainUser"  ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (HKLM:\SOFTWARE\...owerShell\3\DSC:String) [Get-ItemProperty], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemPropertyCommand

Get-ItemProperty : Cannot find path 'HKLM:\SOFTWARE\Microsoft\PowerShell\3\DSC' because it does not exist.
At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\PSDesiredStateConfiguration.psm1:607 char:32
+ ...      $reg = Get-ItemProperty -path $key -name "PSDscAllowPlainTextPas ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (HKLM:\SOFTWARE\...owerShell\3\DSC:String) [Get-ItemProperty], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemPropertyCommand

Microsoft.PowerShell.Core\Get-Command : The term 'NuGet.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the 
path is correct and try again.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.1\PSModule.psm1:12810 char:25
+ ... $nugetCmd = Microsoft.PowerShell.Core\Get-Command -Name $script:NuGet ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (NuGet.exe:String) [Get-Command], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand

Microsoft.PowerShell.Core\Get-Command : The term 'NuGet.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the 
path is correct and try again.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.1\PSModule.psm1:11530 char:21
+ ... $nugetCmd = Microsoft.PowerShell.Core\Get-Command -Name $script:NuGet ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (NuGet.exe:String) [Get-Command], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand
VERBOSE: An LCM method call arrived from computer <servername> with user sid <some sid>.
VERBOSE: [<servername>]: LCM:  [ Start  Set      ]
VERBOSE: [<servername>]: LCM:  [ Start  Resource ]  [[PSRepository]AddRepository]
VERBOSE: [<servername>]: LCM:  [ Start  Test     ]  [[PSRepository]AddRepository]
VERBOSE: [<servername>]:                            [[PSRepository]AddRepository] Determining if the repository 'TestRepo' is in the desired state.
VERBOSE: [<servername>]:                            [[PSRepository]AddRepository] Return the current state of the repository 'TestRepo'.
VERBOSE: [<servername>]:                            [[PSRepository]AddRepository] Populating RepositorySourceLocation property for module PackageManagement.
VERBOSE: [<servername>]:                            [[PSRepository]AddRepository] Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\PackageManagement\1.4.4\PackageManagement.psm1'.
VERBOSE: [<servername>]:                            [[PSRepository]AddRepository] Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\PackageManagement\1.4.4\PackageManagement.psd1'.
VERBOSE: [<servername>]:                            [[PSRepository]AddRepository] Loading 'FormatsToProcess' from path 'C:\Program Files\WindowsPowerShell\Modules\PackageManagement\1.4.4\PackageManagement.format.ps1xml'.
VERBOSE: [<servername>]:                            [[PSRepository]AddRepository] Populating RepositorySourceLocation property for module PackageManagement.
VERBOSE: [<servername>]:                            [[PSRepository]AddRepository] Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\PackageManagement\1.4.4\PackageManagement.psm1'.
VERBOSE: [<servername>]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Find-Package'.
VERBOSE: [<servername>]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Find-PackageProvider'.
VERBOSE: [<servername>]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Get-Package'.
VERBOSE: [<servername>]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Get-PackageProvider'.
VERBOSE: [<servername>]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Get-PackageSource'.
VERBOSE: [<servername>]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Import-PackageProvider'.
VERBOSE: [<servername>]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Install-Package'.
VERBOSE: [<servername>]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Install-PackageProvider'.
VERBOSE: [<servername>]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Register-PackageSource'.
VERBOSE: [<servername>]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Save-Package'.
VERBOSE: [<servername>]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Set-PackageSource'.
VERBOSE: [<servername>]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Uninstall-Package'.
VERBOSE: [<servername>]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Unregister-PackageSource'.
VERBOSE: [<servername>]:                            [[PSRepository]AddRepository] Importing cmdlet 'Find-Package'.
VERBOSE: [<servername>]:                            [[PSRepository]AddRepository] Importing cmdlet 'Find-PackageProvider'.
VERBOSE: [<servername>]:                            [[PSRepository]AddRepository] Importing cmdlet 'Get-Package'.
VERBOSE: [<servername>]:                            [[PSRepository]AddRepository] Importing cmdlet 'Get-PackageProvider'.
VERBOSE: [<servername>]:                            [[PSRepository]AddRepository] Importing cmdlet 'Get-PackageSource'.
VERBOSE: [<servername>]:                            [[PSRepository]AddRepository] Importing cmdlet 'Import-PackageProvider'.
VERBOSE: [<servername>]:                            [[PSRepository]AddRepository] Importing cmdlet 'Install-Package'.
VERBOSE: [<servername>]:                            [[PSRepository]AddRepository] Importing cmdlet 'Install-PackageProvider'.
VERBOSE: [<servername>]:                            [[PSRepository]AddRepository] Importing cmdlet 'Register-PackageSource'.
VERBOSE: [<servername>]:                            [[PSRepository]AddRepository] Importing cmdlet 'Save-Package'.
VERBOSE: [<servername>]:                            [[PSRepository]AddRepository] Importing cmdlet 'Set-PackageSource'.
VERBOSE: [<servername>]:                            [[PSRepository]AddRepository] Importing cmdlet 'Uninstall-Package'.
VERBOSE: [<servername>]:                            [[PSRepository]AddRepository] Importing cmdlet 'Unregister-PackageSource'.
WARNING: [<servername>]:                            [[PSRepository]AddRepository] MSG:UnableToDownload «https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409» «»
WARNING: [<servername>]:                            [[PSRepository]AddRepository] Unable to download the list of available providers. Check your internet connection.
VERBOSE: [<servername>]:                            [[PSRepository]AddRepository] Repository 'TestRepo' is in the desired state.
VERBOSE: [<servername>]: LCM:  [ End    Test     ]  [[PSRepository]AddRepository]  in 6.8420 seconds.
VERBOSE: [<servername>]: LCM:  [ Skip   Set      ]  [[PSRepository]AddRepository]
VERBOSE: [<servername>]: LCM:  [ End    Resource ]  [[PSRepository]AddRepository]
VERBOSE: [<servername>]: LCM:  [ End    Set      ]
VERBOSE: [<servername>]: LCM:  [ End    Set      ]    in  7.2700 seconds.
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 8.286 seconds

But there is no Repo...

Outek commented 4 years ago

I did a lot of testing, remodeling the Dsc Resources for PowerShellGet, but still i get this error. Even with Credentials, i'm not able to configure PSRepository with Dsc. I took out the Set-TargetResource and run it in a shell with or without admin privs, everything is working. As soon i try to run it with Dsc(even with Credentials) the error is there.


<#
    .SYNOPSIS
        Creates, removes or updates the repository.

    .PARAMETER Ensure
        If the repository should be present or absent on the server
        being configured. Default values is 'Present'.

    .PARAMETER Name
        Specifies the name of the repository to manage.

    .PARAMETER SourceLocation
        Specifies the URI for discovering and installing modules from
        this repository. A URI can be a NuGet server feed, HTTP, HTTPS,
        FTP or file location.

    .PARAMETER ScriptSourceLocation
        Specifies the URI for the script source location.

    .PARAMETER PublishLocation
        Specifies the URI of the publish location. For example, for
        NuGet-based repositories, the publish location is similar
        to http://someNuGetUrl.com/api/v2/Packages.

    .PARAMETER ScriptPublishLocation
        Specifies the URI for the script publish location.

    .PARAMETER InstallationPolicy
        Specifies the installation policy. Valid values are  'Trusted'
        or 'Untrusted'. The default value is 'Untrusted'.

    .PARAMETER PackageManagementProvider
        Specifies a OneGet package provider. Default value is 'NuGet'.
#>
function Set-TargetResource {
    [CmdletBinding()]
    param
    (
        [Parameter()]
        [ValidateSet('Present', 'Absent')]
        [System.String]
        $Ensure = 'Present',

        [Parameter(Mandatory = $true)]
        [System.String]
        $Name,

        [Parameter()]
        [System.String]
        $SourceLocation,

        [Parameter()]
        [System.String]
        $ScriptSourceLocation,

        [Parameter()]
        [System.String]
        $PublishLocation,

        [Parameter()]
        [System.String]
        $ScriptPublishLocation,

        [Parameter()]
        [ValidateSet('Trusted', 'Untrusted')]
        [System.String]
        $InstallationPolicy = 'Untrusted',

        [Parameter()]
        [System.String]
        $PackageManagementProvider = 'NuGet'
    )

    $null = $PSBoundParameters.Remove('Ensure')
    $getTargetResourceResult = Get-PSRepository -Name $Name -ErrorAction SilentlyContinue

    # Determine if the repository should be present or absent.
    if ($Ensure -eq 'Present') {
        # Determine if the repository is already present.
        if ($getTargetResourceResult) {
            Write-Verbose -Message ($localizedData.RepositoryExist -f $Name)
            # Repository exist, update the properties.
            $null = Set-PSRepository @PSBoundParameters -ErrorAction 'Stop'
        }
        else {
            Write-Verbose -Message ($localizedData.RepositoryDoesNotExist -f $Name)
            # Repository did not exist, create the repository.
            $null = Register-PSRepository @PSBoundParameters
        }
    }

    if ($Ensure -eq 'Absent') {
        Write-Verbose -Message ($localizedData.RemoveExistingRepository -f $Name)
        # Repository did exist, remove the repository.
        $null = Unregister-PSRepository @PSBoundParameters -ErrorAction 'Stop'
    }
}

# Register Repo
Set-TargetResource -Name "TestRepo" -SourceLocation '<ValidNuGetFeedfromArtifactory>' -Ensure Present -InstallationPolicy Trusted
Get-PSRepository -Name "TestRepo"
$Present = Get-PSRepository -Name "TestRepo" -ErrorAction SilentlyContinue
if($Present) {
    Write-Output "yay, Repo registered"
    Write-Output "$Present"    
}

# Unregister it
Set-TargetResource -Name "TestRepo" -Ensure Absent
$Absent = Get-PSRepository -Name "TestRepo" -ErrorAction SilentlyContinue
if(!($Absent)) {
    Write-Output "yay, Repo unregistered"
    Write-Output "$Absent" 
    Get-PSRepository -Name "TestRepo"
}

PS> PowershellGet_Set-TargetResource.ps1

Name                      InstallationPolicy   SourceLocation                                                                                                                                                                  
----                      ------------------   --------------                                                                                                                                                                  
TestRepo                  Trusted              <ValidNuGetFeedfromArtifactory>                                                                                                      
yay, Repo registered
@{Name=TestRepo; SourceLocation=<ValidNuGetFeedfromArtifactory>; Trusted=True; Registered=True; InstallationPolicy=Trusted; PackageManagementProvider=NuGet; PublishLocation=; ScriptS
ourceLocation=; ScriptPublishLocation=; ProviderOptions=System.Collections.Hashtable}
yay, Repo unregistered

PackageManagement\Get-PackageSource : Unable to find repository 'TestRepo'. Use Get-PSRepository to see all available repositories.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.1\PSModule.psm1:9509 char:35
+ ... ckageSources = PackageManagement\Get-PackageSource @PSBoundParameters
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...etPackageSource:GetPackageSource) [Get-PackageSource], Exception
    + FullyQualifiedErrorId : SourceNotFound,Microsoft.PowerShell.PackageManagement.Cmdlets.GetPackageSource

VERBOSE: An LCM method call arrived from computer Servername with user sid S-<somesid>.
VERBOSE: [Servername]: LCM:  [ Start  Set      ]
VERBOSE: [Servername]: LCM:  [ Start  Resource ]  [[PSRepository]AddRepository]
VERBOSE: [Servername]: LCM:  [ Start  Test     ]  [[PSRepository]AddRepository]
VERBOSE: [Servername]:                            [[PSRepository]AddRepository] Determining if the repository 'TestRepo' is in the desired state.
VERBOSE: [Servername]:                            [[PSRepository]AddRepository] Populating RepositorySourceLocation property for module PackageManagement.
VERBOSE: [Servername]:                            [[PSRepository]AddRepository] Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\PackageManagement\1.4.4\PackageManagement.psm1'.
VERBOSE: [Servername]:                            [[PSRepository]AddRepository] Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\PackageManagement\1.4.4\PackageManagement.psd1'.
VERBOSE: [Servername]:                            [[PSRepository]AddRepository] Loading 'FormatsToProcess' from path 'C:\Program Files\WindowsPowerShell\Modules\PackageManagement\1.4.4\PackageManagement.format.ps1xml'.
VERBOSE: [Servername]:                            [[PSRepository]AddRepository] Populating RepositorySourceLocation property for module PackageManagement.
VERBOSE: [Servername]:                            [[PSRepository]AddRepository] Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\PackageManagement\1.4.4\PackageManagement.psm1'.
VERBOSE: [Servername]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Find-Package'.
VERBOSE: [Servername]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Find-PackageProvider'.
VERBOSE: [Servername]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Get-Package'.
VERBOSE: [Servername]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Get-PackageProvider'.
VERBOSE: [Servername]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Get-PackageSource'.
VERBOSE: [Servername]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Import-PackageProvider'.
VERBOSE: [Servername]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Install-Package'.
VERBOSE: [Servername]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Install-PackageProvider'.
VERBOSE: [Servername]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Register-PackageSource'.
VERBOSE: [Servername]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Save-Package'.
VERBOSE: [Servername]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Set-PackageSource'.
VERBOSE: [Servername]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Uninstall-Package'.
VERBOSE: [Servername]:                            [[PSRepository]AddRepository] Exporting cmdlet 'Unregister-PackageSource'.
VERBOSE: [Servername]:                            [[PSRepository]AddRepository] Importing cmdlet 'Find-Package'.
VERBOSE: [Servername]:                            [[PSRepository]AddRepository] Importing cmdlet 'Find-PackageProvider'.
VERBOSE: [Servername]:                            [[PSRepository]AddRepository] Importing cmdlet 'Get-Package'.
VERBOSE: [Servername]:                            [[PSRepository]AddRepository] Importing cmdlet 'Get-PackageProvider'.
VERBOSE: [Servername]:                            [[PSRepository]AddRepository] Importing cmdlet 'Get-PackageSource'.
VERBOSE: [Servername]:                            [[PSRepository]AddRepository] Importing cmdlet 'Import-PackageProvider'.
VERBOSE: [Servername]:                            [[PSRepository]AddRepository] Importing cmdlet 'Install-Package'.
VERBOSE: [Servername]:                            [[PSRepository]AddRepository] Importing cmdlet 'Install-PackageProvider'.
VERBOSE: [Servername]:                            [[PSRepository]AddRepository] Importing cmdlet 'Register-PackageSource'.
VERBOSE: [Servername]:                            [[PSRepository]AddRepository] Importing cmdlet 'Save-Package'.
VERBOSE: [Servername]:                            [[PSRepository]AddRepository] Importing cmdlet 'Set-PackageSource'.
VERBOSE: [Servername]:                            [[PSRepository]AddRepository] Importing cmdlet 'Uninstall-Package'.
VERBOSE: [Servername]:                            [[PSRepository]AddRepository] Importing cmdlet 'Unregister-PackageSource'.
VERBOSE: [Servername]:                            [[PSRepository]AddRepository] Repository 'TestRepo' is not in the desired state.
VERBOSE: [Servername]: LCM:  [ End    Test     ]  [[PSRepository]AddRepository]  in 3.8530 seconds.
VERBOSE: [Servername]: LCM:  [ Start  Set      ]  [[PSRepository]AddRepository]
VERBOSE: [Servername]:                            [[PSRepository]AddRepository] Creating the repository 'TestRepo'.
The property 'Name' cannot be found on this object. Verify that the property exists.
johlju commented 4 years ago

@Outek Adding your example in the issue description to a integration tests does not generate this issue.

configuration MSFT_PSRepository_AddRepository_TestRepo_Config
{
    Import-DscResource -ModuleName 'PowerShellGet'

    Node $AllNodes.NodeName
    {
        PSRepository 'Integration_Test'
        {
            Name                  = 'TestRepo'
            SourceLocation        = $Node.TestSourceLocation
            InstallationPolicy    = 'Trusted'
        }
    }
}
    Context When using configuration MSFT_PSRepository_AddRepository_TestRepo_Config
The 'Microsoft.PowerShell.Management' module was not imported because the 'Microsoft.PowerShell.Management' snap-in was already imported.
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer APPVYR-WIN with user sid S-1-5-21-1930758936-441951309-2831684283-1000.
VERBOSE: [APPVYR-WIN]: LCM:  [ Start  Set      ]
VERBOSE: [APPVYR-WIN]: LCM:  [ Start  Resource ]  [[PSRepository]Integration_Test]
VERBOSE: [APPVYR-WIN]: LCM:  [ Start  Test     ]  [[PSRepository]Integration_Test]
VERBOSE: [APPVYR-WIN]:                            [[PSRepository]Integration_Test] Determining if the repository 'TestRepo' is in the desired state.
VERBOSE: [APPVYR-WIN]:                            [[PSRepository]Integration_Test] Return the current state of the repository 'TestRepo'.
VERBOSE: [APPVYR-WIN]:                            [[PSRepository]Integration_Test] The repository 'TestRepo' was not found.
VERBOSE: [APPVYR-WIN]:                            [[PSRepository]Integration_Test] Repository 'TestRepo' is not in the desired state.
VERBOSE: [APPVYR-WIN]: LCM:  [ End    Test     ]  [[PSRepository]Integration_Test]  in 0.0150 seconds.
VERBOSE: [APPVYR-WIN]: LCM:  [ Start  Set      ]  [[PSRepository]Integration_Test]
VERBOSE: [APPVYR-WIN]:                            [[PSRepository]Integration_Test] Return the current state of the repository 'TestRepo'.
VERBOSE: [APPVYR-WIN]:                            [[PSRepository]Integration_Test] The repository 'TestRepo' was not found.
VERBOSE: [APPVYR-WIN]:                            [[PSRepository]Integration_Test] Creating the repository 'TestRepo'.
VERBOSE: [APPVYR-WIN]: LCM:  [ End    Set      ]  [[PSRepository]Integration_Test]  in 2.2810 seconds.
VERBOSE: [APPVYR-WIN]: LCM:  [ End    Resource ]  [[PSRepository]Integration_Test]
VERBOSE: [APPVYR-WIN]: LCM:  [ End    Set      ]
VERBOSE: [APPVYR-WIN]: LCM:  [ End    Set      ]    in  2.3430 seconds.
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 2.364 seconds
      [+] Should compile and apply the MOF without throwing 2.72s
VERBOSE: An LCM method call arrived from computer APPVYR-WIN with user sid S-1-5-21-1930758936-441951309-2831684283-1000.
VERBOSE: [APPVYR-WIN]: LCM:  [ Start  Get      ]      
VERBOSE: [APPVYR-WIN]:                            [[PSRepository]Integration_Test] Return the current state of the repository 'TestRepo'.
VERBOSE: [APPVYR-WIN]: LCM:  [ End    Get      ]  [[PSRepository]Integration_Test]  in 0.0450 seconds.
VERBOSE: [APPVYR-WIN]: LCM:  [ End    Get      ]    in  0.0890 seconds.
      [+] Should be able to call Get-DscConfiguration without throwing 137ms
      [+] Should have set the resource and all the parameters should match 62ms
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = TestConfiguration,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer APPVYR-WIN with user sid S-1-5-21-1930758936-441951309-2831684283-1000.
VERBOSE: [APPVYR-WIN]: LCM:  [ Start  Test     ]
VERBOSE: [APPVYR-WIN]: LCM:  [ Start  Resource ]  [[PSRepository]Integration_Test]
VERBOSE: [APPVYR-WIN]: LCM:  [ Start  Test     ]  [[PSRepository]Integration_Test]
VERBOSE: [APPVYR-WIN]:                            [[PSRepository]Integration_Test] Determining if the repository 'TestRepo' is in the desired state.
VERBOSE: [APPVYR-WIN]:                            [[PSRepository]Integration_Test] Return the current state of the repository 'TestRepo'.
VERBOSE: [APPVYR-WIN]:                            [[PSRepository]Integration_Test] Repository 'TestRepo' is in the desired state.
VERBOSE: [APPVYR-WIN]: LCM:  [ End    Test     ]  [[PSRepository]Integration_Test] True in 0.0520 seconds.
VERBOSE: [APPVYR-WIN]: LCM:  [ End    Resource ]  [[PSRepository]Integration_Test]
VERBOSE: [APPVYR-WIN]: LCM:  [ End    Test     ]     Completed processing test operation. The operation returned True.
VERBOSE: [APPVYR-WIN]: LCM:  [ End    Test     ]    in  0.0950 seconds.
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 0.114 seconds
      [+] Should return $true when Test-DscConfiguration is run 154ms
johlju commented 4 years ago

Where you are seeing this issue, is it using the correct version of PowerShellGet? So it does not load older version for another user or something. Just guessing here. 🤔

alex-titarenko commented 3 years ago

Hi guys, any updates? We have the same issue. It reproducible only with DSC and only on some machines.

johlju commented 3 years ago

@alex-titarenko can you reproduce this on one machine? If so it possible for you to figure out what is different from one that do work? Would help if we can figure out what line in the code that throws the error, it might help narrow down what the cause is.,

alex-titarenko commented 3 years ago

bad-state.txt good-state.txt

@johlju thank you for the replay. I attached logs from good and bad VM (sensitive information was replaced).

The main difference in logs I see that in VM when it fails:

PowerShell Script 'PSModule' Function 'Resolve-PackageSource' returns null.
The property 'Name' cannot be found on this object. Verify that the property exists.
    + CategoryInfo          : NotSpecified: (Microsoft.Power...erPackageSource:) [], CimException
    + FullyQualifiedErrorId : PropertyNotFoundStrict,Microsoft.PowerShell.PackageManagement.Cmdlets.RegisterPackageSource
    + PSComputerName        : localhost

And on VM where it works:

[[xPackageManagement]Package]  Done calling powershell «Resolve-PackageSource» «PSModule»

You can compare logs to see more details.

On code side it fails inside our xPackageManagement DSC module when we try Register-PSRepository.

alex-titarenko commented 3 years ago

I did notice, some package version differences on VMs

Good VM:

PS C:\windows\system32> 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, Con...
PowerShellGet            2.2.3.0          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, Insta...
Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent                                   

PS C:\windows\system32> Get-Module PackageManagement

ModuleType Version    Name                                ExportedCommands                                                  
---------- -------    ----                                ----------------                                                  
Script     1.4.6      PackageManagement                   {Find-Package, Find-PackageProvider, Get-Package, Get-PackagePr...

Bad VM:

PS C:\windows\system32> 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, Con...
PowerShellGet            1.0.0.1          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, Insta...
Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent 

PS C:\windows\system32> Get-Module PackageManagement

ModuleType Version    Name                                ExportedCommands                                                  
---------- -------    ----                                ----------------                                                  
Script     1.4.7      PackageManagement                   {Find-Package, Find-PackageProvider, Get-Package, Get-PackagePr...

But, after changing package versions, I did not see any differences in logs. The issue is still there.

alex-titarenko commented 3 years ago

I found the root cause of the issue. The file %localappdata%\Microsoft\windows\PowerShell\PowerShellGet\PSRepositories.xml was in a bad state. After deleting it everything started working.

The issue was reproduceable only with DSC because %localappdata% variable will be resolved to C:\Windows\System32\config\systemprofile\AppData\Local when run through DSC and to you local profile if you run with the shell.

rvigliotti-sf commented 1 year ago

I found the root cause of the issue. The file %localappdata%\Microsoft\windows\PowerShell\PowerShellGet\PSRepositories.xml was in a bad state. After deleting it everything started working.

The issue was reproduceable only with DSC because %localappdata% variable will be resolved to C:\Windows\System32\config\systemprofile\AppData\Local when run through DSC and to you local profile if you run with the shell.

Do you know where this path might be on PowerShell Core for Mac?

Edit, found: /Users/<user>/.cache/powershell/PowerShellGet/ - but deleting PSRepositories.xml didn't fix the issue