Home

Installing programs with Powershell not always consistant

Ronald Meer
Contributor

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

 

Whe use the script that is mentioned at this page https://stealthpuppy.com/deploy-citrix-receiver-intune/#.W5UiIkUzbOQ 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.

 

<#

.SYNOPSIS

    Downloads and installs Citrix WorkspaceApp.

    Intended to run via Intune.

#>

 

do{

# 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 = "https://downloadplugins.citrix.com/Windows/CitrixWorkspaceApp.exe"

    $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:

https://oliverkieselbach.com/2018/02/12/part-2-deep-dive-microsoft-intune-management-extension-power...

 

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

https://github.com/okieselbach/Intune/blob/master/ManagementExtension-Samples/IntunePSTemplate.ps1

 

best,

Oliver

Highlighted

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.

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
46 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
29 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies