Tech Community Live: Microsoft Intune
Mar 20 2024, 07:30 AM - 11:30 AM (PDT)
Microsoft Tech Community

Installing programs with Powershell not always consistant

Iron Contributor

We installing a few programs with Powershell because they are not single MSI


Whe use the script that is mentioned at this page and edit to install other software.


Now we have experienced that this is running and the status in Intune shows succeeded. But sometimes the software is not always installed even though the status shows succeeded.


Is there any way to check if the software is really installed.  My experience is that if the status shows succeeded the script doesn't run any more and the software never gets installed

4 Replies

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

If  ((!(Get-WmiObject -Class Win32_Product | Where-Object Name -Like "Citrix Workspace*"))) {


    # Citrix Workspace App download source

    $Url = ""

    $Target = "$env:SystemRoot\Temp\CitrixWorkspaceApp.exe"


    # Delete the target if it exists, so that we don't have issues

    If (Test-Path $Target) { Remove-Item -Path $Target -Force -ErrorAction SilentlyContinue }


    # Download Citrix Receiver locally

    Start-BitsTransfer -Source $Url -Destination $Target


    # Install Citrix Receiver

    If (Test-Path $Target) { Start-Process -FilePath $Target -ArgumentList "/AutoUpdateCheck=auto /AutoUpdateStream=Current /AllowAddStore=N /DeferUpdateCount=5 /AURolloutPriority=Medium /NoReboot /Silent EnableCEIP=False" -Wait }




} while ((!(Get-WmiObject -Class Win32_Product | Where-Object Name -Like "Citrix Workspace*")))

Hi Ronald,


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:


Also I have a PS template for installing apps via PS script with correct error handling:




Hi Oliver


Thank you again for your response. I will look into your deep dive information. I already know about these pages but haven't had the time yet to look in to it.


In the meantime can you confirm that my temporary solution with a do while loop will assure that an application is installed?

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.