Skip to content

Instantly share code, notes, and snippets.

@PSingletary
Forked from alimbada/Export-Chocolatey.ps1
Created December 30, 2017 01:17
Show Gist options
  • Save PSingletary/01c4eaead2ae57b5057be88ab714b10c to your computer and use it in GitHub Desktop.
Save PSingletary/01c4eaead2ae57b5057be88ab714b10c to your computer and use it in GitHub Desktop.
Export installed Chocolatey packages as packages.config - thanks to Matty666
Write-Output "<?xml version=`"1.0`" encoding=`"utf-8`"?>"
Write-Output "<packages>"
choco list -lo -r -y | % { " <package id=`"$($_.SubString(0, $_.IndexOf("|")))`" version=`"$($_.SubString($_.IndexOf("|") + 1))`" />" }
Write-Output "</packages>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment