Skip to content

Instantly share code, notes, and snippets.

@akramarev
Forked from alimbada/Export-Chocolatey.ps1
Created January 19, 2019 07:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akramarev/9397811147aaeccd648165f9eb3e48d0 to your computer and use it in GitHub Desktop.
Save akramarev/9397811147aaeccd648165f9eb3e48d0 to your computer and use it in GitHub Desktop.
Export installed Chocolatey packages as packages.config - thanks to Matty666
#Put this in Export-Chocolatey.ps1 file and run it:
#Export-Chocolatey.ps1 > packages.config
#You can install the packages using
#choco install packages.config -y
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