spicehead-53186
Member
- 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:
New Get-ChildItem Detection Method:
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:
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
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}
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