As stated in the documentation for Set-PSRepository
and Register-PSRepository
, any changes are persistent and in the user scope. They apply to all versions of PowerShell, which includes different editions. This means that PowerShell Core 6.x/PowerShell 7.x will also see those changes for the same user, even if not installed when the changes were made. This also extends to any other PS repositories that you change/register.
I have spun up a test instance and independently verified this:
PS C:\Users\TestUser01> Get-CimInstance -Query 'SELECT Caption,Version FROM Win32_OperatingSystem' | select Caption,Version
Caption Version
------- -------
Microsoft Windows 10 Enterprise LTSC 10.0.17763
PS C:\Users\TestUser01> $PSVersionTable.PSVersion.ToString()
5.1.17763.1490
PS C:\Users\TestUser01> $null -eq (gcm pwsh -ea:ig)
True
PS C:\Users\TestUser01> Get-PSRepository
Name InstallationPolicy SourceLocation
---- ------------------ --------------
PSGallery Untrusted https://www.powershellgallery.com/api/v2
PS C:\Users\TestUser01> Set-PSRepository PSGallery -in Trusted
PS C:\Users\TestUser01> Register-PSRepository ExampleRepo -so 'http://example.com'
PS C:\Users\TestUser01> Get-PSRepository
Name InstallationPolicy SourceLocation
---- ------------------ --------------
PSGallery Trusted https://www.powershellgallery.com/api/v2
ExampleRepo Untrusted http://example.com/
- Installed PowerShell 7.1.2 x64
PS C:\Users\TestUser01> $PSVersionTable.PSVersion.ToString()
7.1.2
PS C:\Users\TestUser01> Get-PSRepository
Name InstallationPolicy SourceLocation
---- ------------------ --------------
PSGallery Trusted https://www.powershellgallery.com/api/v2
ExampleRepo Untrusted http://example.com/