Forum Discussion
Installing programs with Powershell not always consistant
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
- RonaldvdMeerIron Contributor
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:
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
- RonaldvdMeerIron Contributor
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?