【问题标题】:Request help creating a POWERSHELL DSC script请求帮助创建 POWERSHELL DSC 脚本
【发布时间】:2020-06-06 02:37:51
【问题描述】:

我被分配了一个脚本来创建 POWERSHELL DSC 脚本 练习是:您的任务是设计和实现一个通用 PowerShell DSC 脚本,用于将任何可执行文件作为 Windows 服务部署和运行。 我开始写配置文件 但由于某种原因,脚本运行不佳。

Configuration helloworld
{
    Node localhost
    {
        script SayHello
        {
            GetScript = { @{} }
            TestScript = { $false }
            SetScript = { wite-verbose "Hello World" } 
        }
    }
}

Helloworld

Start-DscConfiguration -Wait -Verbose -Path .\HelloWord

【问题讨论】:

  • 错误信息是什么?您是否处于高位提示?

标签: powershell powershell-dsc


【解决方案1】:

错误信息

    Start-DscConfiguration -Wait -Verbose -Path .\HelloWord
WARNING: The configuration 'helloworld' is loading one or more built-in resources without explicitly importing associated modules. Add Import-DscResource –ModuleName 'PSD
esiredStateConfiguration' to your configuration to avoid this message.


    Directory: C:\Users\admin\helloworld


Mode                LastWriteTime         Length Name                                                                                                                    
----                -------------         ------ ----                                                                                                                    
-a----       22/02/2020     08:19           1952 localhost.mof                                                                                                           
Start-DscConfiguration : .\HelloWord is not a valid directory.
At line:16 char:1
+ Start-DscConfiguration -Wait -Verbose -Path .\HelloWord
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Start-DscConfiguration], ArgumentException
    + FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.DesiredStateConfiguration.Commands.StartDscConfigurationCommand

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-06-22
    • 2018-08-08
    • 1970-01-01
    • 1970-01-01
    • 2016-11-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多