ForEach ($Folder in Get-ChildItem "G:\Temp\A\")
{
$FolderC = $false
ForEach ($Fld in Get-ChildItem $($Folder.FullName) -Recurse)
{
If ($Fld.Name -eq "C") {$FolderC = $true}
}
if ($FolderC) {Write-Host "$($Folder.FullName) содержит папку 'C'"}
}