-
Notifications
You must be signed in to change notification settings - Fork 98
[Feature Request]: Ability to configure PSRepository on a system-wide level #84
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
Comments
I also support this request. If an admin runs What I do now is just include the repository registration logic in any and all scripts that install modules. |
+1 for this enhancement. |
Windows PowerShell team, any guidance on where the "AllUsers" repositories configuration file would live?
|
@bradleywehmeie, thanks for looking into this feature request. For non-Windows platforms, please update the $script:PSGetProgramDataPath to '/usr/local/share/powershellget'. Current: $script:PSGetProgramDataPath = Microsoft.PowerShell.Management\Join-Path -Path ([System.Management.Automation.Platform]::SelectProductNameForDirectory('CONFIG')) -ChildPath 'PowerShellGet' Expected: $script:PSGetProgramDataPath = '/usr/local/share/powershellget' |
Main QuestionHow do we expect Unregister-PSRepository to function when the Scope parameter is omitted? Should it be allowed to modify the AllUsers scope if the Scope is omitted OR should the Scope be required anytime the AllUsers scope is being modified? Example:
Additional ContextWith either implementation, the Set/Unregister-PSRepository cmdlets work as you would expect but I ran into a limitation with the Unregister-PackageSource cmdlet and pipelining. The value for Scope is not pipelined to the Unregister-PackageSource cmdlet so there are occasions where it will produce the incorrect result when attempting to work on the AllUsers scope. For example:
If we are strict about requiring the AllUsers to be specified, this will result in a Not Found error because no scope will end up being passed to Remove-PackageSource so it will assume "CurrentUser" scope. In both implementations if the PackageSource exists in both the CurrentUser and AllUsers (a case which is possible), |
@bradleywehmeier As part of this enhancement, are you allowing the duplicate PSRepository names? I think we should allow this as the users and admin may give the same name for the psrepositories. if not, can we follow the same design as the Uninstall and Update cmdlets where -Scope parameter is not required on Unregister-PSRepository. If we are allowing the duplicate psrepository names
Above is also applicable to the Set-PSRepository cmdlet. We need to add -Scope optional parameter in PowerShellGet provider dynamic options for the sources at For the pipeline operations with scope, it is required to specify Get-PackageSource -Name Test -Provider PowerShellGet -Scope AllUsers | Unregister-PackageSource |
@bmanikm Duplicate Repository names have to be supported because there is no way to avoid a situation where an admin defines an AllUsers repo that overlaps with a setting that a user has already set. In this case the user will get the instance they defined (CurrentUser scope) not the AllUsers scope. “Scope parameter is optional for the AllUsers scoped psrepositories” answers my real question here. With the rest having been taken care of look for a pull request in the next couple of days after I look it over one last time. |
Also please consider validating the install and update scenarios with the duplicate psrepository names as the source locations can be different. |
Regarding the case of duplicate PSRepository names with different source locations:
The name overlap does cause problems for Update. It wants to use the PSRepository source location defined in CurrentUser regardless of what source location was used for the install. |
The more I think about it, I'm not sure if my assumption was correct.
When there are duplicate PSRepository names and one is chosen to be the "winner", I can also make an argument to treat that scenario in the same way we treat the PSRepository source location having been changed and using the source location from the "winner". There are other rough edges with PowerShellGet like the current behavior of using a "CurrentUser" PSRepository to install "AllUsers" modules. If those are not causing issues, then maybe this confusion will also be negligible. One alternative would be to Prefix the AllUsers scoped PSRepositories so that name collisions were not possible. I originally avoided that so that PackageManagement cmdlets (e.g. Thanks all for your input on this. I appreciate the effort in helping me get this right. |
@bradleywehmeier thanks for looking into this feature! Some thoughts
|
I also support this. I had a very confusing few hours the other day, trying to configure a proxy PowerShellGet package source through DSC. Since DSC runs as the system user, I couldn't see the repositories it was registering. I am now trying to figure out how to configure the proxy repository for all users. (Does anyone have any good solutions to that?) |
Agreed this is much needed feature. I'm trying to use the PackageManagement DSC resource to configure our internal/proxy nexus repository as part of an OS deployment but is only applied under the NT Autority\System account. The modules install fine from the internal repo as part of the DSC config, however normal users still see the default PSGallery repo meaning they cannot pull approved and custom internal modules when required. |
I just want to chime in that this causes problems using Jenkins automation as well. Jenkins agents sometimes run under system or certain service account logins and i have no good way to configure the psrepository for them. |
+1 for this feature. We've want to move to using PowerShellGet exclusively for module distribution but we get constant requests for assistance with setting up the right repos which is slowing down adoption. This feature would solve that. |
@SteveL-MSFT As a quick observation, this is actually a OneGet issue and not a PowerShellGet issue. I created the following issue in OneGet to ALIGN the two projects. OneGet/oneget#468 As Program Manager for PowerShell Core, you can facilitate, advocate for, and resource a solution to this problem! |
I can not use Register-PackageSource (or psrepository) by my service build account that has no local logon permissions. So how do I need to use all this package management mess? Should I use another solutions? |
@SydneyhSmith any chance this can be added to 3.0? This is a huge missing feature in a multi-user environment. |
Any updates on this? Our job scheduling tools uses temporary user profiles so full automation of things that utilize that tool is not possible unless I use @KevinMarquette's solution, which I'd like to avoid. |
Hello, Is there any update on this topic ? This is a a much needed feature for me as my configuration manager runs as system, I cannot register PSRepositories / install modules |
Also plus 1. Definitely needed for enterprises trying to run private repositories. |
Thanks all! We'll definitely prioritize this scenario since it's been a popular request |
+1 for this feature! |
Make that + 2! |
Tracking this feature work in https://github.com/PowerShell/PowerShellGet/issues/616 |
+1! |
+1, looking forward to being able to set this and remove a fair bit of workaround code :) |
+1 |
Would love to see this in an upcoming release as we would like to push out a default configuration to all of our workstations/servers to point at our PowerShell repositories in Artifactory. I see it was included in 3.0 then pulled out? |
Faced this issue today as well, so seems still relevant. |
It would be great if there was a way to register a PSRepository on the system-wide level, so that if configured once, it would work for all the users on a particular system.
Expected Behavior
Register-PSRepository
should have a-Scope
parameter added, to control whether a particular PSRepository needs to be registered for just the current user of for the whole system (similar to the behavior of Execution Policy). It would also be great to have an extra scope option, that would register PSRepository just for the current session (like mentioned in PowerShell/PowerShellGet#65)Apart from the
Register-PSRepository
, the remaining set of the *-PSRepository cmdlets should also have the-Scope
parameter.Set-PSRepository
andUnregister-PSRepository
cmdlets should require admin privileges to work against system-wide PSRepository settings and 'Get-PSRepository' cmdlet should not require admin privileges at all.Current Behavior
Currently
Register-PSRepository
only works for the user that is executing the cmdlet.Context
Having an ability to register PSRepository on a system-wide level would allow us to pre-configure our internal Repositories in the Virtual Machine templates, thus making the provisioning process much simpler.
Additionally, that would simplify maintaining existing PSRepository configurations in a consistent fashion across all our systems.
Your Environment
The text was updated successfully, but these errors were encountered: