Skip to content

microsoft/CompositeResource

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Composite Resource Module

Build status

The purpose of this project is to provide a tool for converting PowerShell Desired State Configuration configurations to composite resources.

Installation:

Install-Module -Name compositeresource

Usage:

The tool does not convert a script file, it converts a configuration. This way writing out to a temporary file is never required.

From configuration file

If you are using MyConfiguration.ps1:

Configuration sampleConfig
{

}

you must first load the confguration into memory by executing MyConfiguration.ps1.

ConvertTo-CompositeResource -ConfigurationName 'sampleConfig' -Author 'Name' -Description 'Text'

From script

You can also compose the entire configuration inline and pass it in with the -script parameter.

$configurationScript = @"
Configuration Example3
{
    Import-DscResource -ModuleName PSDesiredStateConfiguration

    node localhost
    {
        WindowsFeature 'NetFramework45'
        {
            Name   = 'NET-Framework-45-Core'
            Ensure = 'Present'
        }
    }
}
"@

ConvertTo-CompositeResource -Script $configurationScript -Author 'Name' -Description 'Text'

Output:

<no command output returned when successful>

By default the tool will write a new folder based on the configuration name + 'DSC', e.g. 'TestDSC'. The folder contains a version folder which then contains a module and manifest. The module should be immediately functional once it is copied into a path present in $env:PSModulePath.

To test if the resource is available, run the command:

Get-DscResource

Release Notes

09/07/2018 - Michael Greene and Johan Ljunggren collaborated on a minimum viable product for the solution and published the result as an open source project on GitHub.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

About

Tool for creating PowerShell Desired State Configuration composite resources from configurations

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published