issues with win32 custom detection script

Trevor v 0 Reputation points
2023-01-15T05:49:47.0466667+00:00

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.

thanks

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.
11,196 questions
Microsoft Intune
Microsoft Intune
A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.
4,743 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Rahul Jindal [MVP] 9,791 Reputation points MVP
    2023-01-15T06:47:48.2333333+00:00

    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