4

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?

eidylon
  • 358
  • 1
  • 7
  • 20

4 Answers4

5

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.

Simon Catlin
  • 5,232
  • 3
  • 17
  • 20
  • 1
    Okay, that actually just shows the total size, but with a little hacking around, (my first venture into PowerShell!) I made it more what i need `$path = (Read-Host "What path?"); $usr = (Read-Host "Which user?"); get-childitem -literalpath $path -recurse | Where {($_ | get-acl).owner -eq $usr} | Sort-Object length | Select-Object @{Name="Owner";Expression={($_ | get-acl).owner}},Name,Length,FullName;` – eidylon Oct 29 '10 at 19:30
  • The next question though... the computers I want to deploy this too don't have PS installed, and chances of getting the corporate gods to install it are slim to none. Is there any way to compile this to a portable executable file? – eidylon Oct 29 '10 at 19:30
  • Not aware of a compiler for PS. If the users that you are querying are domain users, there's no reason why you can'y query the drives via a unc from a central pc. – Simon Catlin Nov 01 '10 at 20:50
3

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>
RobW
  • 2,806
  • 1
  • 19
  • 22
  • This does not report all the files – RuiDC Sep 17 '15 at 14:40
  • Can you be more specific? – RobW Sep 21 '15 at 05:38
  • The sum size of the files reported did not match with the total returned by Disk Quota screen, despite running in administrator mode. But I've yet to see a pattern as to why. It *might* be a difference in size on disk vs file size due to compression etc. – RuiDC Sep 21 '15 at 14:50
1

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

Bourne
  • 1,039
  • 5
  • 18
  • 24
  • That looks like it would just show all files on the network drive, no? I'm looking specifically to find MY files, that are specifically affecting my quota (or replace MY with any user's logon really). – eidylon Oct 29 '10 at 18:11
  • Spacemonger will allow you to zoom in and out of folders so you can see what takes up the space inside of a specific older. It is not just fixed to display the root of the drive. That way you can just zoom in to C:\Documents and Settings\User and see what is taking up the space. The only requirement is that you run it as administrator. Also, it is just an executable. No installation involved. – Bourne Oct 29 '10 at 21:28
0

SIMPLY one line, below!

Find all files owned by a specific user: fsutil file findbysid

eg. If the user name = "fredsmith" and we want to check everywhere on the E: drive!

Type at the command line:

fsutil file findbysid fredsmith e:\

  • 1
    I don't see any recursion options with fsutil. How might I get it to look through subdirectories? –  Dec 05 '11 at 17:03