Ich verwende dazu robocopy mit diesem Befehl.
robocopy "C:\Users\Administrator\Downloads" NULL /L /S /NJH /BYTES /FP /NC /NDL /XJ /TS /R:0 /W:0
In Powershell kannst du das mit Get-ChildItem.
(Get-ChildItem -Path "C:\Pfad\zum\Ordner" -Directory -Recurse).Count