Unpacking Software Livestream

Join our monthly Unpacking Software livestream to hear about the latest news, chat and opinion on packaging, software deployment and lifecycle management!

Learn More

Chocolatey Product Spotlight

Join the Chocolatey Team on our regular monthly stream where we put a spotlight on the most recent Chocolatey product releases. You'll have a chance to have your questions answered in a live Ask Me Anything format.

Learn More

Chocolatey Coding Livestream

Join us for the Chocolatey Coding Livestream, where members of our team dive into the heart of open source development by coding live on various Chocolatey projects. Tune in to witness real-time coding, ask questions, and gain insights into the world of package management. Don't miss this opportunity to engage with our team and contribute to the future of Chocolatey!

Learn More

Calling All Chocolatiers! Whipping Up Windows Automation with Chocolatey Central Management

Webinar from
Wednesday, 17 January 2024

We are delighted to announce the release of Chocolatey Central Management v0.12.0, featuring seamless Deployment Plan creation, time-saving duplications, insightful Group Details, an upgraded Dashboard, bug fixes, user interface polishing, and refined documentation. As an added bonus we'll have members of our Solutions Engineering team on-hand to dive into some interesting ways you can leverage the new features available!

Watch On-Demand
Chocolatey Community Coffee Break

Join the Chocolatey Team as we discuss all things Community, what we do, how you can get involved and answer your Chocolatey questions.

Watch The Replays
Chocolatey and Intune Overview

Webinar Replay from
Wednesday, 30 March 2022

At Chocolatey Software we strive for simple, and teaching others. Let us teach you just how simple it could be to keep your 3rd party applications updated across your devices, all with Intune!

Watch On-Demand
Chocolatey For Business. In Azure. In One Click.

Livestream from
Thursday, 9 June 2022

Join James and Josh to show you how you can get the Chocolatey For Business recommended infrastructure and workflow, created, in Azure, in around 20 minutes.

Watch On-Demand
The Future of Chocolatey CLI

Livestream from
Thursday, 04 August 2022

Join Paul and Gary to hear more about the plans for the Chocolatey CLI in the not so distant future. We'll talk about some cool new features, long term asks from Customers and Community and how you can get involved!

Watch On-Demand
Hacktoberfest Tuesdays 2022

Livestreams from
October 2022

For Hacktoberfest, Chocolatey ran a livestream every Tuesday! Re-watch Cory, James, Gary, and Rain as they share knowledge on how to contribute to open-source projects such as Chocolatey CLI.

Watch On-Demand

Downloads:

19,493

Downloads of v 0.2:

4,536

Last Update:

17 May 2023

Package Maintainer(s):

Software Author(s):

  • bcurran3

Tags:

bcurran3 choco protocol cinst chocolateasy winconfig

(unofficial) choco:// Protocol support

  • 1
  • 2
  • 3

0.2 | Updated: 17 May 2023

Downloads:

19,493

Downloads of v 0.2:

4,536

Maintainer(s):

Software Author(s):

  • bcurran3

(unofficial) choco:// Protocol support 0.2

  • 1
  • 2
  • 3

All Checks are Passing

3 Passing Tests


Validation Testing Passed


Verification Testing Passed

Details

Scan Testing Successful:

No detections found in any package files

Details
Learn More

Deployment Method: Individual Install, Upgrade, & Uninstall

To install (unofficial) choco:// Protocol support, run the following command from the command line or from PowerShell:

>

To upgrade (unofficial) choco:// Protocol support, run the following command from the command line or from PowerShell:

>

To uninstall (unofficial) choco:// Protocol support, run the following command from the command line or from PowerShell:

>

Deployment Method:

NOTE

This applies to both open source and commercial editions of Chocolatey.

1. Enter Your Internal Repository Url

