header image

Unregistering the default repository–PS version dependent?

Posted by: | September 18, 2016 Comments Off on Unregistering the default repository–PS version dependent? |

In this post – https://richardspowershellblog.wordpress.com/2016/09/17/powershell-repositories/ – I stated that you could unregister the default PowerShell repository.

 

I also said that the statement in the documentation for Unregister-PSrepository that you couldn’t unregister PSGallery was incorrect.

 

A couple of readers have left comments stating that they tried it and got an error message stating that PSGallery can’t be unregistered.

 

I did my first test on Windows 10 latest preview build – build 14926

PS> $PSVersionTable

Name                           Value
—-                           —–
PSVersion                      5.1.14926.1000
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
BuildVersion                   10.0.14926.1000
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

 

I’ve just test on Windows Server 2016 TP5

PS C:\Windows\system32> $PSVersionTable

Name                           Value
—-                           —–
PSVersion                      5.1.14300.1000
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
CLRVersion                     4.0.30319.42000
BuildVersion                   10.0.14300.1000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

 

The version of PowerShell 5.1 on Server 2016 TP5 doesn’t have the –Default parameter on Register-PSrepositiry but this works

Register-PSRepository -Name PSGallery -SourceLocation https://www.powershellgallery.com/api/v2/

 

It appears that the ability to unregister the default repository and then re-register it is an evolving feature in PowerShell 5.1

under: PowerShell v5

Comments are closed.

Categories