I'd like to make a script to find a certain file on my c: drive.
If it founds the file it must output "file found" (preferably with the path) else "error not found". My script does this but… it gives me "error not found" for all the files that does not match.
$items = Get-ChildItem -Path "c:temp" -recurse
foreach ($item in $items)
if ($item -match "file.dll")
Write-Host "file found"
write-host "error not found"