【问题标题】:Azure DSC, cannot load module xPSDesiredStateConfigurationAzure DSC,无法加载模块 xPSDesiredStateConfiguration
【发布时间】:2023-04-09 18:20:01
【问题描述】:

我正在尝试为使用资源管理器创建的 Azure VM 编写 DSC 配置。我想使用xRemoteFile,所以我尝试导入xPSDesiredStateConfiguration 模块,但是在部署时找不到。

我在网上搜索,得知我需要在部署之前安装 xPSDesiredStateConfiguration 模块。当我刚刚在 Azure 上创建 VM 时,我该怎么做?

配置文件开始:

Configuration Main
{
Param ( [string] $nodeName )

Import-DscResource -ModuleName PSDesiredStateConfiguration
Import-DscResource -Name MSFT_xRemoteFile -ModuleName xPSDesiredStateConfiguration

错误信息:

08:56:12 - [ERROR] + Import-DscResource -Name MSFT_xRemoteFile -ModuleName xPSDesiredState ...
08:56:12 - [ERROR] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
08:56:12 - [ERROR] The DSC engine could not load the module 'xPSDesiredStateConfiguration'. It 
08:56:12 - [ERROR] was not found on the system.".

【问题讨论】:

  • 这也适用于windows 2012r2。

标签: azure dsc


【解决方案1】:

如果您使用 Publish-AzureVMDscConfiguration cmdlet 创建 DSC 扩展的 zip 文件并且您在 PSModulePath 中具有 xPSDesiredStateConfiguration 资源的计算机上运行该 cmdlet,该 cmdlet 将获取该资源并为您将其填充到 zip 文件中 - 然后当 DSC 扩展在 VM 上运行时,它将从您的 zip 中提取资源并安装它。

如果您在 PSModulePath 以外的位置有 xPSDesiredStateConfiguration,请使用 cmdlet 上的 -AdditionalPath 参数指向该资源所在的位置...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-07-30
    • 2021-01-10
    • 2011-03-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-11
    • 2015-02-09
    相关资源
    最近更新 更多