Forums on Intune, SCCM, and Windows 11

Welcome to the forums. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your topics and posts, as well as connect with other members through your own private inbox!

NEW SCCM Detection Script Help When No Uninstaller Present?

Messages
7
Reaction score
0
Points
1
Hello All,
I am BRAND NEW to SCCM and Scripting but I'm learning and boy is it fun!!

Detection method is to confirm if the s/w is installed correct? However most of the scripts I have seen seem to point to HKLM:\SOFTWARE\$_\Microsoft\Windows\CurrentVersion\Uninstall\ to confirm if the software is installed or not. However what if the software is not located in that registry then what do you do? Here is the scripts I was using to see if the s/w was installed or not.

s/w = Software XYZ
ver. = 10.3.0.3

-eq is equals
-ge is greater than or equals


Old WMI Detection Method:
Code:
$software = Get-WmiObject win32_product | where {$_.Name -eq "Software XYZ"} | where {$_.Version -ge "10.3.0.3"};if ($software) {$true}
New Get-ChildItem Detection Method:
Code:
$software = Get-ChildItem HKLM:\SOFTWARE\$_\Microsoft\Windows\CurrentVersion\Uninstall\ | ? {($_.GetValue("DisplayName")) -eq "Software XYZ"} | Where-Object {($_.GetValue("DisplayVersion")) -ge "10.3.0.3"};if ($software) {$true}

Not knowing better I did a search in the registry by software name and version and found where it seems to be located in the registry:

HKLM:\SOFTWARE\$_\Classes\Installer\Dependencies\

So with the help of google I came up with this script that seems to work, but I don't know how to figure out how to also add the version number as shown in the old/new detection methods above?

new NEW Detection Method:
Code:
$software = "Software XYZ";
$installed = (Get-ItemProperty HKLM:\SOFTWARE\$_\Classes\Installer\Dependencies\* | Where { $_.DisplayName -eq $software }) -ne $null

If(-Not $installed) {
    Write-Host "'$software' is NOT installed.";
} else {
    Write-Host "'$software' is installed."
}

Any and all input greatly appreciated, and feel free to let me know any tips and critics that will help me learn all this stuff better!

Regards,

Spicehead-53186
 

Forum statistics

Threads
7,067
Messages
27,613
Members
17,861
Latest member
NelsonMizutani

Trending content

Back
Top