I'm writing a set of PS scripts to help set up and maintain a Windows dev environment. Right now, I am maintaining two script files, one for installing Chocolatey packages, and another for upgrading the same packages.
The two scripts are very straightforward, they look more or less like this:
# choco-install.ps1
choco install git
choco install VisualStudioCode
# ...
# choco-upgrade.ps1
choco upgrade git
choco upgrade VisualStudioCode
# ...
I'd like to merge these into a single script that, for each package, will install it if it's not installed, and upgrade the package if it is installed already. I'd like to be able to share these scripts, therefore they must not interfere with other Chocolatey packages that a user might have installed.
Is there a built-in chocolatey command to accomplish this, or another powershell trick I could use?