0
votes

I was assigned a script to create a POWERSHELL DSC script The exercise is: Your task is to design and implement a generic PowerShell DSC script for deploying and running any executable as a Windows Service. I started writing a configuration file But for some reason the script didn't run well.

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

Helloworld

Start-DscConfiguration -Wait -Verbose -Path .\HelloWord
1
What's the error message? Are you at an elevated prompt? - js2010

1 Answers

0
votes

the error message

    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