Otter Documentation

powershell - Ensure DSC Resource

  • Last Modified: 2020-03-05

This is generated from the built-in components of Otter 2.2, and may be different than what you have installed (especially if you have extensions); go to [User Icon] > Documentation within your Otter instance to see exactly what operations are available.

Ensure DSC Resource

Ensures the configuration of a specified PowerShell DSC Resource.

Operation type:

Ensuring - this operation will ensure a specified configuration exists on a remote server after comparing its current state to the desired state.

Script usage:

Ensure-DscResource(
	[ConfigurationKey: <text>],
	Name: <text>,
	[Module: <text>],
	[Properties: <%(key1: value1, ...)>]
);

This operation may be prefixed with PowerShell::, although this is a built-in namespace and isn't really necessary.

Arguments:

Name Format Script Usage Usage Notes
Otter configuration key
text
ConfigurationKey
The name of the DSC property which will be used as the Otter configuration key for the server. If this is not specified, the "Name" property is used.
Resource
text
Name
This argument is required.
Module
text
Module
Properties
%(key1: value1, ...)
Properties
DSC property hashtable as an OtterScript map. Example: %(DestinationPath: C:\hdars\1000.txt, Contents: test file ensured)

Note: An argument may be explicitly converted to an integral type by prefixing the value with [type::<typeName>], where <typeName> is one of: int, uint, long, ulong, double, decimal. Normally this conversion is performed automatically and this is not necessary.

See also:

Example:

# ensures the existence of a file on the server
Ensure-DscResource(
  Name: File,
  ConfigurationKey: DestinationPath,
  Properties: %(
    DestinationPath: C:\hdars\1000.txt,
    Contents: test file ensured)
);

# runs a custom resource
Ensure-DscResource(
  Name: cHdars,
  Module: cHdarsResource,
  ConfigurationKey: LocalServer,
  Properties: %(
    MaximumSessionLength: 1000,
    PortsToListen: @(3322,4431,1123),
    Enabled: true)
);

Is this documentation incorrect or incomplete? Help us by contributing!

This documentation is licensed under CC-BY-SA-4.0 and stored in GitHub.

Generated from commit 979eb9fd on master