Octopus.Script exported 2020-07-28 by pauby belongs to ‘Chocolatey’ category.
Ensures that the Chocolatey package manager is installed on the system. The installer is downloaded from https://chocolatey.org if required.
Script body
Steps based on this template will execute the following PowerShell script.
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
Write-Output "Ensuring the Chocolatey package manager is installed..."
$chocolateyBin = [Environment]::GetEnvironmentVariable("ChocolateyInstall", "Machine") + "\bin"
$chocInstalled = Test-Path "$chocolateyBin\choco.exe"
if (-not $chocInstalled) {
Write-Output "Chocolatey not found, installing..."
$installPs1 = ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
Invoke-Expression $installPs1
Write-Output "Chocolatey installation complete."
} else {
Write-Output "Chocolatey was found at $chocolateyBin and won't be reinstalled."
}
Provided under the Apache License version 2.0.
To use this template in Octopus Deploy, copy the JSON below and paste it into the Library → Step templates → Import dialog.
{
"Id": "c364b0a5-a0b7-48f8-a1a4-35e9f54a82d3",
"Name": "Chocolatey - Ensure Installed",
"Description": "Ensures that the Chocolatey package manager is installed on the system. The installer is downloaded from https://chocolatey.org if required.",
"Version": 7,
"ExportedAt": "2020-07-28T13:42:22.284+00:00",
"ActionType": "Octopus.Script",
"Author": "pauby",
"Parameters": [],
"Properties": {
"Octopus.Action.Script.ScriptBody": "[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12\nWrite-Output \"Ensuring the Chocolatey package manager is installed...\"\n\n$chocolateyBin = [Environment]::GetEnvironmentVariable(\"ChocolateyInstall\", \"Machine\") + \"\\bin\"\n$chocInstalled = Test-Path \"$chocolateyBin\\choco.exe\"\n\nif (-not $chocInstalled) {\n Write-Output \"Chocolatey not found, installing...\"\n \n $installPs1 = ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))\n Invoke-Expression $installPs1\n \n Write-Output \"Chocolatey installation complete.\"\n} else {\n Write-Output \"Chocolatey was found at $chocolateyBin and won't be reinstalled.\"\n}\n",
"Octopus.Action.Script.Syntax": "PowerShell"
},
"Category": "Chocolatey",
"HistoryUrl": "https://github.com/OctopusDeploy/Library/commits/master/step-templates//opt/buildagent/work/75443764cd38076d/step-templates/chocolatey-ensure-installed.json",
"Website": "/step-templates/c364b0a5-a0b7-48f8-a1a4-35e9f54a82d3",
"Logo": "iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAMAAACahl6sAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAZhQTFRF////gLXjiEsuoG9YJCxcmcTpapS4cD8nuJOCoMjqlF1DrIFteqzbaZPBKjVkO05+k8DocJzDUnGgR1+PMD1tXoKwb5vKNUZ1daTSQVeGTGiXY4q5WHmodkIplWtXd0o0o3RdgkgsmmZOkVk+ga7YiFI5g5SqhmxnhmZbh1hFg42fhXNyj6/KhIeUs9PvgajMgpu2hXl9h19QhICJgqHBdEQtlGZQm2tVeUs1rYNvqXxosYl2roNwnW1WcEQwsId0mWpUm6m8onJbao+vmb/gkaK3oHRhs5SFfUw0nYF3fE44i6jGdkgygKfMkGJMiF5JbHSCnZSXcUYzqHtmdUYwa4Sdfpi0mrTOpXdhpHRec0Mrnm5XeYGRfqbMck4/noR8blpUhq/UbWpwhVdBhFZAcUEpr4ZylmxYnGlRs5WHek04lLXSjV9JfEoyfZ/An39zm3NgiLbVmZihrIp6uZaFq39qiFpEb09CnJ+qqn5pa4mmmH10nWtTilxGsYh1rtDuroRxbkk5jllAl2lTjY2VeWVfdGVka3mKgG9D1QAACAFJREFUeNrsmoV/20YUx2tLm7vmYBVZtHYQzrIkTbO2o65rx8zMzMzM//bu3juBKZUcqYnX9/t8+mliS9Z9H9/Fhw6RSCQSiUQikUgkEolEIpFIJBKJRCKRSCQSiUQikUiky0k3Gn141QHSrzcZ1QC50uho5wDp6iuMCIRACIRACIRACIRACIRACIRACIRACIRALgsQztn/AcQRtm3Hsw/i2iB31kFi24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