In Powershell version 3 there is no way to limit the number of levels to do something in directories/registry/AD and so forth. So if you want to do that you can use a script like this:
[int]$Levels = "4" $Directory = "\\Directory" $List = GCI $Directory | Where {$_.psiscontainer -eq $true} $Templist = $list $temp = @() While ($levels -ne 1){ Foreach ($item in $Templist){ $Temp += gci $item.Fullname | Where {$_.PSisContainer -eq $True}} $list += $Temp $Templist = $Temp $Levels-- $Temp =@()} $list = $list | Sort-Object Fullname Foreach ($line in $List){Add-content -value $Line.Fullname -path ".\Export.csv"}