Hello everyone,
I would like to propose a small option on a software item (or on a group association): “run only after the host has been renamed and joined to the domain”.
Today, on a fresh deploy, the agent enrolls, runs the snapins and then runs the Chocolatey software module, and only after that does it rename the host and join it to the domain, which ends in a reboot. That order is fine for Chrome or VLC. It is a problem for installers that do their real work in a second stage after the first one returns. Our case is the Avast Business agent: the MSI returns 0 in about ten seconds, but the antivirus itself is downloaded and installed afterwards, over the next few minutes. If the join reboot lands in the middle, the install can be left half done, and from FOG’s side everything looks fine because the Chocolatey package reported success.
What we do today is a workaround inside the package script: if the computer name is still the image name, the script throws on purpose, so nothing gets installed, and then we rely on FOG running the software again after the reboot. It works, but it has some rough edges that a native option would remove:
When the script throws, the software status row for that host is not updated. It keeps the old state (converged from a previous run), so the web UI never shows that the package failed. We only knew from the host itself.
We had to rely on the retry. By watching the web server log we saw that after each boot the agent runs the Chocolatey module about four times, roughly a minute apart, and then not again for hours (we saw passes about every six hours). So if the retry after the join reboot is missed, the next chance is a long way off.
The software status list of the host survives a new deploy. When an image is deployed, pending tasks such as snapins are cleared, but the old software status rows stay, so a freshly cloned host still shows software as converged or installed from the previous install. That is also why a failed package could not be told apart from an old success. The machine is new after a deploy, so that list should not be kept.
We first tried to detect “not joined yet” with the domain membership, but that does not work: the agent renames the host and joins the domain in the same step, and both only become effective after the reboot, so right before it Windows already reports the host as part of the domain while it still has the image name. The host name was the only reliable signal.
So the request would be, in order of importance:
An option per software item (or per group) to defer it until after the rename/join reboot.
Recording a failed Chocolatey run in the software status (failed, with the output), instead of leaving the previous status.
Clearing the host’s software status list when a deploy finishes, the same way pending snapin tasks are cleared, since the machine is new.
I am not sure the ordering is the only thing behind our Avast problem, since we also had a separate crash of the vendor installer that seems unrelated, so I am only asking for the generic behavior, which would help with any installer that continues working after it returns.
Happy to share logs or test a patch if it helps. Thanks!