You can use the Datastore provider for this kind of searches.
Something like this
&{foreach($dcinGet-Datacenter){
foreach($datastoreinGet-Datastore-Location$dc){
New-PSDrive-Location$datastore-NameDS-PSProviderVimDatastore-Root'\'|Out-Null
$snap=Get-ChildItem-PathDS:\|
Where{$_.PSIsContainer-and$_.Name-eq".snapshot"}
if($snap){
$recent=Get-ChildItem-PathDS:\.snapshot|
Where{$_.PSIsContainer-and$_.Name-match"_recent"}
if($recent){
$result="Folder found"
}
else{
$result=".snapshot\*_recent not found"
}
}
else{
$result=".snapshot folder not found"
}
Remove-PSDrive-NameDS-Confirm:$false
$result|Select-Object@{N="Datacenter";E={$dc.Name}},
@{N="Datastore";E={$datastore.Name}},
@{N="Result";E={$_}}
}
}} |Export-Csvreport.csv-NoTypeInformation-UseCulture