This topic contains 2 replies, has 2 voices, and was last updated by
January 3, 2019 at 10:14 pm #132629ParticipantPoints: 20Rank: Member
We have recently completed our internal PowerShell repository using ProGet. We are publishing modules here with a Jenkins CI job whenever changes are committed. That whole part of the set up was pretty smooth. I ran a script that needs one of the modules in the new repository so I added Install-Module at the beginning of the script to make sure the dependency is met before the rest of the script starts.
However, Install-Module itself depends on the presence of a PSRepository that points to my internal ProGet feed so a call to Register-PSRepository might be needed before Install-Module can be used. There is also a need for Install-PackageProvider before Install-Module can be used if that is missing.
I suppose I could put steps into each script to run Install-PackageProvider and Register-PSRepository if those items are missing but that feels kind of heavy to be putting that into a bunch of scripts. I could use some help on methods to manage this effectively.
I'm assuming that I must find all the servers where my scripts will be running and get the Install-PackageProvider and Register-PSRepository steps done by some method outside the individual scripts that will call Install-Module.
Am I on the right track here?
January 4, 2019 at 12:34 am #132647ParticipantPoints: 282Rank: Contributor
Hi Matthew – Usually, during the server build, teams ensure that all the necessary packages are installed and configured as it is required for the environment. But for now, as you mentioned you can install the package provider, then register the repository and install the module on all the servers, or you can install them if they are missing before the script execution. And the other you can use PowerShell DSC to ensure that the required package provider is installed, the repository is registered and the module is also installed. Thank you.
January 4, 2019 at 1:53 pm #132785ParticipantPoints: 20Rank: Member
Kirin, That makes sense. I'll get with the infrastructure team and work out how to roll out this necessary infrastructure first before we start trying to use the Install-Module option in our scripts.
You must be logged in to reply to this topic.