Chocolatey Script bug?

This script is pretty simple. It pulls the variables from dropdowns. To separate applications, they must be listed like app1;app2;app3. Recently I started getting an error but only on the first run. If I run it again, it goes through fine.

1st run
“Chocolatey v1.1.0
Could not find a command registered that meets ‘adobereader;firefox;googlechrome’.
Try choco -? for command reference/help.
chocolatey
Call-SyncroApi: success”

Subsequent runs
“Chocolatey v1.1.0
Installing the following packages:
adobereader;firefox;googlechrome
By installing, you accept licenses for the packages.”

The second time, it installs everything properly. It’s like the first time, it is not passing the $action variable through since Choco believes the command is actually what is listed in the $app variable. Install is the default $action variable and I verified twice now when this happened that install was listed when I ran it.

Import-Module $env:SyncroModule

choco $action $app -y -f

$packages = choco list -l -r --idonly

Write-Output $packages

Set-Asset-Field -Name "Installed Choco Packages" -Value $packages

You could verify this with a write-host “action test: $action” and see if there’s any output. By first time do you mean per new machine or per reboot or what? Be interesting to know what ‘resets’ it.

This has happened a handful of times and it was on new systems. I run it right after and it goes through. Just started happening in the last few weeks. I’ll add the write-host and see what happens.

Are you also installing choco using this same script? I know when it’s first installed there can be issues until you start a new command/PS session.

I had restarted this particular machine a couple of times prior. The error when you don’t is that the term choco can’t be found, so it should be unrelated to this.