Search code examples
powershellchocolatey

What installertype to use with Chocolatey to install a powershell module?


I have a set of Powershell modules that I would like to have managed with Chocolatey. It is only the Module folder that I want to deploy. What $installerType should I use? Does anyone have a suggestion of what approach should be considered when installing a Powershell module?


Solution

  • I am going to guess that the $installertype parameter that you are referring to is one of the input parameters associated with the Install-ChocolateyPackage command (or similar) which is documented here. This helper method is really only used when you are installing an application using either an MSI or an EXE, which you instruct Chocolatey to download for you from the internet.

    When installing a PowerShell Module, it is unlikely that you will have an EXE or an MSI to do the install for you. More likely, you are going to have a zip file that you need to extract into the PowerShell Modules folder, or a straight up *.psm1 file that you want to place there. In which case, a helper method such as Install-ChocolateyZipPackage which you can find documented here would probably be better.

    There are a number of Chocolatey Packages on chocolatey.org that already show how you can install a PowerShell Module. I would suggest that you take a look at these packages, for instance:

    Which will give you some ideas about the different ways that you can do the install. If you haven't already, do choco install nugetpackageexplorer and then use this tool to view the contents of each of the above packages, as shown here:

    enter image description here

    and then hopefully you will be able to achieve what you want.