sccm detection Method script detect not installed application

FrancK 21 Reputation points
2022-11-25T12:39:35.227+00:00

Hello,

I try deploy a application, and i use a custom script to detect the presence of deployment type.

Script :

$DisplaylinkDriversVersion = (Get-WindowsDriver -Online -All -EA Stop | Where{$_.ClassDescription -eq 'Cartes graphiques' -and $_.OriginalFileName -like '*dlidusb.inf'}).Version  
  
ForEach ($DisplaylinkDriverVersion in $DisplaylinkDriversVersion)  
{  
	[Version]$Version = $DisplaylinkDriverVersion  
    If ($Version -ge '10.1.2875.0')  
    {  
        Write-output "Installed"  
        Exit 0  
    }  
}  
Clear-Host  
Exit 0  

This Script return the correct result in manual launch script:
264208-launchscriptinpowershellconsole.png

Don't detect installed application:
264188-appdiscovery.png

I tried with 'write-host', with or without 'exit 0', the result is the same.

have you a idea ?

Microsoft Security | Intune | Configuration Manager | Application
{count} votes

Accepted answer
  1. CherryZhang-MSFT 6,496 Reputation points
    2022-11-29T02:19:21.11+00:00

    Hi @Rakesh Kumar ,

    Thanks for your feedback and sharing. We're glad that the question is fixed now. Here's a short summary for the problem, we believe this will help other users to search for useful information more quickly. It's appreciated that you could click "Accept Answer" to the reply. If there's anything else we can help in the future, feel free to post in our Q&A to discuss together.

    Problem/Symptom:
    SCCM detection Method script detect not installed application

    Reason:
    1, The full OS Windows 10 is in French, but MECM launch scripts is in English
    2, In the PowerShell console, the property 'ClassDescription' is equal to 'Cartes graphiques', in script launch with MECM, the 'ClassDescription' is equal to 'Display adapters'.

    Solution/Workaround:
    Modified the script to:

    $DisplaylinkDriversVersion = (Get-WindowsDriver -Online -All -EA Stop | Where{$_.ClassDescription -eq 'Display adapters' -and $_.OriginalFileName -like '*dlidusb.inf'}).Version  
    
      ForEach ($DisplaylinkDriverVersion in $DisplaylinkDriversVersion)  
      {  
          [Version]$Version = $DisplaylinkDriverVersion  
          If ($Version -ge '10.1.2875.0')  
          {  
              Write-output "Installed"  
              Exit 0  
          }  
      }  
      Clear-Host  
      Exit 0  
    

    Thanks again for your time! Have a nice day!

    Best regards,
    Cherry

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. FrancK 21 Reputation points
    2022-11-28T09:23:01.013+00:00

    Hello,

    Nobody has a idea ?

    0 comments No comments

  2. FrancK 21 Reputation points
    2022-11-28T17:25:54.123+00:00

    Hello,

    I found the cause of the problem.

    I use a full OS Windows 10 French, but MECM launch this scripts in english !!

    In my powershell console, the property 'ClassDescription' is equal to 'Cartes graphiques', in script launch with MECM, the 'ClassDescription' is equal to 'Display adapters'.

    My modified script is :

    $DisplaylinkDriversVersion = (Get-WindowsDriver -Online -All -EA Stop | Where{$_.ClassDescription -eq 'Display adapters' -and $_.OriginalFileName -like '*dlidusb.inf'}).Version  
          
     ForEach ($DisplaylinkDriverVersion in $DisplaylinkDriversVersion)  
     {  
         [Version]$Version = $DisplaylinkDriverVersion  
         If ($Version -ge '10.1.2875.0')  
         {  
             Write-output "Installed"  
             Exit 0  
         }  
     }  
     Clear-Host  
     Exit 0  
    

    Thank you for your help

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.