Using DiskUse.exe, I have scripted UserSpace.bat to report the total disk space that each user consumes on a set of file system objects that you specify.

The syntax for using UserSpace.bat is:

UserSpace ReportFile Object1 \[object2 ... objectN\]


ReportFile is the file that will receive the output, in the CSV format of "User","<Space Used>".                              ObjectX    is a file system object, like C: or \\ComputerName\C$ or \\ComputerName\ShareName.
NOTE: Other scripts that use DiskUse.exe are:
        How can I generate a report of sorted file sizes?                              	How can I return the disk space used by an owner in a folder?
UserSpace.bat contains:
                              @echo off                              if \{%2\}

\{\} @echo syntax: UserSpace ReportFile Object1 \[object2 ... objectN\]&goto :EOF setlocal EnableDelayedExpansion set report=%1 if exist %report% del /q %report% set rpt1="%TEMP%\UserSpace1_%RANDOM%.tmp" set rpt2="%TEMP%\UserSpace2_%RANDOM%.tmp" set rpt3="%TEMP%\UserSpace3_%RANDOM%.tmp" @echo User: NONE>%rpt1% @echo SpaceUsed: 0>>%rpt1% shift :loop if \{%1\}

\{\} goto reportit set object=%1 if not exist %object% @echo Syntax: UserSpace %object% NOT found.&goto loop1 call :quiet>nul 2>&1 copy %rpt1%+%rpt2% %rpt3% >nul del /q %rpt2% copy %rpt3% %rpt1% /Y >nul del /q %rpt3% :loop1 shift goto loop :quiet diskuse %object% /s /f:%rpt2% goto :EOF :reportit for /f "Tokens=1*" %%a in ('type %rpt1%^|findstr "User: SpaceUsed:"') do ( if "%%a" EQU "User:" set usr="%%b" if "%%a" EQU "SpaceUsed:" @echo !usr!,"%%b">>%rpt2% ) @echo "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ","0">>%rpt2% del /q %rpt1% sort %rpt2% /O %rpt1% del /q %rpt2% set prev="NONE" set total=0 for /f "Tokens=1* Delims=," %%a in ('type %rpt1%') do ( if /i %%a NEQ !prev! call :out %%a call :add %%b ) del /q %rpt1% endlocal goto :EOF :out if %prev% EQU "NONE" goto outend @echo !prev!,"!total!">>%report% :outend set total=0 set prev=%1 goto :EOF :add set numb=%1 set numb=%numb:"=% for /f %%i in ('domath //nologo "!Total! + %numb%"') do ( set total=%%i )