unable to find repository – need a little help please!

For a while now I have had a lot of red when I work with PowerShell.  See the error:

It turns out I have this issue on a Windows 10 VM, and several Win2K16 VMs.  Been very frustrating.  Not sure what caused it.

The only help when I Google is this article – https://evotec.xyz/update-module-packagemanagementinstall-package-unable-to-find-repository/ – but it did not solve the issue although I thought it would. I did learn some things from it.

I believe the problem is that I cannot upgrade, or remove, PowerShellGet 1.0.0.1.

The order of things I tried was:

remove-module PowerShellGet

uninstall-module PowerShellGet

unregister-PSRepository -Name ‘PSGallery’

exit and reboot the VM

Register-PSRepository -Default

Set-PSRepository -Name ‘PSGallery’ -InstallationPolicy Trusted

exit and reboot the VM

Install-module PowerShellGet -Force

PowerShellGet installs but then we see this issue:

I cannot get rid of that issue.

Now if we do the get-module we see something else.

So I am back in my problem with a lot of red and error messages.  Most things work, all that I have tried but doing updates is an issue.  And I do not like to see all the red.

If anyone has a suggestion or comment on how to fix this I would most appreciate it. I am not a serious PowerShell person, but rather a simple user that does more copy and paste.  So don’t worry about yelling something obvious I have missed at me.

Updates:

  • 12/22/18 – My theory was that I had a PowerShell home folder that points to a 1.0 folder in c:\windows\system32 yet where there were VMs with no issue it pointed to a different location (c:\program files\WindowsPowerShell.  So I thought I could fix things. So what I did was this.
    • Uninstall PowerShell (help here)
    • The folder still remained in c:\windows\system32 so I took ownership of it and deleted it.
    • Empty trash.
    • Restart.
    • Enable PowerShell – (Enable Windows features)
    • Found PowerShell did not work, and it was due to no files being written or replaced.
    • So I downloaded PowerShell to install (from here) – turns out that was 6.1 and a GA build.
    • My PowerShell links did not work now, until I edited one and linked it to pwsh.exe in the c:\program files area.
    • Now I can run PowerShell.
    • But it turns out I am too current and things like PowerCLi will install but won’t run properly.
    • I check versions – on my problem VM it is 6.1.1 and on the VM where it all works it is 5.1 14393 2608
    • I really thought I had a good idea. But nope.
  • 12/22/18 – Still an issue.  And now frustrating me more since there is a new build of PowerCLI that won’t come done.  But I got a clue recently while working on an article so am going to test out my new theory and see. Merry Christmas everyone!
  • 12/14/18 – thanks to Kyle, I got more help and further along.  With the commands above I remove the PowerShellGet and of course I cannot install it as PowerShellGet is necessary to install things. So what you do is download the PowerShellGet.zip from here. Once downloaded, extract it, and copy the folder that is in /src and to the c:\program files\WindowsPowerShell\modules.  Now you have PowerShellGet once again.  When I did this and did get-mdoule -listavailable PowerShellGet I could now see I only had one version of it – 2.0.3.  I still could not do update-module without seeing a sea of red so I then restarted.  Then I did the unregister-PSRepository command seen above.  Then I did a reboot, then I did the Register-PSRepository followed by the Set_PSRepository Trusted command.  Still have the sea of red. Another reboot.  Still get the sea of red. So updating PowerShellGet did not help.  Removing the repo and bringing it back did not help. I did all of this running PowerShell as admin.
  • 12/12/18 – a useful comment not shown above is Get-PSRepository.
  • 12/12/18 – Thanks to Kyle, I have this solved – maybe. Very much appreciated Kyle!

$psget = Get-Module -Name PowerShellGet -ListAvailable | ?{$_.Version -eq ‘1.0.0.1’}
Remove-Item -Path $psget.ModuleBase -Recurse

  • 12/7/18 – Cody said this sounded familiar to him, and I should delete the 1.0.0.1 module out of the file system.  I thought that a genius idea but I was not able to find this file(s) to delete.  I hope that someone can help me with that.

Michael

=== END ===

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.