Search code examples
powershelldsc

DSC, having a simple script executed on a target node


I've create a simple MOF file:

Configuration ConfigName  
{  

  Node NB05  
  {  
    File ResName  
  { 
} 

Edit 1

This is not a mof file, but a file that has to be compiled into a mof file. This will be the focus on another question since this question applies nevertheless.

And I tried to apply it with the command:

PS C:\var\DSC> Start-DscConfiguration

Cmdlet Start-DscConfiguration at position 1 in the command pipeline
Please specify values for the follwing parameters:
Path: .\Configurations

Id     Name            PSJobTypeName   State         HasMoreData    Location             Command
--     ----            -------------   -----         -----------     --------             -------
1      Job1            Configuratio... Running       True            c1                   Start-DscConfiguration

Questions

  1. It says "runnning" but how can I determine that it has finished?
  2. Even if I make a mistake in the config file, say that i write NNNode, it doesn't give an error at all, but says "Running" as well. How is it supposed to work?

Solution

  • The other cmdlets associated with this cmdlet are located here: https://msdn.microsoft.com/powershell/reference/5.1/PSDesiredStateConfiguration/Start-DscConfiguration?f=255&MSPPError=-2147217396

    Get-DscConfiguration

    Get-DscConfigurationStatus

    Restore-DscConfiguration

    Stop-DscConfiguration

    Test-DscConfiguration

    Update-DscConfiguration

    This cmdlet by default runs as a job. This will run in the background. If you want it to run interactively, use the -wait parameter.

    start-dscconfiguration -path "c:\example\configurations" -wait
    

    To view further information about the job use:

        get-job -name job1
    

    The job will run periodically to keep the desired state of the system.

    Hope this helps.

    Thanks, Tim.