Search all fixed drives for PHP-related EXE and DLL files...
# Search all fixed drives for PHP-related EXE and DLL files
# Save as Find-PHPFiles.ps1
$results = foreach ($drive in Get-CimInstance -ClassName Win32_LogicalDisk `
-Filter "DriveType = 3")
{
Write-Host "Searching $($drive.DeviceID)..." -ForegroundColor Cyan
Get-ChildItem -Path "$($drive.DeviceID)\" `
-Recurse `
-File `
-ErrorAction SilentlyContinue `
-Include *php*.exe, *php*.dll |
Select-Object FullName, Length, LastWriteTime
}
$results = $results | Sort-Object FullName -Unique
$results | Format-Table -AutoSize -Wrap
$results | Export-Csv `
-Path "C:\temp\PHP-Binary-Discovery.csv" `
-NoTypeInformation
Write-Host "`nFound $($results.Count) matching files."
Write-Host "Results saved to PHP-Binary-Discovery.csv"