View Question

Good news! We have migrated all the Q&A on this site to https://forums.inedo.com, and are currently monitoring questions there!

Here are some important links:

All posts here are permanently locked (and will be redirected soon), and if you have any issues with the new site, please submit a support ticket, use the contact form, or visit our Slack Workspace.

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?