Get-ChildItem -Path $env:windir -Force -Recurse -ErrorAction SilentlyContinue |
Where-Object { $_.PSIsContainer -eq $false } |
Measure-Object |
Select-Object -ExpandProperty Count
[System.IO.Directory]::GetFiles($env:windir, '*', 'AllDirectories').Count