-
$cItems = Get-ChildItem -Path $ScanLocation -Recurse -Force | Where-Object { !$_.PSIsContainer -and $_.Name -like "java*.exe"} if ($cItems.Length -gt 0) { Write-Host "Found }
Edited by Lars Scheibling -
$ScanLocation = "C:\Program Files" $ScanLocation2 = "C:\Program Files (x86)" $cItems = Get-ChildItem -Path $ScanLocation -Recurse -Force | Where-Object { !$_.PSIsContainer -and $_.Name -like "java*.exe"} $dItems = Get-ChildItem -Path $ScanLocation2 -Recurse -Force | Where-Object { !$_.PSIsContainer -and $_.Name -like "java*.exe"} if ($cItems.Length -gt 0 -or $dItems.Length -gt 0) { Write-Host "Found }
Please register or sign in to comment