Last active
April 21, 2024 11:39
-
-
Save alimbada/449ddf65b4ef9752eff3 to your computer and use it in GitHub Desktop.
Export installed Chocolatey packages as packages.config - thanks to Matty666
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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
I added one line to this little script. Now, when it executes it automatically creates the pachages.config file that can be directly passed to chocolatey .