Avatar of ncomper
ncomper
 asked on

Audit My Documents Size on Local machines to plan for Folder Redirecttion

Hi All

We are planning to redirect our users My Documents to a file server, however prior to doing this i would like to know how much data we are going to end up with, is there a script that can go out to each PC and report back the size of the my documents folder, 95% of our estate is Windows 7 so  mostly concerned with this O/S,

Thanks
Active DirectoryWindows Server 2008Powershell

Avatar of undefined
Last Comment
ncomper

8/22/2022 - Mon
merowinger

Check out this article. The guy has the same question.
http://forums.petri.com/showthread.php?t=43178
footech

I haven't tested except on a local machine, but should work.
Using PS Remoting...
$computers = Get-Content computerlist.txt
$scriptblock = {
    Get-ChildItem c:\users | Get-ChildItem -filter "documents" |
     Get-ChildItem -Recurse -force -ea SilentlyContinue |
     Where { !($_.PsIsContainer) } |
     Select -expand length |
     Measure-Object -Sum |
     Select sum
}
Invoke-Command -ComputerName $computers -ScriptBlock $scriptblock | Export-CSV DocumentsSize.csv -notype

Open in new window

ncomper

ASKER
Thanks, does anything need to be enabled on the remote client machine, it runs on mine OK but not remote PC's (firewall etc is off)

Also is it possible to get the path in export so we know the user?

Thanks
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
ASKER CERTIFIED SOLUTION
footech

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ncomper

ASKER
Thanks