I added a do while statement to the script so the script will keep trying to install until the program is installed. Below is the complete script. Can anyone confirm if this is the correct way to this.
Downloads and installs Citrix WorkspaceApp.
Intended to run via Intune.
# If WorkspaceApp is already installed, skip download and install
Intune does report a success as soon as the script is successful executed from Intune perspective. If you like to get en error in the console when something fails during msi install you must write en explicit error with write-error.
I have compiled some information how to deal with Intune in regards of PowerShell scripts and common questions here:
Remember the scripts have a timeout of 10 min. so if your retries taking to long it will report failure. Also your loop is not restricted it has the potential to loop forever. I would test my install very well and do nothing like loops, I would write out errors as described in my PS template.