Skip to content

ChocolateySource

dscbot edited this page Mar 31, 2023 · 1 revision

ChocolateySource

Parameters

Parameter Attribute DataType Description Allowed Values
Ensure Write Ensure Indicate whether the Chocolatey source should be installed or removed from the system.
Name Key string Name - the name of the source. Required with some actions. Defaults to empty.
Source Write string Source - The source. This can be a folder/file share or an http location. If it is a url, it will be a location you can go to in a browser and it returns OData with something that says Packages in the browser, similar to what you see when you go to https://chocolatey.org/api/v2/. Defaults to empty.
Disabled Write Nullable[bool] Allow the source to be registered but disabled.
ByPassProxy Write Nullable[bool] Bypass Proxy - Should this source explicitly bypass any explicitly or system configured proxies? Defaults to false. Available in 0.10.4+.
SelfService Write Nullable[bool] Allow Self-Service - Should this source be allowed to be used with self- service? Requires business edition (v1.10.0+) with feature 'useBackgroundServiceWithSelfServiceSourcesOnly' turned on. Defaults to false. Available in 0.10.4+.
Priority Write Nullable[int] Priority - The priority order of this source as compared to other sources, lower is better. Defaults to 0 (no priority). All priorities above 0 will be evaluated first, then zero-based values will be evaluated in config file order. Available in 0.9.9.9+.
Username Write String
Password Write String
Credential Write pscredential Credential used with authenticated feeds. Defaults to empty.
Reasons Read ChocolateyReason[]

Description

Chocolatey will allow you to interact with sources. You can register a new source, whether internal or external with some source specific settings such as proxy.

Examples

Example 1

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

configuration Example
{
    Import-DscResource -ModuleName Chocolatey

    Node localhost {
        ChocolateySource ChocolateyOrg {
            Ensure   = 'Present'
            Name     = 'Chocolatey'
            Source   = 'https://chocolatey.org/api/v2'
            Priority = 0
            Disabled = $false
        }
    }
}

Example 2

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

configuration Example
{
    Import-DscResource -ModuleName Chocolatey

    Node localhost {
        ChocolateySource ChocolateyOrg {
            Ensure = 'Absent'
            Name   = 'Chocolatey'
        }
    }
}