Working around Workspace ONE’s inability to reinstall an application.

VMware Workspace ONE has so many easily fixed annoyances, not being able to reinstall applications is certainly one of them.

Why is this though?

Simply, when you install an application Workspace ONE performs the following on the client:

  1. The agent runs the success criteria check. If this passes, the install proceedure is marked as successful and exits.
  2. The agent runs the install command line
  3. The agent runs the success criteria check. If this passes, the install proceedure is marked as successful and exits.
  4. If unsuccessful, will retry as per the settings in UEM.

Step 1 is the issue when installing applications. If the App has successfully installed successfully, or if the success criteria is met for… reasons, then you are unable to rerun.

OK so thats good right?

Simply, when you install an application Workspace ONE performs the following on the client:

First up, we need to create a powershell script to install whatever it is we want to install.

Start-Process -FilePath  “$clientfolder\OfficeClickToRun.exe" -ArgumentList ”scenario=Repair platform=$bitness culture=$culture RepairType=QuickRepair" -Wait 
New-ItemProperty -Path "HKLM:\Software\WSnoneWorkarounds\Office365SelfServiceRepair" -Name "LastRunTimeEpoch" -Value ([DateTimeOffset]::Now.ToUnixTimeSeconds()) -PropertyType STRING

Fairly basic script, runs the office repair tool and then creates a registry key with a date and time. I like Epoch time, its so easy to apply math too. I’m old… 😛

Part 2 of this is to create a custom Check script, to address step 1 and fooling it to work.. But it needs to take in to account step 3 as well.

$LastRunTimeEpoch=(Get-ItemProperty -Path "HKLM:\Software\WSnoneWorkarounds\Office365SelfServiceRepair" -Name LastRunTimeEpoch).LastRunTimeEpoch
    $NowEpoch=[DateTimeOffset]::Now.ToUnixTimeSeconds()
    #If the Times are within 300 seconds (5 minutes) we assume successful install, if its greater then we "fail" so the script can run again
    
    if (($NowEpoch - $LastRunTimeEpoch) -lt 300)
        {
        #Successfull Install
        exit(0)
        }
    else
        {
        #rerun
        exit(1)
        }

Ok so what are we doing here…

First up, lets get the time the installer script ran as the time it is now. Once we have that, we check to see if the time the script ran was within 5 minutes. If it is, we exist with 0 which we configure in UEM as the success code. This allows the install to report back as successful. If its longer than 5 minutes, we fail it, so the package can run again.

Closing

So a reasonably simple workaround to the not being able to rerun an application install problem.

I have just provided the basics, I’d wack in some error checking and what not for a production script 😉

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.