Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Install-Module 'PowerShellGet' from an Azure DevOps build pipeline #663

Open
santanor opened this issue Oct 7, 2021 · 7 comments

Comments

@santanor
Copy link

santanor commented Oct 7, 2021

So I'm running a build pipeline in Azure DevOps and one of the steps requires to install various packages, some from PSGallery and some from an internal feed. In order to do that the first thing I do is:

Install-Module 'PowerShellGet' -AllowClobber -RequiredVersion "2.2.5" -Force -Repository 'PSGallery' -SkipPublisherCheck
Install-Module 'PackageManagement' -Force -AllowClobber -RequiredVersion '1.4.3' -Repository 'PSGallery' -SkipPublisherCheck

After that I should be able to install the remaining packages.

The problem is that sometimes, PowerShellGet updates and sometimes it doesn't. Which makes it a pain to debug and determine what works and what doesn't.

I know a bug report should have a deterministic repro step process, but I don't have one. Sometimes it fails and sometimes it doesn't.

I have seen this fail in the past and I've resolved it by simply opening a new PowerShell instance, but that's not possible (Or at least I don't know how to do it) in an Azure DevOps build pipeline.

Steps to reproduce

Install-Module 'PowerShellGet' -AllowClobber -RequiredVersion "2.2.5" -Force -Repository 'PSGallery' -SkipPublisherCheck
Install-Module 'PackageManagement' -Force -AllowClobber -RequiredVersion '1.4.3' -Repository 'PSGallery' -SkipPublisherCheck

if it fails, it fails with the following warning:

WARNING: The version '1.4.7' of module 'PackageManagement' is currently in use. Retry the operation after closing the 
applications.

Expected behavior

After running the install the following code should output "2.2.5" as the version

$module = Get-Module PowerShellGet
Write-Host "PowerShellGet version: "
Write-Host $module.Version.ToString()

Actual behavior

Sometimes it outputs 2.2.5 and sometimes 1.0.0.1. Which means it has failed to update.

@StevenBucher98
Copy link
Collaborator

@santanor thanks for outlining your issue here! Would you be able to provide a little more information on the environment you are using? Specifically, the version of PowerShell, you can run $PSVersionTable and paste the output here just for our reference.

@StevenBucher98
Copy link
Collaborator

Also do you mind running
Install-Module 'PowerShellGet' -AllowClobber -RequiredVersion "2.2.5" -Force -Repository 'PSGallery' -SkipPublisherCheck -Debug -Verbose
and including the output.

Is there a particular reason you need to install PackageManagement 1.4.3? You also do not need to install PackageManagemnt because PowerShellGet installs it. This might be causing your issue because you are installing a lower version of PackageManagement than what is required on PowerShellGet (PackageManagment 1.4.7).

@santanor
Copy link
Author

Hi @StevenBucher98, the environment is defined here
https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/powershell

Running $PSVersionTable outputs the following information

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

Is there a particular reason you need to install PackageManagement 1.4.3?

I'm not sure, I inherited this script so I'm cautious about making changes. Didn't know I didn't need it.

So I removed the explicit installation of PackageManagement and tried to run only Install-Module 'PowerShellGet' -AllowClobber -RequiredVersion "2.2.5" -Force -Repository 'PSGallery' -SkipPublisherCheck -Debug -Verbose

It failed with the following output (Sorry, it's quite long)


'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=80&$top=40'.
DEBUG: 00:00:00.7365119 Completed downloading 
'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=40&$top=40'.
DEBUG: 00:00:00.7403986 '27' packages received in the last request.
DEBUG: 00:00:00.7678082 Completed downloading 
'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=160&$top=40'.
DEBUG: 00:00:00.7691139 '0' packages received in the last request.
DEBUG: 00:00:00.8493214 Completed downloading 
'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=120&$top=40'.
DEBUG: 00:00:00.8507191 '0' packages received in the last request.
DEBUG: 00:00:00.9136121 Completed downloading 
'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=80&$top=40'.
DEBUG: 00:00:00.9149540 '0' packages received in the last request.
VERBOSE: Total package yield:'1' for the specified package 'PowerShellGet'.
DEBUG: 00:00:00.9175560 Completed iterating for 'PowerShellGet'.
DEBUG: 00:00:01.0978328 Done calling powershell «Find-Package» «PSModule»
DEBUG: 00:00:01.1209438 Calling New() : MethodName = 'GetInstalledPackages'
DEBUG: 00:00:01.1221484 SkipPublisherCheck: True
DEBUG: 00:00:01.1229892 ProviderName: PowerShellGet
DEBUG: 00:00:01.1238275 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:01.1246763 RequiredVersion: 2.2.5
DEBUG: 00:00:01.1255074 Source: PSGallery
DEBUG: 00:00:01.1263344 AllowClobber: True
DEBUG: 00:00:01.1271587 Force: True
DEBUG: 00:00:01.1279869 Debug: True
DEBUG: 00:00:01.1287135 Scope: AllUsers
DEBUG: 00:00:01.1294122 Verbose: True
DEBUG: 00:00:01.1300991 Type: Module
DEBUG: 00:00:01.1307833 Name: PowerShellGet
DEBUG: 00:00:01.1318035 INVOKING PowerShell Fn Get-InstalledPackage with args PowerShellGet, 2.2.5, ,  that has length 
4
DEBUG: 00:00:01.1415317 In PowerShellGet Provider - 'Get-InstalledPackage'.
DEBUG: 00:00:01.1425397 OPTION: SkipPublisherCheck => True
DEBUG: 00:00:01.1433507 OPTION: ProviderName => PowerShellGet
DEBUG: 00:00:01.1441512 OPTION: MessageResolver => Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:01.1449476 OPTION: RequiredVersion => 2.2.5
DEBUG: 00:00:01.1457317 OPTION: Source => PSGallery
DEBUG: 00:00:01.1465230 OPTION: AllowClobber => True
DEBUG: 00:00:01.1473053 OPTION: Force => True
DEBUG: 00:00:01.1481583 OPTION: Debug => True
DEBUG: 00:00:01.1489707 OPTION: Scope => AllUsers
DEBUG: 00:00:01.1497621 OPTION: Verbose => True
DEBUG: 00:00:01.1505479 OPTION: Type => Module
DEBUG: 00:00:01.1513315 OPTION: Name => PowerShellGet
DEBUG: 00:00:01.2754269 PowerShell Script 'PSModule' Function 'Get-InstalledPackage' returns null.
DEBUG: 00:00:01.2767131 Done calling powershell «Get-InstalledPackage» «PSModule»

It has failed because getting the version with Get-Module PowerShellGet outputs 1.0.0.1 instead of 2.2.5

Let me know if you need any more info
Thanks for looking into this

@StevenBucher98
Copy link
Collaborator

Thanks @santanor for the outputs! Do you mind confirming that PowerShellGet 2.2.5 has been installed by running
Get-Module PowerShellGet - ListAvailable

If you do see it in the list then you can try importing that specific version into your PS Session by running
Import-Module PowerShellGet -Version "2.2.5"

Then try Get-Module PowerShellGet - ListAvailable and can double check with (Get-command find-module).Module that both indicate that PowerShellGet v2.2.5 is installed and being utilized.

@StevenBucher98
Copy link
Collaborator

StevenBucher98 commented Oct 12, 2021

Also the Get-Module command only shows what is imported in your current PS Session. Using Get-Module PowerShellGet -ListAvailable is a better way to check if a particular module is installed.

@PJBowron
Copy link

Hi @StevenBucher98 - I've been following up on this today while @santanor is busy elsewhere.
I've modified our script to try out some of your suggestions:

Install-Module 'PowerShellGet' -AllowClobber -RequiredVersion "2.2.5" -Force -Repository 'PSGallery' -SkipPublisherCheck -Debug -Verbose

Write-Host "Available PowerShellGet versions: "
Get-Module PowerShellGet -ListAvailable

Write-Host "Trying import of v2.2.5"
Import-Module PowerShellGet -Version "2.2.5"
Write-Host "Available PowerShellGet versions: "
Get-Module PowerShellGet -ListAvailable

This now generates the following output:

2021-10-13T20:12:17.5314389Z Begin installation of PowerShellGet: 
2021-10-13T20:12:25.8664889Z DEBUG: 00:00:00.0000003 Calling New() : MethodName = 'ResolvePackageSources'
2021-10-13T20:12:25.8670510Z DEBUG: 00:00:00.0000252 Verbose: False
2021-10-13T20:12:25.8675223Z DEBUG: 00:00:00.0000347 Name: PSGallery
2021-10-13T20:12:25.8679953Z DEBUG: 00:00:00.0000449 ErrorVariable: ev
2021-10-13T20:12:25.8688469Z DEBUG: 00:00:00.0009143 INVOKING PowerShell Fn Resolve-PackageSource with args  that has length 0
2021-10-13T20:12:25.8694500Z DEBUG: 00:00:00.0017209 In PowerShellGet Provider - 'Resolve-PackageSource'.
2021-10-13T20:12:25.8702197Z DEBUG: 00:00:00.0066024 Yielding packge source for PSGallery at location https://www.powershellgallery.com/api/v2
2021-10-13T20:12:25.8709244Z DEBUG: 00:00:00.0074539 Done calling powershell «Resolve-PackageSource» «PSModule»
2021-10-13T20:12:25.8715803Z DEBUG: 00:00:00.0103477 Calling New() : MethodName = 'GetDynamicOptions'
2021-10-13T20:12:25.8720385Z DEBUG: 00:00:00.0103638 Verbose: False
2021-10-13T20:12:25.8725118Z DEBUG: 00:00:00.0103742 Name: PSGallery
2021-10-13T20:12:25.8729839Z DEBUG: 00:00:00.0103828 ErrorVariable: ev
2021-10-13T20:12:25.8738744Z DEBUG: 00:00:00.0110178 INVOKING PowerShell Fn Get-DynamicOptions with args Provider that has length 1
2021-10-13T20:12:25.8744739Z DEBUG: 00:00:00.0116918 In PowerShellGet Provider - 'Get-DynamicOptions'.
2021-10-13T20:12:25.8751230Z DEBUG: 00:00:00.0127361 Done calling powershell «Get-DynamicOptions» «PSModule»
2021-10-13T20:12:25.8758042Z DEBUG: 00:00:00.0153944 Calling New() : MethodName = 'GetDynamicOptions'
2021-10-13T20:12:25.8762800Z DEBUG: 00:00:00.0154094 Verbose: False
2021-10-13T20:12:25.8767828Z DEBUG: 00:00:00.0154198 Name: PSGallery
2021-10-13T20:12:25.8772271Z DEBUG: 00:00:00.0154298 ErrorVariable: ev
2021-10-13T20:12:25.8781155Z DEBUG: 00:00:00.0160347 INVOKING PowerShell Fn Get-DynamicOptions with args Source that has length 1
2021-10-13T20:12:25.8787677Z DEBUG: 00:00:00.0165510 In PowerShellGet Provider - 'Get-DynamicOptions'.
2021-10-13T20:12:25.8793777Z DEBUG: 00:00:00.0182567 Done calling powershell «Get-DynamicOptions» «PSModule»
2021-10-13T20:12:25.8835195Z DEBUG: 00:00:00.0362002 Calling New() : MethodName = 'ResolvePackageSources'
2021-10-13T20:12:25.8842110Z DEBUG: 00:00:00.0372187 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
2021-10-13T20:12:25.8848778Z DEBUG: 00:00:00.0379054 ProviderName: PowerShellGet
2021-10-13T20:12:25.8855434Z DEBUG: 00:00:00.0385762 Verbose: False
2021-10-13T20:12:25.8862111Z DEBUG: 00:00:00.0392420 Name: PSGallery
2021-10-13T20:12:25.8870371Z DEBUG: 00:00:00.0399104 ErrorVariable: ev
2021-10-13T20:12:25.8884102Z DEBUG: 00:00:00.0409371 INVOKING PowerShell Fn Resolve-PackageSource with args  that has length 0
2021-10-13T20:12:25.8893707Z DEBUG: 00:00:00.0422133 In PowerShellGet Provider - 'Resolve-PackageSource'.
2021-10-13T20:12:25.8917223Z DEBUG: 00:00:00.0443168 Yielding packge source for PSGallery at location https://www.powershellgallery.com/api/v2
2021-10-13T20:12:25.8925759Z DEBUG: 00:00:00.0454170 Done calling powershell «Resolve-PackageSource» «PSModule»
2021-10-13T20:12:25.8958234Z DEBUG: 00:00:00.0484519 Calling New() : MethodName = 'ResolvePackageSources'
2021-10-13T20:12:25.8964320Z DEBUG: 00:00:00.0494468 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
2021-10-13T20:12:25.8970968Z DEBUG: 00:00:00.0501246 ProviderName: PowerShellGet
2021-10-13T20:12:25.8977659Z DEBUG: 00:00:00.0507961 Verbose: False
2021-10-13T20:12:25.8984281Z DEBUG: 00:00:00.0514643 Name: PSGallery
2021-10-13T20:12:25.8991448Z DEBUG: 00:00:00.0521276 ErrorVariable: ev
2021-10-13T20:12:25.9003149Z DEBUG: 00:00:00.0528508 INVOKING PowerShell Fn Resolve-PackageSource with args  that has length 0
2021-10-13T20:12:25.9012111Z DEBUG: 00:00:00.0540740 In PowerShellGet Provider - 'Resolve-PackageSource'.
2021-10-13T20:12:25.9034763Z DEBUG: 00:00:00.0559843 Yielding packge source for PSGallery at location https://www.powershellgallery.com/api/v2
2021-10-13T20:12:25.9043264Z DEBUG: 00:00:00.0571658 Done calling powershell «Resolve-PackageSource» «PSModule»
2021-10-13T20:12:26.4610659Z DEBUG: 00:00:00.0000004 Calling New() : MethodName = 'ResolvePackageSources'
2021-10-13T20:12:26.4614555Z DEBUG: 00:00:00.0000301 RequiredVersion: 2.2.5
2021-10-13T20:12:26.4619105Z DEBUG: 00:00:00.0000440 Source: PSGallery
2021-10-13T20:12:26.4623875Z DEBUG: 00:00:00.0000556 Force: True
2021-10-13T20:12:26.4628547Z DEBUG: 00:00:00.0000681 Debug: True
2021-10-13T20:12:26.4633183Z DEBUG: 00:00:00.0000804 Verbose: True
2021-10-13T20:12:26.4637846Z DEBUG: 00:00:00.0000930 Name: PowerShellGet
2021-10-13T20:12:26.4646301Z DEBUG: 00:00:00.0010714 INVOKING PowerShell Fn Resolve-PackageSource with args  that has length 0
2021-10-13T20:12:26.4652348Z DEBUG: 00:00:00.0018608 In PowerShellGet Provider - 'Resolve-PackageSource'.
2021-10-13T20:12:26.4659932Z DEBUG: 00:00:00.0039418 Yielding packge source for PSGallery at location https://www.powershellgallery.com/api/v2
2021-10-13T20:12:26.4665917Z DEBUG: 00:00:00.0048735 Done calling powershell «Resolve-PackageSource» «PSModule»
2021-10-13T20:12:26.4672320Z DEBUG: 00:00:00.0077961 Calling New() : MethodName = 'GetDynamicOptions'
2021-10-13T20:12:26.4676966Z DEBUG: 00:00:00.0078136 RequiredVersion: 2.2.5
2021-10-13T20:12:26.4681640Z DEBUG: 00:00:00.0078252 Source: PSGallery
2021-10-13T20:12:26.4686804Z DEBUG: 00:00:00.0078347 Force: True
2021-10-13T20:12:26.4691857Z DEBUG: 00:00:00.0078455 Debug: True
2021-10-13T20:12:26.4696517Z DEBUG: 00:00:00.0078561 Verbose: True
2021-10-13T20:12:26.4701148Z DEBUG: 00:00:00.0078667 Name: PowerShellGet
2021-10-13T20:12:26.4710221Z DEBUG: 00:00:00.0085096 INVOKING PowerShell Fn Get-DynamicOptions with args Provider that has length 1
2021-10-13T20:12:26.4716243Z DEBUG: 00:00:00.0091113 In PowerShellGet Provider - 'Get-DynamicOptions'.
2021-10-13T20:12:26.4722407Z DEBUG: 00:00:00.0100271 Done calling powershell «Get-DynamicOptions» «PSModule»
2021-10-13T20:12:26.4728841Z DEBUG: 00:00:00.0127740 Calling New() : MethodName = 'GetDynamicOptions'
2021-10-13T20:12:26.4733993Z DEBUG: 00:00:00.0127910 RequiredVersion: 2.2.5
2021-10-13T20:12:26.4738668Z DEBUG: 00:00:00.0128016 Source: PSGallery
2021-10-13T20:12:26.4743339Z DEBUG: 00:00:00.0128104 Force: True
2021-10-13T20:12:26.4748059Z DEBUG: 00:00:00.0128200 Debug: True
2021-10-13T20:12:26.4752724Z DEBUG: 00:00:00.0128297 Verbose: True
2021-10-13T20:12:26.4757404Z DEBUG: 00:00:00.0128394 Name: PowerShellGet
2021-10-13T20:12:26.4766428Z DEBUG: 00:00:00.0134344 INVOKING PowerShell Fn Get-DynamicOptions with args Source that has length 1
2021-10-13T20:12:26.4772434Z DEBUG: 00:00:00.0140691 In PowerShellGet Provider - 'Get-DynamicOptions'.
2021-10-13T20:12:26.4778647Z DEBUG: 00:00:00.0160090 Done calling powershell «Get-DynamicOptions» «PSModule»
2021-10-13T20:12:26.4785207Z DEBUG: 00:00:00.0184996 Calling New() : MethodName = 'GetDynamicOptions'
2021-10-13T20:12:26.4789908Z DEBUG: 00:00:00.0185161 RequiredVersion: 2.2.5
2021-10-13T20:12:26.4794593Z DEBUG: 00:00:00.0185270 Source: PSGallery
2021-10-13T20:12:26.4799327Z DEBUG: 00:00:00.0185356 Force: True
2021-10-13T20:12:26.4804049Z DEBUG: 00:00:00.0185454 Debug: True
2021-10-13T20:12:26.4808777Z DEBUG: 00:00:00.0185553 Verbose: True
2021-10-13T20:12:26.4813462Z DEBUG: 00:00:00.0185649 Name: PowerShellGet
2021-10-13T20:12:26.4822432Z DEBUG: 00:00:00.0192000 INVOKING PowerShell Fn Get-DynamicOptions with args Package that has length 1
2021-10-13T20:12:26.4828547Z DEBUG: 00:00:00.0197015 In PowerShellGet Provider - 'Get-DynamicOptions'.
2021-10-13T20:12:26.4834652Z DEBUG: 00:00:00.0254095 Done calling powershell «Get-DynamicOptions» «PSModule»
2021-10-13T20:12:26.4841514Z DEBUG: 00:00:00.0279336 Calling New() : MethodName = 'GetDynamicOptions'
2021-10-13T20:12:26.4847136Z DEBUG: 00:00:00.0279505 RequiredVersion: 2.2.5
2021-10-13T20:12:26.4851981Z DEBUG: 00:00:00.0279618 Source: PSGallery
2021-10-13T20:12:26.4856672Z DEBUG: 00:00:00.0279722 Force: True
2021-10-13T20:12:26.4861403Z DEBUG: 00:00:00.0279821 Debug: True
2021-10-13T20:12:26.4866111Z DEBUG: 00:00:00.0279905 Verbose: True
2021-10-13T20:12:26.4870807Z DEBUG: 00:00:00.0280007 Name: PowerShellGet
2021-10-13T20:12:26.4880139Z DEBUG: 00:00:00.0285917 INVOKING PowerShell Fn Get-DynamicOptions with args Install that has length 1
2021-10-13T20:12:26.4886200Z DEBUG: 00:00:00.0291665 In PowerShellGet Provider - 'Get-DynamicOptions'.
2021-10-13T20:12:26.4892305Z DEBUG: 00:00:00.0315826 Done calling powershell «Get-DynamicOptions» «PSModule»
2021-10-13T20:12:26.5178977Z DEBUG: 00:00:00.0905004 Calling New() : MethodName = 'ResolvePackageSources'
2021-10-13T20:12:26.5186563Z DEBUG: 00:00:00.0917223 SkipPublisherCheck: True
2021-10-13T20:12:26.5194043Z DEBUG: 00:00:00.0925013 ProviderName: PowerShellGet
2021-10-13T20:12:26.5201719Z DEBUG: 00:00:00.0932582 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
2021-10-13T20:12:26.5209016Z DEBUG: 00:00:00.0940085 RequiredVersion: 2.2.5
2021-10-13T20:12:26.5216459Z DEBUG: 00:00:00.0947560 Source: PSGallery
2021-10-13T20:12:26.5223892Z DEBUG: 00:00:00.0954992 AllowClobber: True
2021-10-13T20:12:26.5231362Z DEBUG: 00:00:00.0962440 Force: True
2021-10-13T20:12:26.5238403Z DEBUG: 00:00:00.0969915 Debug: True
2021-10-13T20:12:26.5245401Z DEBUG: 00:00:00.0977015 Scope: AllUsers
2021-10-13T20:12:26.5252333Z DEBUG: 00:00:00.0983977 Verbose: True
2021-10-13T20:12:26.5259313Z DEBUG: 00:00:00.0990913 Type: Module
2021-10-13T20:12:26.5266896Z DEBUG: 00:00:00.0997902 Name: PowerShellGet
2021-10-13T20:12:26.5284432Z DEBUG: 00:00:00.1009749 INVOKING PowerShell Fn Resolve-PackageSource with args  that has length 0
2021-10-13T20:12:26.5294851Z DEBUG: 00:00:00.1024608 In PowerShellGet Provider - 'Resolve-PackageSource'.
2021-10-13T20:12:26.5317246Z VERBOSE: Repository details, Name = 'PSGallery', Location = 'https://www.powershellgallery.com/api/v2'; IsTrusted = 
2021-10-13T20:12:26.5318187Z 'False'; IsRegistered = 'True'.
2021-10-13T20:12:26.5329626Z DEBUG: 00:00:00.1056133 Yielding packge source for PSGallery at location https://www.powershellgallery.com/api/v2
2021-10-13T20:12:26.5339687Z DEBUG: 00:00:00.1068536 Done calling powershell «Resolve-PackageSource» «PSModule»
2021-10-13T20:12:26.5369379Z DEBUG: 00:00:00.1097081 Calling SearchForPackages. Name='PowerShellGet'
2021-10-13T20:12:26.5426116Z VERBOSE: Using the provider 'PowerShellGet' for searching packages.
2021-10-13T20:12:26.5475284Z DEBUG: 00:00:00.1203720 PackageProvider::FindPackage with name PowerShellGet
2021-10-13T20:12:26.5482171Z DEBUG: 00:00:00.1209860 Calling SearchForPackages After Select 1
2021-10-13T20:12:26.5565637Z DEBUG: 00:00:00.1293339 Calling New() : MethodName = 'FindPackage'
2021-10-13T20:12:26.5572285Z DEBUG: 00:00:00.1303721 SkipPublisherCheck: True
2021-10-13T20:12:26.5579234Z DEBUG: 00:00:00.1310788 ProviderName: PowerShellGet
2021-10-13T20:12:26.5586285Z DEBUG: 00:00:00.1317786 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
2021-10-13T20:12:26.5593178Z DEBUG: 00:00:00.1324727 RequiredVersion: 2.2.5
2021-10-13T20:12:26.5600098Z DEBUG: 00:00:00.1331658 Source: PSGallery
2021-10-13T20:12:26.5606948Z DEBUG: 00:00:00.1338586 AllowClobber: True
2021-10-13T20:12:26.5613824Z DEBUG: 00:00:00.1345454 Force: True
2021-10-13T20:12:26.5620710Z DEBUG: 00:00:00.1352309 Debug: True
2021-10-13T20:12:26.5627698Z DEBUG: 00:00:00.1359274 Scope: AllUsers
2021-10-13T20:12:26.5634510Z DEBUG: 00:00:00.1366151 Verbose: True
2021-10-13T20:12:26.5641375Z DEBUG: 00:00:00.1372989 Type: Module
2021-10-13T20:12:26.5649613Z DEBUG: 00:00:00.1379842 Name: PowerShellGet
2021-10-13T20:12:26.5664623Z DEBUG: 00:00:00.1389011 INVOKING PowerShell Fn Find-Package with args System.String[], 2.2.5, ,  that has length 4
2021-10-13T20:12:26.6196042Z DEBUG: 00:00:00.1921615 In PowerShellGet Provider - 'Find-Package'.
2021-10-13T20:12:26.6227370Z DEBUG: 00:00:00.1954936 OPTION: SkipPublisherCheck => True
2021-10-13T20:12:26.6237189Z DEBUG: 00:00:00.1966263 OPTION: ProviderName => PowerShellGet
2021-10-13T20:12:26.6247234Z DEBUG: 00:00:00.1976120 OPTION: MessageResolver => Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
2021-10-13T20:12:26.6257136Z DEBUG: 00:00:00.1986282 OPTION: RequiredVersion => 2.2.5
2021-10-13T20:12:26.6265958Z DEBUG: 00:00:00.1996043 OPTION: Source => PSGallery
2021-10-13T20:12:26.6274038Z DEBUG: 00:00:00.2004342 OPTION: AllowClobber => True
2021-10-13T20:12:26.6282040Z DEBUG: 00:00:00.2012420 OPTION: Force => True
2021-10-13T20:12:26.6290120Z DEBUG: 00:00:00.2020508 OPTION: Debug => True
2021-10-13T20:12:26.6298212Z DEBUG: 00:00:00.2028545 OPTION: Scope => AllUsers
2021-10-13T20:12:26.6306353Z DEBUG: 00:00:00.2036604 OPTION: Verbose => True
2021-10-13T20:12:26.6314397Z DEBUG: 00:00:00.2044728 OPTION: Type => Module
2021-10-13T20:12:26.6322542Z DEBUG: 00:00:00.2052767 OPTION: Name => PowerShellGet
2021-10-13T20:12:26.6376121Z VERBOSE: Using the specified source names : 'PSGallery'.
2021-10-13T20:12:26.6497990Z VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'.
2021-10-13T20:12:26.6532205Z VERBOSE: The specified Location is 'https://www.powershellgallery.com/api/v2' and PackageManagementProvider is 'NuGet'.
2021-10-13T20:12:26.6661910Z DEBUG: 00:00:00.2390396 PackageProvider::FindPackage with name PowerShellGet
2021-10-13T20:12:26.6936491Z DEBUG: 00:00:00.2663167 Calling 'NuGet'::'FindPackage' - name='PowerShellGet', 
2021-10-13T20:12:26.6937100Z requiredVersion='2.2.5',minimumVersion='', maximumVersion='''.
2021-10-13T20:12:26.6958588Z DEBUG: 00:00:00.2688152 Iterating 'PowerShellGet'.
2021-10-13T20:12:26.7049976Z DEBUG: 00:00:00.2777999 There are '1' registered sources in 'NuGet' provider.
2021-10-13T20:12:26.7062770Z DEBUG: 00:00:00.2789878 Source 'https://www.powershellgallery.com/api/v2' is not one of the registered sources in 
2021-10-13T20:12:26.7063450Z 'NuGet' provider.
2021-10-13T20:12:26.8499822Z DEBUG: 00:00:00.4228303 Source 'https://www.powershellgallery.com/api/v2' is validated.
2021-10-13T20:12:26.8533418Z DEBUG: 00:00:00.4261331 Calling 'NuGetRequest'::'GetPackageById', 'PowerShellGet'.
2021-10-13T20:12:26.9512744Z DEBUG: 00:00:00.5240634 Calling 'HttpClientPackageRepository'::'FindPackagesById', 'PowerShellGet'.
2021-10-13T20:12:26.9522681Z DEBUG: 00:00:00.5252667 Calling 'NuGetClient'::'FindPackage'.
2021-10-13T20:12:26.9535780Z VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'' for ''.
2021-10-13T20:12:26.9638951Z DEBUG: 00:00:00.5369096 Downloading 
2021-10-13T20:12:26.9639393Z 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=0&$top=40'.
2021-10-13T20:12:27.1654905Z DEBUG: 00:00:00.7382434 Completed downloading 
2021-10-13T20:12:27.1655840Z 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=0&$top=40'.
2021-10-13T20:12:27.1962921Z DEBUG: 00:00:00.7689116 Downloading 
2021-10-13T20:12:27.1963764Z 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=40&$top=40'.
2021-10-13T20:12:27.1969055Z DEBUG: 00:00:00.7690471 Downloading 
2021-10-13T20:12:27.1970319Z 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=120&$top=40'.
2021-10-13T20:12:27.1977854Z DEBUG: 00:00:00.7693477 Downloading 
2021-10-13T20:12:27.1979146Z 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=160&$top=40'.
2021-10-13T20:12:27.1983927Z DEBUG: 00:00:00.7709574 Downloading 
2021-10-13T20:12:27.1985429Z 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=80&$top=40'.
2021-10-13T20:12:27.2907765Z DEBUG: 00:00:00.8637172 Completed downloading 
2021-10-13T20:12:27.2908375Z 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=40&$top=40'.
2021-10-13T20:12:27.2948544Z DEBUG: 00:00:00.8674397 '27' packages received in the last request.
2021-10-13T20:12:27.3058009Z DEBUG: 00:00:00.8789116 Completed downloading 
2021-10-13T20:12:27.3059036Z 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=120&$top=40'.
2021-10-13T20:12:27.3069688Z DEBUG: 00:00:00.8798443 '0' packages received in the last request.
2021-10-13T20:12:27.3181763Z DEBUG: 00:00:00.8910873 Completed downloading 
2021-10-13T20:12:27.3182339Z 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=80&$top=40'.
2021-10-13T20:12:27.3196388Z DEBUG: 00:00:00.8923091 '0' packages received in the last request.
2021-10-13T20:12:27.3350394Z DEBUG: 00:00:00.9079773 Completed downloading 
2021-10-13T20:12:27.3350937Z 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=160&$top=40'.
2021-10-13T20:12:27.3363041Z DEBUG: 00:00:00.9090912 '0' packages received in the last request.
2021-10-13T20:12:27.3374457Z VERBOSE: Total package yield:'1' for the specified package 'PowerShellGet'.
2021-10-13T20:12:27.3383225Z DEBUG: 00:00:00.9113412 Completed iterating for 'PowerShellGet'.
2021-10-13T20:12:27.5115121Z DEBUG: 00:00:01.0842606 Done calling powershell «Find-Package» «PSModule»
2021-10-13T20:12:27.5352438Z DEBUG: 00:00:01.1079466 Calling New() : MethodName = 'GetInstalledPackages'
2021-10-13T20:12:27.5360219Z DEBUG: 00:00:01.1090971 SkipPublisherCheck: True
2021-10-13T20:12:27.5368052Z DEBUG: 00:00:01.1098964 ProviderName: PowerShellGet
2021-10-13T20:12:27.5375893Z DEBUG: 00:00:01.1106759 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
2021-10-13T20:12:27.5383568Z DEBUG: 00:00:01.1114483 RequiredVersion: 2.2.5
2021-10-13T20:12:27.5391292Z DEBUG: 00:00:01.1122213 Source: PSGallery
2021-10-13T20:12:27.5398469Z DEBUG: 00:00:01.1129925 AllowClobber: True
2021-10-13T20:12:27.5405004Z DEBUG: 00:00:01.1136688 Force: True
2021-10-13T20:12:27.5411654Z DEBUG: 00:00:01.1143269 Debug: True
2021-10-13T20:12:27.5418281Z DEBUG: 00:00:01.1149890 Scope: AllUsers
2021-10-13T20:12:27.5424841Z DEBUG: 00:00:01.1156487 Verbose: True
2021-10-13T20:12:27.5431425Z DEBUG: 00:00:01.1163059 Type: Module
2021-10-13T20:12:27.5438741Z DEBUG: 00:00:01.1169647 Name: PowerShellGet
2021-10-13T20:12:27.5453336Z DEBUG: 00:00:01.1179404 INVOKING PowerShell Fn Get-InstalledPackage with args PowerShellGet, 2.2.5, ,  that has length 
2021-10-13T20:12:27.5454220Z 4
2021-10-13T20:12:27.5537264Z DEBUG: 00:00:01.1266083 In PowerShellGet Provider - 'Get-InstalledPackage'.
2021-10-13T20:12:27.5545046Z DEBUG: 00:00:01.1275398 OPTION: SkipPublisherCheck => True
2021-10-13T20:12:27.5552928Z DEBUG: 00:00:01.1283287 OPTION: ProviderName => PowerShellGet
2021-10-13T20:12:27.5560815Z DEBUG: 00:00:01.1291147 OPTION: MessageResolver => Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
2021-10-13T20:12:27.5568644Z DEBUG: 00:00:01.1298938 OPTION: RequiredVersion => 2.2.5
2021-10-13T20:12:27.5576361Z DEBUG: 00:00:01.1306781 OPTION: Source => PSGallery
2021-10-13T20:12:27.5583961Z DEBUG: 00:00:01.1314504 OPTION: AllowClobber => True
2021-10-13T20:12:27.5591630Z DEBUG: 00:00:01.1322138 OPTION: Force => True
2021-10-13T20:12:27.5599676Z DEBUG: 00:00:01.1329806 OPTION: Debug => True
2021-10-13T20:12:27.5607442Z DEBUG: 00:00:01.1337849 OPTION: Scope => AllUsers
2021-10-13T20:12:27.5615174Z DEBUG: 00:00:01.1345601 OPTION: Verbose => True
2021-10-13T20:12:27.5622960Z DEBUG: 00:00:01.1353314 OPTION: Type => Module
2021-10-13T20:12:27.5630954Z DEBUG: 00:00:01.1361059 OPTION: Name => PowerShellGet
2021-10-13T20:12:27.7049629Z DEBUG: 00:00:01.2774993 PowerShell Script 'PSModule' Function 'Get-InstalledPackage' returns null.
2021-10-13T20:12:27.7105353Z DEBUG: 00:00:01.2789802 Done calling powershell «Get-InstalledPackage» «PSModule»
2021-10-13T20:12:27.7118934Z Available PowerShellGet versions: 
2021-10-13T20:12:27.7299169Z 
2021-10-13T20:12:27.7303153Z Name              : PowerShellGet
2021-10-13T20:12:27.7303772Z Path              : C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PowerShellGet.psd1
2021-10-13T20:12:27.7310322Z Description       : PowerShell module with commands for discovering, installing, updating and publishing the 
2021-10-13T20:12:27.7310904Z                     PowerShell artifacts like Modules, DSC Resources, Role Capabilities and Scripts.
2021-10-13T20:12:27.7311394Z Guid              : 1d73a601-4a6c-43c5-ba3f-619b18bbb404
2021-10-13T20:12:27.7311787Z Version           : 1.0.0.1
2021-10-13T20:12:27.7312655Z ModuleBase        : C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1
2021-10-13T20:12:27.7313217Z ModuleType        : Script
2021-10-13T20:12:27.7313670Z PrivateData       : {PSData, SupportedPowerShellGetFormatVersions, PackageManagementProviders}
2021-10-13T20:12:27.7314121Z AccessMode        : ReadWrite
2021-10-13T20:12:27.7314630Z ExportedAliases   : {[inmo, inmo], [fimo, fimo], [upmo, upmo], [pumo, pumo]}
2021-10-13T20:12:27.7315331Z ExportedCmdlets   : {}
2021-10-13T20:12:27.7318198Z ExportedFunctions : {[Install-Module, Install-Module], [Find-Module, Find-Module], [Save-Module, Save-Module], 
2021-10-13T20:12:27.7318737Z                     [Update-Module, Update-Module]...}
2021-10-13T20:12:27.7319097Z ExportedVariables : {}
2021-10-13T20:12:27.7319395Z NestedModules     : {}
2021-10-13T20:12:27.7319570Z 
2021-10-13T20:12:27.7325640Z Trying import of v2.2.5
2021-10-13T20:12:27.8193794Z Import-Module : The specified module 'PowerShellGet' with version '2.2.5' was not loaded because no valid module file 
2021-10-13T20:12:27.8195165Z was found in any module directory.
2021-10-13T20:12:27.8195678Z At D:\a\_work\1\s\Bootstrap.ps1:87 char:1
2021-10-13T20:12:27.8196057Z + Import-Module PowerShellGet -Version "2.2.5"
2021-10-13T20:12:27.8196446Z + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2021-10-13T20:12:27.8196993Z     + CategoryInfo          : ResourceUnavailable: (PowerShellGet:String) [Import-Module], FileNotFoundException
2021-10-13T20:12:27.8197688Z     + FullyQualifiedErrorId : Modules_ModuleWithVersionNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
2021-10-13T20:12:27.8198123Z  
2021-10-13T20:12:27.8985831Z ##[error]PowerShell exited with code '1'.

I hope this helps. Also note my Powershell-fu is weak; please answer as if to a five-year-old :)

@StevenBucher98
Copy link
Collaborator

Thanks @pjbrown, sort of a shot in the dark but if you are able to maybe upgrade to PowerShellGet v1.6.7 by using this command,
Install-Module 'PowerShellGet' -AllowClobber -RequiredVersion "1.6.7" -Force -Repository 'PSGallery' -SkipPublisherCheck -Debug -Verbose

To confirm its install:
Get-InstalledModule PowerShellGet -ListAvailable

and then import the module with
Import-Module PowerShellGet -RequiredVersion "1.6.7"

Then do the exact same steps but replace 1.6.7 with 2.2.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants