我正在尝试安装 Chocolatey 以使用 Powershell DSC 管理 Windows VM 上的包。
我已经准备好我的配置文件
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"
}
}
}
但是当我尝试将其编译为 .mof 时,有人告诉我
> + 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
我确定我错过了一些基本的东西,但我已经研究过DSC和Chocolatey的文档,但无法发现它。