Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

package_state_windows

This method manage packages using Chocolatey.

⚙️ Compatible targets: Windows

Parameters

NameDocumentation
PackageNameSoftware name to install.

This parameter is required.
Status'present' or 'absent', defaults to 'present'.

Choices:
  • present
  • absent

This parameter is optional.
Providerdefault to choco.

Choices:
  • choco

This parameter is optional.
Paramsparams to pass to the package installation.

This parameter is optional.
Versionversion, default to 'latest'.

This parameter is optional.
Sourcerepository source URL.

This parameter is optional.
ProviderParamsparameters to pass to the underlying choco command.

This parameter is optional.
AutoUpgradeautoUpgrade, default to false.

Choices:
  • true
  • false

This parameter is optional.

Outcome conditions

You need to replace ${PackageName} with its actual canonified value.

  • ✅ Ok: package_state_windows_${PackageName}_ok
    • ☑️ Already compliant: package_state_windows_${PackageName}_kept
    • 🟨 Repaired: package_state_windows_${PackageName}_repaired
  • ❌ Error: package_state_windows_${PackageName}_error

Example

method: package_state_windows
params:
  PackageName: VALUE
  Source: OPTIONAL_VALUE
  Params: OPTIONAL_VALUE
  Provider: choco
  AutoUpgrade: 'true'
  ProviderParams: OPTIONAL_VALUE
  Version: OPTIONAL_VALUE
  Status: present

Documentation

Install a windows package using Chocolatey. This method assume the following third party tools are already installed on the target node:

  • chocolatey cli: https://chocolatey.org/install
  • the cChoco DSC resource! https://github.com/chocolatey/cChoco

Please note that the cChoco DSC resource is no longer maintained by Chocolatey.

Parameters

Required args:

  • PackageName Name of target package
  • Status can be "present" or "absent"

Optional args:

  • Source: Chocolatey repository URL to retrieve the package from
  • AutoUpgrade default set to false
  • Params: Package parameters, passed to the installer
  • Version: 'latest' or any exact specific version number
  • ProviderParams: CLI options to pass to the underlying choco CLI used
  • Provider: Provider used to installed the package (always 'choco')