Before install check to see if an application is installed before proceeding

I would like to create an install of and application but another application needs to be installed first.
I would like to use the Get-InstalledApplication command but I’m not really sure how to create the if statement to check for the application and if it is there to continue with the install.

Hi Peter,

A short example to get you started:
$Installed=Get-InstalledApplication -Name ‘7-Zip 21.07 (x64 edition)’
If ($Installed) {Write-Host “Application is installed”}

You can try out the different functions in the toolkit (like Get-InstalledApplication) by dot sourcing the main script in a powershell session, execute below command when located in the AppDeployToolkit folder to achieve this:
. .\AppDeployToolkitMain.ps1

Depending on what software deployment platform you are using - you could configure a dependancy, to do just this so you don’t have to do it in a script (It’s sometimes better to have all the apps separate and maintained by the deployment platform)
In Intune I have quite a few apps configured with dependencies, So here is an example:
For Adobe Photoshop 2024 (v25.2) I have configured a dependency defined that requires Adobe Bridge 2024 (v14.0.1) to be installed:

For users devices that are instructed by Intune to install a particular app if the dependent app (Adobe Bridge in the above example) is already installed, it will proceed with the install of the App containing the dependency (Adobe PhotoShop in the above example).
If however, the dependent app is not already installed, it will automatically install this first (Bridge) before installing the App containing the dependency (Photoshop).

I hope that makes sense?

@Adrian_Scott I guess I was trying to make PSADT do everything and totally forgot about the dependences in SCCM and Intune. This would be a much better way to do it.
In my head I was looking for the PSADT to look for Civil 3D and if it wasn’t there show a popup window that said something like “Autodesk Civil 3D is not installed. Please install Civil 3D and try the install again.”
However, creating the Dependency is a better way to go I think.

Thank you

1 Like

Dependencies are great, however there is one nugget I forgot to share…
:face_with_open_eyes_and_hand_over_mouth:
Remember to update any dependencies if an updated version is made available (to fix a bug or security vulnerability), as in some circumstances where you might have a separate process that uninstalls old versions where a newer version is subsequently installed (We have this in the form of an Intune Remediation script that removes old Oracle JRE installs once a new one has been installed)
As it can save the situation of users devices getting in an endless loop: {remove old version then re-installing the (dependant) old version}
:laughing:
Each time a new JRE is released, We have to remember the couple of apps we have, that need to have their Oracle JRE version dependency updated.

Carlson Survey is not that fussy it just needs Civil 3D installed to apply the addon.

1 Like

Hi Peter, i’ve been using the below code in the “PRE-INSTALLATION” section to test for the uninstall guid, if not found then run the code.

this is an example testing for access 2013 runtime which the app required as part of its install.

$Access2013 = "Access2013\setup.exe"
$AccessReg = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{90150000-001C-0409-1000-0000000FF1CE}"
if(!(Test-Path -Path $AccessReg)) {
    Execute-Process -path "$dirFiles\$Access2013" -Parameters '/config .\access2013rt.xml'  -WaitForMsiExec:$true
}
1 Like