Windows 10
A Microsoft operating system that runs on personal computers and tablets.
12,002 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
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
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.