Examples/Demo1.ps1
cls configuration Demo1 { Import-DscResource -module xjea xJeaToolKit ProcessToolkit { Name = 'ProcessToolkit' CommandSpecs = @" name,Parameter,ValidateSet,ValidatePattern Get-Process Get-Service stop-process,name,calc;notepad restart-service,name,,^A "@ } xJeaEndPoint Demo1EP { Name = 'Demo1EP' Toolkit = 'ProcessToolkit' DependsOn = '[xJeaToolKit]ProcessToolkit' } } Demo1 -OutputPath C:\DSCDemo Start-DscConfiguration -Path C:\DSCDemo -ComputerName localhost -Verbose -wait start-sleep -Seconds 30 #Wait for WINRM to restart $s = New-PSSession -cn . -ConfigurationName Demo1EP Invoke-command $s {get-command} |out-string Invoke-Command $s {get-command stop-process -Syntax} # Enter-pssession $s Remove-PSSession $s #EOF |