issues with win32 custom detection script

Trevor v 0 Reputation points

hi im trying to run a custom script for application in intune but im having trouble with the detection script which im trying to use multiple paths to detect the .exe. this is what have so far. application doesn't install for me. Feel free to edit and update with what you think might work.


Fixed it works.

$paths = "C:\Program Files (x86)\Spirion", "C:\Program Files (x86)\Identity Finder 8", "C:\Program Files (x86)\Identity Finder 9"
foreach ($path in $paths) {
    if (Test-path "$path\IdentityFinder.exe") {
        Write-Host "IdentityFinder.exe found in $path"
        exit 0

Write-Host "IdentityFinder.exe not found in any of the specified paths"
exit 1
Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
10,165 questions
Microsoft Intune
Microsoft Intune
A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.
4,056 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Rahul Jindal [MVP] 8,851 Reputation points MVP

    I normally use if test-path. Something like - if( !( ( test-path c:\abc.exe ) -and ( test-path c:\abc\abc.exe)) then rest of your condition.

    0 comments No comments