Deploy Custom PowerShell Modules to an Enterprise

This topic contains 6 replies, has 3 voices, and was last updated by Profile photo of Henry Buckle Henry Buckle 1 month, 3 weeks ago.

  • Author
    Posts
  • #54551
    Profile photo of Josh Wright
    Josh Wright
    Participant

    Hi,

    We are looking to start using a number of various Custom PowerShell Modules in our business, some of which will be using during PS Remoting.

    For this reason, I thought that it would be more efficient and convenient to have these custom modules deployed to "C:\Program Files\WindowsPowerShell\Modules" for quick use during Invoke-command and PS Remoting sessions.

    I know that this can be easily achieved via Group Policy and the Replace File option or similar, but I don't think that this would be very efficient

    The other option would be to possibly use a logon script to check if the files differ and update them – again, I wasn't sure if this would be practical.

    Does anyone have any suggestions how we can deploy Custom PowerShell Modules centrally and keep them up-to-date in a timely manner with minimal administrative overhead?

    My guess is that in the early days, we might update them to LIVE a couple times a week or month it would be great to barley worry about them and still have consistent functionality on each machine.

    Any suggestions are greatly appreciated (my best is a logon script that checks to see if the modules have been modified)

    Kind regards

    Josh

  • #54552
    Profile photo of Don Jones
    Don Jones
    Keymaster

    The best approach would be to ensure you've deployed PowerShell Package Manager and PowerShellGet, and then set up a private PowerShell Gallery. Nodes can then use Install-Module and Update-Module (which can be run whenever you feel it's needed) to pull modules down from your gallery. For example, scripts might proactively check for their dependencies as a first step, pull down whatever is needed, etc.

    Obviously, DSC is another way to declare which modules a node should have, and to ensure they have the latest version.

  • #54553
    Profile photo of Don Jones
    Don Jones
    Keymaster

    But to more strongly make a point – I don't think logon scripts are a good approach. You'll be forever maintaining that script. Each script should check its own dependencies, which becomes a way of documenting, in the script, which modules the script depends on.

  • #55122
    Profile photo of Josh Wright
    Josh Wright
    Participant

    Hi Don,

    Thank you very much for your suggestions, I think these could be a great choice when we get up to Version 5.0

    Do you know of any enterprise level & supported products to use for a private PowerShell Gallery?
    I can see that PSPrivateGallery and NuGet are popular, but without a paid and supported version, it could be hard to authorisation to get this into production.

    Thanks again

    Josh

  • #55123
    Profile photo of Don Jones
    Don Jones
    Keymaster

    Nope. Those are all open source technologies; I'm not aware of anyone marketing a paid version.

  • #55124
    Profile photo of Josh Wright
    Josh Wright
    Participant

    Appreciate your help!

  • #55269
    Profile photo of Henry Buckle
    Henry Buckle
    Participant

    All you need is a NuGet feed, there are a number of companies that offer paid versions. We use Artifactory in our enterprise which can do it.

You must be logged in to reply to this topic.