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?