Examples/Demo2.ps1

cls
write-host @"
Demo2 illustrates:
   - Dependencies to order creation of resources
   - Constraining parameters of commands
"@


configuration Demo2
{
    Import-DscResource -module xjea

    xJeaToolKit Demo2Toolkit
    {
        Name         = 'Demo2Toolkit'
        CommandSpecs = @"
name,Parameter,ValidateSet,ValidatePattern
Get-Process
Get-Service
stop-process,name,calc;notepad
restart-service,name,,^A
"@

    }
    xJeaEndPoint Demo2EP
    {
        Name        = 'Demo2EP'
        Toolkit     = 'Demo2Toolkit'
        DependsOn = '[xJeaToolKit]Demo2Toolkit'
    }



}

Demo2 -OutputPath C:\DSCDemo

Start-DscConfiguration -Path C:\DSCDemo -ComputerName localhost -Verbose -wait

start-sleep -Seconds 10 #Wait for WINRM to restart

$s = New-PSSession -cn . -ConfigurationName Demo2EP
Invoke-command $s {get-command} |out-string
Invoke-Command $s {get-command stop-process -Syntax}
enter-pssession $s