How do I use Install-Package inside a DSC configuration pull?

I would like to have a DSC config that check to see if a package like xFirefox is installed and if not it installs it. Google keeps sending me in circles on this so I was hoping somebody here could point to an example configuration…

The DSC resources in https://github.com/PowerShell/PackageManagementProviderResource might be what you’re looking for. Or if you want a Chocolatey package, perhaps https://github.com/PowerShellOrg/cChoco .

Thanks Dave :slight_smile: I am trying the Choco route and found an article with a DSC config in it:

https://github.com/Azure/azure-content/blob/master/articles/automation/automation-dsc-cd-chocolatey.md

Trying this however I get squiggley lines under:
Import-DscResource -ModuleName cChcoco

I downloaded cChoco-master.zip from:
https://github.com/PowerShellOrg/cChoco - then I renamed it cChoco_2.0.5.22.zip,

moved it to:
C:\Program Files\WindowsPowerShell\DscService\Modules

…and finally created a new-dscchecksum for it. Not sure what I’m missing since the Powershell ISE obviously does not see it. Any suggestions?

The ISE needs the module to just be installed on your system (somewhere in $env:PSModulePath). The zip / checksum thing is for a pull server; clients that are configured to use that pull server to obtain resources will download and install modules from there, but that doesn’t affect the machine where you’re authoring the config.

Ah ok thanks! Not keeping track of my modules lol!