Skip to content

ChocolateyPackage

dscbot edited this page Apr 19, 2023 · 2 revisions

ChocolateyPackage

Parameters

Parameter Attribute DataType Description Allowed Values
Ensure Required Ensure
Name Key String The name of the ChocolateyPackage to set in the desired state.
Version Write String The version of the package to install. If not set, it will only ensure the package is present/absent. If set to latest, it will always make sure the latest version available on the source is the one installed. If set to a version it will try to compare and make sure the installed version is greater or equal than the one desired.
ChocolateyOptions Write hashtable Chocolatey parameters as per the Install or Update chocolateyPackage commands.
Credential Write PSCredential
UpdateOnly Read bool Only update the package if present. When absent do not attempt to install.
Reasons Read ChocolateyReason[] Reason for compliance or non-compliance returned by the Get method.

Description

The ChocolateyPackage DSC Resource helps with chocolatey package management.

Examples

Example 1

This is an unofficial module with DSC resource to Install and configure Chocolatey.

configuration Example
{
    Import-DscResource -ModuleName Chocolatey

    Node localhost {
        ChocolateyPackage Putty {
            Ensure            = 'Present'
            Name              = 'Putty'
            Version           = 'Latest'
            ChocolateyOptions = @{
                source = 'https://chocolatey.org/api/v2/'
            }
        }
    }
}

Example 2

This is an unofficial module with DSC resource to Install and configure Chocolatey.

configuration Example
{
    Import-DscResource -ModuleName Chocolatey

    Node localhost {
        ChocolateyPackage Putty {
            Ensure  = 'Absent'
            Name    = 'Putty'
        }
    }
}

Example 3

This is an unofficial module with DSC resource to Install and configure Chocolatey.

configuration Example
{
    Import-DscResource -ModuleName Chocolatey

    Node localhost {
        ChocolateyPackage Putty {
            Ensure            = 'Present'
            Name              = 'Putty'
            ChocolateyOptions = @{
                source = 'https://chocolatey.org/api/v2/'
            }
        }
    }
}