Create a Custom Detection Script for Tableau Desktop 2024 (PowerShell)

Microsoft Endpoint Manager Configuration Manager (MEMCM / SCCM) and Microsoft Intune use Detection Rules to determine the presence of Applications & Win32 Apps. The detection rules ensure that application installations only begin to run if the application is not already installed on the device. This article will serve as an informative guide and give you a clear understanding of how to create an updated custom detection script for each new version of Tableau Desktop 2024 using PowerShell.

How to Create a Custom Detection Script for Tableau Desktop 2024

Tableau Desktop 2024 (File Detection Method)

## Check for Tableau Desktop 2024 (File Detection Method)
$TableauDesktopExe = (Get-ChildItem -Path "C:\Program Files\Tableau\Tableau 2024*\bin\tableau.exe" -ErrorAction SilentlyContinue)
$TableauDesktopExe.FullName
$TableauDesktopPath = $($TableauDesktopExe.FullName).Replace("C:\Program Files\","")
$FileVersion = (Get-Item -Path "$($TableauDesktopExe.FullName)" -ErrorAction SilentlyContinue).VersionInfo.FileVersion

## Create Text File with Tableau Desktop 2024 File Detection Method
$FilePath = "C:\Windows\Temp\Tableau_Desktop_2024_Detection_Method.txt"
New-Item -Path "$FilePath" -Force
Set-Content -Path "$FilePath" -Value "If([String](Get-Item -Path `"`$Env:ProgramFiles\$TableauDesktopPath`" -ErrorAction SilentlyContinue).VersionInfo.FileVersion -ge `"$FileVersion`"){"
Add-Content -Path "$FilePath" -Value "Write-Host `"Installed`""
Add-Content -Path "$FilePath" -Value "Exit 0"
Add-Content -Path "$FilePath" -Value "}"
Add-Content -Path "$FilePath" -Value "else {"
Add-Content -Path "$FilePath" -Value "Exit 1"
Add-Content -Path "$FilePath" -Value "}"
Invoke-Item $FilePath
  • Click Run Script (F5)
  • A text file will open with the Tableau Desktop 2024 Detection Method script required to detect the current version of Tableau Desktop 2024 that is installed on the device you are running the script from.

Example:

If([String](Get-Item -Path "$Env:ProgramFiles\Tableau\Tableau 2024.1\bin\tableau.exe" -ErrorAction SilentlyContinue).VersionInfo.FileVersion -ge "20241.24.0208.0337"){
Write-Host "Installed"
Exit 0
}
else {
Exit 1
}

Tableau Desktop 2024 (Registry Detection Method)

## Check for Tableau Desktop 2024 (Registry Detection Method)
$TableauDesktop = Get-ChildItem -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" | Get-ItemProperty | Where-Object {$_.DisplayName -like 'Tableau 2024*' } | Select-Object -Property DisplayName, DisplayVersion, PSChildName
$TableauDesktop.DisplayVersion
$TableauDesktop.PSChildName

## Create Text File with Tableau Desktop 2024 Registry Detection Method
$FilePath = "C:\Windows\Temp\Tableau_Desktop_2024_Detection_Method.txt"
New-Item -Path "$FilePath" -Force
Set-Content -Path "$FilePath" -Value "If([Version](Get-ItemPropertyValue -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$($TableauDesktop.PSChildName)' -Name DisplayVersion -ea SilentlyContinue) -ge '$($TableauDesktop.DisplayVersion)') {"
Add-Content -Path "$FilePath" -Value "Write-Host `"Installed`""
Add-Content -Path "$FilePath" -Value "Exit 0"
Add-Content -Path "$FilePath" -Value "}"
Add-Content -Path "$FilePath" -Value "else {"
Add-Content -Path "$FilePath" -Value "Exit 1"
Add-Content -Path "$FilePath" -Value "}"
Invoke-Item $FilePath
  • Click Run Script (F5)
  • A text file will open with the Tableau Desktop 2024 Detection Method script required to detect the current version of Tableau Desktop 2024 that is installed on the device you are running the script from.

Example:

If([Version](Get-ItemPropertyValue -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{F61B3BCB-8F0C-4A09-9626-AF83E9B2F6E8}' -Name DisplayVersion -ea SilentlyContinue) -ge '24.1.623') {
Write-Host "Installed"
Exit 0
}
else {
Exit 1
}

Always make sure to test everything in a development environment prior to implementing anything into production. The information in this article is provided “As Is” without warranty of any kind.

Jason Bergner

I am an accomplished Software Engineer at Patch My PC, leveraging more than 18 years of hands-on experience in Configuration Manager administration and application packaging. I am driven by a genuine passion for solving complex problems and consistently strive to discover innovative and effective solutions. Sharing my extensive knowledge of application deployments is a true joy for me, and I am honored to contribute to the community here at Silent Install HQ.

Recent Posts