请求帮助来创建POWERSHELL DSC脚本

问题描述 投票:0回答:1

我被分配了一个脚本来创建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个回答
0
投票
错误消息

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

© www.soinside.com 2019 - 2024. All rights reserved.