How To: Find files affecting your disk quota in Windows server (2003 or 2008)?

Was just wondering if anyone knows a script or tool that can be used to find all the files which affect a user's disk quota in Windows Server 2003/2008.

Any suggestions?


Solution 1:

Essentially, you need to tally the size of all files owned by you. A quick powershell hack:

[Int] $intSize = 0;
get-childitem -literalpath <rootdir> -recurse | foreach-object{ if ( ($_ | get-acl).owner -eq "<yourpc_or_domain>\<yourid>") { $intSize += $_.length } };
"Total size : " + $intSize;

...where <rootdir> is the root of the directory to check, <yourpc_or_domain> is the computer or domain of the account to check, and <yourid> is your.... errr, user ID.

Solution 2:

Try the DISKUSE.EXE tool from the Windows 2k3 resource kit, with command line options.
The options below scan the H: drive for files owned by mydomain\johnsmith, and output their size the day it was created, and full path to c:\tmp\files.txt

diskuse H:\ /f:c:\tmp\files.txt /u:mydomain\johnsmith /s/t/d:c /v

The output looks like:

DiskUse Output from 11/05/2013 at 09:43:19
------------------------------------------

User: mydomain\johnsmith
SpaceUsed: 5535722202

    4,689,108,412 : 11/03/2013 : h:\home\johnsmith\files\meninblack3.mp4
              169 : 07/06/2012 : h:\home\johnsmith\files\somefile.doc
              <snip>

Solution 3:

Spacemonger 1.4 is an old graphical tool that I have used that achieves exactly that. It displays the space occupied by various files graphically. See this example.

You need to find version 1.4 though. That is the last freeware version they released. You can find it here