powershell - DSC, compiling a ps1 file into MOF -
i'm trying configure target node via dsc.
i've created .ps1 file dummy configuration; can see below; it's 1 of first examples find in dsc sites.
want compile .mof file. i've executed:
ps c:\var\dsc\configurations> . .\localhost.ps1
but nothing. mof file doesn't appear , no error messages thrown. missing?
configuration fileresourcedemo { node "localhost" { file directorycopy { ensure = "present" # can set ensure "absent" type = "directory" # default "file". recurse = $true # ensure presence of subdirectories, sourcepath = "c:\users\public\documents\dscdemo\demosource" destinationpath = "c:\users\public\documents\dscdemo\demodestination" } log afterdirectorycopy { # message below gets written microsoft-windows-desired state configuration/analytic log message = "finished running file resource id directorycopy" dependson = "[file]directorycopy" # means run "directorycopy" first. } } }
the configuration
keyword merely defines configuration (think of function
keyword). after have execute it, calling function (it can have parameters, though yours not).
so if, @ end of .ps1
file add:
fileresourcedemo
it execute right after defining it.
or, since dot sourcing file according question, can directly execute interactively typing fileresourcedemo
prompt. should tab-complete.
Comments
Post a Comment