(this should look similar to https://community.chocolatey.org/api/v2/)


2. Setup Your Environment

1. Ensure you are set for organizational deployment

Please see the organizational deployment guide

2. Get the package into your environment

  • Open Source or Commercial:
    • Proxy Repository - Create a proxy nuget repository on Nexus, Artifactory Pro, or a proxy Chocolatey repository on ProGet. Point your upstream to https://community.chocolatey.org/api/v2/. Packages cache on first access automatically. Make sure your choco clients are using your proxy repository as a source and NOT the default community repository. See source command for more information.
    • You can also just download the package and push it to a repository Download

3. Copy Your Script

choco upgrade choco-protocol-support -y --source="'INTERNAL REPO URL'" [other options]

See options you can pass to upgrade.

See best practices for scripting.

Add this to a PowerShell script or use a Batch script with tools and in places where you are calling directly to Chocolatey. If you are integrating, keep in mind enhanced exit codes.

If you do use a PowerShell script, use the following to ensure bad exit codes are shown as failures:


choco upgrade choco-protocol-support -y --source="'INTERNAL REPO URL'" 
$exitCode = $LASTEXITCODE

Write-Verbose "Exit code was $exitCode"
$validExitCodes = @(0, 1605, 1614, 1641, 3010)
if ($validExitCodes -contains $exitCode) {
  Exit 0
}

Exit $exitCode

- name: Install choco-protocol-support
  win_chocolatey:
    name: choco-protocol-support
    version: '0.2'
    source: INTERNAL REPO URL
    state: present

See docs at https://docs.ansible.com/ansible/latest/modules/win_chocolatey_module.html.


chocolatey_package 'choco-protocol-support' do
  action    :install
  source   'INTERNAL REPO URL'
  version  '0.2'
end

See docs at https://docs.chef.io/resource_chocolatey_package.html.


cChocoPackageInstaller choco-protocol-support
{
    Name     = "choco-protocol-support"
    Version  = "0.2"
    Source   = "INTERNAL REPO URL"
}

Requires cChoco DSC Resource. See docs at https://github.com/chocolatey/cChoco.


package { 'choco-protocol-support':
  ensure   => '0.2',
  provider => 'chocolatey',
  source   => 'INTERNAL REPO URL',
}

Requires Puppet Chocolatey Provider module. See docs at https://forge.puppet.com/puppetlabs/chocolatey.


4. If applicable - Chocolatey configuration/installation

See infrastructure management matrix for Chocolatey configuration elements and examples.

Package Approved

This package was approved by moderator gep13 on 22 May 2023.

Description

screenshot of choco-protocol-support

Implements installing of Chocolatey packages from the web using choco:// Protocol.

WHO IS THIS FOR?

choco-protocol-support is designed for those who aren't comfortable with the Command Prompt or just don't like to type much. choco-protocol-support allows you to install Chocolatey packages by simply clicking choco:// URLs in your web browser. choco-protocol-support is also useful for support professionals who know the difficulty of getting end users to type in commands correctly. Now you can give end users a URL via e-mail or corporate software webpage to click and have a Chocolatey package installed!

If you like the convienance of this package, you should also check out Install Chocolatey Packages from your Web Browser which is very similar in concept as well as (unofficial) Chocolatey Shortcuts (Config). All three of these make installing Chocolatey packages very user friendly.

HOW DOES IT WORK?

choco-protocol-support configures Windows to use choco://packagename URLs and pass them along to choco-protocol-support.ps1 which then processes the URL and runs "choco install" or "choco upgrade" to install or upgrade the package. This ability will be baked natively into a future version of Chocolatey and then this package can be retired.

USAGE INSTRUCTIONS:

Just click a choco://packagename URL on a web page and the package will install after one or two approval clicks.
Browser examples: Chrome | Firefox | Opera

Easy peasy, Chocolateasy!

INTRODUCING THE FIRST choco:// URLS ON THE INTERNET:

(AKA Other fine 3rd party Chocolatey utilities by BCURRAN3)
choco://instchoco - (unofficial) InstChoco - The ULTIMATE Chocolatey and Chocolatey packages (re)installer!
choco://choco-package-list-backup - (unofficial) Choco Package List Backup to Local and Cloud
choco://choco-cleaner - (unofficial) Choco Cleaner
choco://choco-upgrade-all-at - (unofficial) Choco Upgrade All at
choco://choco-shortcuts-winconfig - (unofficial) Chocolatey Shortcuts
choco://chocolatey-toast-notifications.extension - (unofficial) Chocolatey Toast Notifications
choco://chocolatey-preinstaller-checks.extension - (unofficial) Chocolatey Preinstaller Checks
choco://choco-install-packages-from-web-winconfig - (unofficial) Install Chocolatey Packages from your Web Browser

WARNING: Only install one package at a time until such time as Chocolatey is multi-instance aware or it will corrupt itself. (REFERENCE)

Read the Release Notes for a practical use you can use now.


If you find choco-protocol-support useful, please consider donating:
https://www.paypal.me/bcurran3donations or become a patron at https://www.patreon.com/bcurran3



tools\.SkipAutoUninstaller
 
tools\choco-protocol-support.ps1
# choco-protocol-support.ps1 Copyleft 2017-2023 by Bill Curran AKA BCURRAN3
# LICENSE: GNU GPL v3 - https://www.gnu.org/licenses/gpl.html
# Suggestions? Problems? Open a GitHub issue at https://github.com/bcurran3/ChocolateyPackages/issues

param(
     [Parameter()]
     [string]$chocoprotocolURL
 )
 
$chocopackageoptions=$null
$installarguments=$null
$params=$null
$upgrade=$false
$version=$null

$ErrorActionPreference = 'Continue'
Write-Host "Choco-Protocol-Support.ps1 v0.2 (2023-05-17) - install Chocolatey packages from URLs" -Foreground White
Write-Host "Copyleft 2017-2023 Bill Curran ([email protected]) - free for personal and commercial use`n" -Foreground White

if (!($chocoprotocolURL)){Write-Warning "choco URL not provided, nothing to do!"; return}

Write-Host "  ** Processing $chocoprotocolURL" -ForegroundColor Magenta

$chocoprotocolURL=$chocoprotocolURL.trimend('/')
$chocoprotocolURL=$chocoprotocolURL.replace('choco://','')
[array]$chocoprotocolURL=$chocoprotocolURL.split("/")
$packagename=($chocoprotocolURL[0])

for($num=0; $num -lt $chocoprotocolURL.count; $num++) {
	if ($chocoprotocolURL[$num] -match 'version=') {$version=($chocoprotocolURL[$num]); $version=$version.replace('version=','')}
	if ($chocoprotocolURL[$num] -match 'v=') {$version=($chocoprotocolURL[$num]); $version=$version.replace('v=','')}
	if ($chocoprotocolURL[$num] -match 'params=') {($params=$chocoprotocolURL[$num]); $params=$params.replace('params=','')}
	if ($chocoprotocolURL[$num] -match 'installarguments=') {($installarguments=$chocoprotocolURL[$num]); $installarguments=$installarguments.replace('arguments=','')}
    if ($chocoprotocolURL[$num] -match 'source=') {($source=$chocoprotocolURL[$num]); $source=$source.replace('source=','')}
	}
	
if (Test-Path $env:ChocolateyInstall\lib\$packagename\$packagename.nuspec) {
	[xml]$nuspecFile = Get-Content "$env:ChocolateyInstall\lib\$packagename\$packagename.nuspec"
	$OldVersion = $nuspecFile.package.metadata.version
	$upgrade=$true
}

if (!$upgrade) {
	Write-Host "  ** INSTALLING $packagename" -NoNewline -ForegroundColor Magenta
	if ($version){Write-Host " v$version" -NoNewline -Foreground Magenta}
} else {
	Write-Host "  ** UPGRADING $packagename" -NoNewline -ForegroundColor Magenta
	if ($version){Write-Host " v$OldVersion to v$version" -NoNewline -Foreground Magenta}
}
if ($params){Write-Host " params: $params" -NoNewline -Foreground Magenta}
if ($installarguments){Write-Host " install arguments: $installarguments" -NoNewline -Foreground Magenta}
if ($source){Write-Host " source: $source" -NoNewline -Foreground Magenta}

if (!$upgrade) {$chocopackagecommand='install'} else {$chocopackagecommand='upgrade'}
if ($version) {$chocopackageoptions=$chocopackageoptions + " --version=$version"}

Start-Process -Filepath "$env:ChocolateyInstall\choco.exe" -ArgumentList "$chocopackagecommand -y $packagename $chocopackageoptions" -Wait -Verb RunAs

Write-Host "`n`nFound choco-protocol-support.ps1 useful?" -ForegroundColor White
Write-Host "Buy me a beer at https://www.paypal.me/bcurran3donations" -ForegroundColor White
Write-Host "Become a patron at https://www.patreon.com/bcurran3" -ForegroundColor White
Start-Sleep -s 5

# TDL 
# error checking for malformed URLs
# add parameters, install arguments, and source support (Going to need a LOT of difficult parsing!)
# MAYBE a config file that allows toggling of parameters, install arguments, source, etc. 
# Theoretically possible to add all choco install options and switches, but why?

tools\ChocolateyInstall.ps1
$ErrorActionPreference = 'Stop'
$packageName = 'choco-protocol-support'
$toolsDir    = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
$scriptDir   = "$(Get-ToolsLocation)\BCURRAN3"
$script      = 'choco-protocol-support.ps1'

# Setup
# New storage location moving forward for all my Chocolatey scripts
if (!(Test-Path "$(Get-ToolsLocation)\BCURRAN3")) { New-Item -Path "$(Get-ToolsLocation)" -Name "BCURRAN3" -ItemType "Directory" | Out-Null }

# Install Script
# Move new files and support files (if applicable)
Move-Item "$toolsDir\$script" "$scriptDir" -Force -ErrorAction SilentlyContinue

# Create "shim"
Install-ChocolateyPowershellCommand -PackageName "$packageName" -PSFileFullPath "$scriptDir\$script"

# Cleanup
Remove-Item "$toolsDir\$script" -Force -ErrorAction SilentlyContinue | Out-Null

# Setup choco:// Protocol in the registry and assign it to run choco-protocol-support.cmd which in turn runs choco.exe with help from Sudo
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT -ea SilentlyContinue | Out-Null
New-Item -Path "HKCR:" -Name "choco" –Force | Out-Null
Set-ItemProperty -Path "HKCR:\choco" -Name "(Default)" -Value '"URL:choco Protocol"' | Out-Null
Set-ItemProperty -Path "HKCR:\choco" -Name "URL Protocol" -Value '""' | Out-Null
New-Item -Path "HKCR:\choco" -Name "shell" –Force | Out-Null
New-Item -Path "HKCR:\choco\shell" -Name "open" –Force | Out-Null
New-Item -Path "HKCR:\choco\shell\open" -Name "command" –Force | Out-Null
Set-ItemProperty -Path "HKCR:\choco\shell\open\command" -Name "(Default)" -Value  """$env:ChocolateyInstall\bin\choco-protocol-support.bat"" ""%1""" | Out-Null
tools\ChocolateyUninstall.ps1
$ErrorActionPreference = 'Stop'
$packageName = 'choco-protocol-support'
$scriptDir   = "$(Get-ToolsLocation)\BCURRAN3"

New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT -ea SilentlyContinue | Out-Null
Remove-Item -Path "HKCR:choco" -Recurse –Force | Out-Null
Remove-Item "$env:ChocolateyInstall\bin\choco-protocol-support.bat" -Force -ErrorAction SilentlyContinue
Remove-Item "$scriptDir\choco-protocol-support.*" -Force -ErrorAction SilentlyContinue | Out-Null

Log in or click on link to see number of positives.

In cases where actual malware is found, the packages are subject to removal. Software sometimes has false positives. Moderators do not necessarily validate the safety of the underlying software, only that a package retrieves software from the official distribution point and/or validate embedded software against official distribution point (where distribution rights allow redistribution).

Chocolatey Pro provides runtime protection from possible malware.

Add to Builder Version Downloads Last Updated Status
(unofficial) choco:// Protocol support 0.0.1.1 5627 Friday, April 8, 2022 Approved
(unofficial) choco:// Protocol support 0.0.1 9296 Wednesday, December 26, 2018 Approved

Sounds cool but where can I use it now?

You can install any Chocolatey package from the Chocolatey Community Repository website using Chrome with the help of BananaAcid's Chocolatey Appstore Theme for Chrome (unofficial)! Chrome Web Store direct link

CHANGELOG:

  • 0.2 - Rewritten in PowerShell, changed use of cinst.exe to choco.exe (install) for Chocolatey v2 compatibility, sudo dependency removed as no longer needed, added version support, now checks for the package and uses choco upgrade instead of choco install when appropriate
  • 0.0.1.1 - Removed Chocolatey dependency as Chocolatey v1.0 has been released and missed the 1.x milestone of becoming multi-instance aware and no new known goal. Added gsudo support.
  • 0.0.1 - Initial release.

ROADMAP:

  • Add parameters, install arguments, and source support (Going to need a LOT of difficult parsing for escaping!)
  • Add a config file that allows setting of default parameters, install arguments, source, etc.
  • Error checking for malformed URLs (Low priority, this resposibility should fall on the webmaster.)
  • Theoretically it's possible to add all choco install options and switches, but why?

This package has no dependencies.

Discussion for the (unofficial) choco:// Protocol support Package

Ground Rules:

  • This discussion is only about (unofficial) choco:// Protocol support and the (unofficial) choco:// Protocol support package. If you have feedback for Chocolatey, please contact the Google Group.
  • This discussion will carry over multiple versions. If you have a comment about a particular version, please note that in your comments.
  • The maintainers of this Chocolatey Package will be notified about new comments that are posted to this Disqus thread, however, it is NOT a guarantee that you will get a response. If you do not hear back from the maintainers after posting a message below, please follow up by using the link on the left side of this page or follow this link to contact maintainers. If you still hear nothing back, please follow the package triage process.
  • Tell us what you love about the package or (unofficial) choco:// Protocol support, or tell us what needs improvement.
  • Share your experiences with the package, or extra configuration or gotchas that you've found.
  • If you use a url, the comment will be flagged for moderation until you've been whitelisted. Disqus moderated comments are approved on a weekly schedule if not sooner. It could take between 1-5 days for your comment to show up.
comments powered by Disqus