I'm trying to get Chocolatey installed to manage packages on a a windows VM using Powershell DSC.
I've prepared my configuration file
Configuration chocandfirefox {
Import-DscResource -ModuleName cChoco
Import-DscResource -ModuleName cChocoInstaller
Import-DscResource -ModuleName cChocoPackageInstaller
Node 'localhost' {
cChocoInstaller installChoco
{
InstallDir = "c:\ProgramData\chocolatey"
}
cChocoPackageInstaller installGit
{
Name = "firefox"
DependsOn = "[cChocoInstaller]installChoco"
}
}
}
But when I try to compile it to a .mof, I'm told
> + Import-DscResource -ModuleName cChocoInstaller
> + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Could not find the module 'cChocoInstaller'. At
> C:\Users\auser\Documents\PowerShell\DSC\Configuration_chocandfirefox.ps1:4
> char:5
> + Import-DscResource -ModuleName cChocoPackageInstaller
> + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Could not find the module 'cChocoPackageInstaller'.
> + CategoryInfo : ParserError: (:) [], ParseException
> + FullyQualifiedErrorId : ModuleNotFoundDuringParse
I'm sure I'm missing something fundamental but I've worked through docs on DSC and Chocolatey and can't spot it.
You should only need to import
cChoco.Looking at one of the examples provided in the GitHub repository, we can see:
They're using
cChocoInstallerafter only importingcChoco.cChocoInstalleris a resource within the modulecChoco.