ubernewb
ubernewb

Reputation: 1

List application data folder for multiple users powershell

We are having issue with folder redirection and want to split this up among two servers instead of one. One of the folders we are redirecting is the Application Data folder. We want to enumerate this folder for each user so we can decide how big the new shared volume should be. Is there a way to do this in power shell?

Upvotes: 0

Views: 373

Answers (1)

Little King
Little King

Reputation: 1120

Recursive loops my friend. Perhaps someone has a better idea, but this was my approach. The output is also fun to watch :)

EDIT: $total is in BYTES. Be sure to do the conversion to what you need.

$total = 0 function Get-Childrens{ param($fullName) Get-ChildItem $fullName | foreach{ if((Get-Item $_.FullName).VersionInfo.FileName){ Write-Host $_.FullName $total += (Get-Item $_.FullName).Length }else{ Write-Host $_.FullName -ForegroundColor Green Get-Childrens $_.FullName } } } Get-Childrens "C:\Users\username\AppData\"

Upvotes: 0

Related Questions