Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Powershell DSC, Output MOF to different folder

Tags:

powershell

dsc

Given this simple configuration file:

Configuration MyDscConfiguration {

    Node "TEST-PC1" {
        WindowsFeature MyFeatureInstance {
            Ensure = "Present"
            Name =  "RSAT"
        }
        WindowsFeature My2ndFeatureInstance {
            Ensure = "Present"
            Name = "Bitlocker"
        }
    }
}
MyDscConfiguration

When run, the MOF file generated for Node "TEST-PC1", will be placed in a sub-directory named, MyDscConfiguration.

I am looking for a way to output the MOF to a custom directory location, e.g. mofs\MyDscConfiguration\

Is this possible?

like image 650
Brettski Avatar asked Mar 07 '23 04:03

Brettski


1 Answers

Yes, your configuration has an -OutputPath parameter you can give it.

Configurations are, essentially, functions and work mostly the same way.

You can even use Get-Help MyDscConfiguration to see all the parameters it has (you can define your own param() block with it too, just like you would for a function).

TAB completion works too, so that's a quick way to discover the params.

like image 72
briantist Avatar answered Mar 11 '23 23:03

briantist