Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

Managing DSC Resources



  • I would like to use DSC resources to handle things that the "out of the box" actions do not cover, specifically, NTFS permissions after an "ensure directory" call and managing some repository registrations.

    In order to use a DSC module, I am assuming that the module must be installed on the Otter server, but do I have to install it on the target server or will Otter handle that? Is there some other action that must be taken to make sure that I am able to leverage that DSC resource?

    Product: BuildMaster
    Version: 6.0.4



  • Hi Paul,

    Your best bet would probably be to use Role Dependencies - the parent role would ensure that the module is installed:

    # Parent Role
    PSEnsure
    (
        Key: InstallDSC,
        Value: 0,
        Collect: "if(Get-Module -Name cNtfsAccessControl -List -ErrorAction SilentlyContinue) { exit 0 } else { exit -1 }",
        Configure: install-module -Name cNtfsAccessControl -Force,
        UseExitCode: true
    );
    

    Then, in the dependent role, you can safely use the module:

    # Dependent Role
    PSDsc cNtfsAccessControl::cNtfsPermissionsInheritance
    (
        Otter_ConfigurationKey: ApplyPermissions_Key,
        Path: c:\temp,
        PreserveInherited: true,
        Enabled: true
    );
    

    Note that this usage of Role Dependencies will require Otter 2.0.8 or later. In any case, if you don't want to or can't use Role Dependencies, you can simply put the PSEnsure operation inside an alwaysExecute block.

    Does this help?



Inedo Website HomeSupport HomeCode of ConductForums GuideDocumentation