write a script to get users desktop and documents size, and run the script as sccm package


I need to run Hardware Inventory to get users desktop and documents size. I like to run the batch file as a package  to a large number of  win7 laptops. If anyone has any knowledge, this subject, please help me out. 
We are planning to refresh,and move users desktop and documents to our Network drive, before we do that need to know how much space we need. if  you need more information, please let me know. 

Thank you in advance . 

2 Comments   [ + ] Show comments
  • I was thinking some ITNINJA will answer my question, but i think its a new to them as well. - Litonmc 3 years ago
  • I don't know much about SCCM, but a quick Google search of "windows script folder size" comes up with a bunch of options for getting this done through batch scripts or PowerShell commands. Have you tried any of those? - JasonEgg 3 years ago

Answers (1)

Posted by: nagendrasingh 3 years ago
Black Belt
You can try this or any such file.

This one is from https://superuser.com/questions/837016/how-can-i-check-the-size-of-a-folder-from-the-windows-command-line

$totalsize=[long]0;gci -File -r -fo -ea Silent|%{$totalsize+=$_.Length};$totalsize

You can see the result of running this file in  C:\Users\nasingh\Desktop\rental folder below

PS C:\Users\nasingh\Desktop\rental> $totalsize=[long]0;gci -File -r -fo -ea Silent|%{$totalsize+=$_.Length};$totalsize

You can append the results on a file on a remote share. Or you can generate individual text files and later merge them. Some data manipulation with MS Excel would put it in a single .xlsx file.

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:


This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