Robert
Robert

Reputation: 520

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?

Upvotes: 4

Views: 1451

Answers (2)

crimbo
crimbo

Reputation: 11281

RE the second part of your question - an approach for managing & deploying powershell modules using Chocolatey - I've found this article to be very useful:

http://patrickhuber.github.io/2015/03/17/creating-reusable-powershell-modules-with-psget-and-chocolatey.html

It uses PsGet to install the powershell module, and the whole approach is clean and well-structured.

If you go with this approach, the $installerType parameter is unnecessary.

Upvotes: 0

Gary Ewan Park
Gary Ewan Park

Reputation: 19021

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.

Upvotes: 6

Related Questions