PSDsc
  • 17 Feb 2022
  • 1 Minute to read
  • Dark
    Light
  • PDF

PSDsc

  • Dark
    Light
  • PDF

Article Summary

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

PSDsc

Ensures the configuration of a specified PowerShell DSC Resource.

Script usage:

PSDsc(
	[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:

NameFormatScript UsageUsage 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: This is a shorthand version of the Ensure-DscResource operation.

Default Argument: ResourceName: The default argument for this operation is the DSC Resource Name and should follow the format: "ModuleName::ResourceName". If "ModuleName::" is omitted, the PSDesiredStateConfiguration module will be used.

Configuration Key: Otter Specific: By default, Otter will use the Name property of the DSC Resource as the configuration key. If there is no Name property or you would like to override the default configuration key name, specify a property named "Otter_ConfigurationKey" with the value containing a string (or list of strings) indicating the name of the property (or properties) to be used as the unique configuration key.

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.

Example:

# ensures the existence of a file on the server
PSDsc File (
  Otter_ConfigurationKey: DestinationPath,
  DestinationPath: C:\hdars\1000.txt,
  Contents: test file ensured
);

# runs a custom resource
PSDsc cHdarsResource::cHdars (
  Otter_ConfigurationKey: LocalServer,
  MaximumSessionLength: 1000,
  PortsToListen: @(3322,4431,1123),
  Enabled: true
);

Was this article helpful?