Solved

script to let me know disk space usage

Posted on 2004-10-26
215 Views
Last Modified: 2010-04-14
Good Day All,

Because of depleting hard drive space my boss asked me to come up with a script that will enable me to know who specifically is taking more than 400 megs of space. Since I know nothing of scripting could someone please point me in the right direction to obtain such a script. The company is running Windows 2000 server with AD sp4.

Many thanks,

Tacobell2000
0
Question by:Tacobell2000
    7 Comments
     
    LVL 2

    Expert Comment

    by:gavin_wickens
    Do you mean local drive space or network drive space?  You could use disk quota on the server.
    0
     

    Author Comment

    by:Tacobell2000
    Sorry...I mean network drive space. We have about 1000 users and I would like to know say users that have more than 400 megs  of space used on their personal drive. So the script will tell me which users are over the 400 meg and i in turn will inform my boss with the results of the script. The script should if possible create a txt file with all the users taking over 400 megs of disk space on the server.

    Thanks,

    Tacobell2000
    0
     
    LVL 11

    Expert Comment

    by:KaliKoder
    0
     
    LVL 11

    Accepted Solution

    by:
    0
     
    LVL 2

    Expert Comment

    by:Znalost
    Hi Tacobell2000,
    It is not clear from your statement therefore I assume that each user's personal drive is actualy represented by a folder located on a file server. As others suggested above, you can use diruse.exe to find out how much space each user consumes.
    I developed for myself a litlle script (using windows command shell and diruse.exe) which makes evaluation of directory utilization a little bit easer. If you want you can use it.
    Create a file called ru.bat and open it in notepad. Then place in it following (content between double lines):
    ==============================================
    @echo off
    if "%1"=="" goto interactive
    set fileredir= ^>^> %3
    if "%3"=="" goto noredir
    diruse /m /, /q:%1 /l /* %2 %fileredir%
    goto konec
    :noredir
    diruse /m /, /q:%1 /l /* %2
    rem diruse /m /, /q:10000 /l /* h:\users
    pause
    goto konec
    :interactive
    rem Interactive part and help of this program starts here
    echo -----------------------------------------------------------------------
    echo This program lists directory sizes (including subdirectories and
    echo files in the subdirectorie but not files in a parameter root directory)
    echo The parameter root directory is e.g. c:\temp in 'ru 10 "c:\temp"'
    echo Usage: ru size "directory"
    echo           size...Mark directories exceeding the size in MB with character!
    echo                directory...Directory or drive to be evaluated
    echo Example: ru 1000 "h:\users"
    echo This program can be run in 2 modes: interactive (ru.bat) or
    echo one time (e.g. ru 10 "c:\temp" "c:\temp\results.txt") with results output
    echo to a file
    echo -----------------------------------------------------------------------
    rem echo first ruopen= %ruopen%
    if "%ruopen%"=="Yes" goto konec
    set ruopen=Yes
    rem echo second ruopen= %ruopen%
    cmd
    :exitcmd
    exit
    goto exitcmd
    :konec
    =========================================

    Save the file and the you can run it as ru.bat (doubleclick, command line etc.)
    0
     

    Author Comment

    by:Tacobell2000
    Hello Znalost,

    I copied and pasted the above script in a txt file and renamed it to a .bat file. Put it on the file server in question and double clicked the bat file. The out put is as follows:

    This program lists directory sizes (including subdirectories and
    files in the subdirectorie but not files in a parameter root directory)
    The parameter root directory is e.g. c:\temp in 'ru 10 "c:\temp"'
    Usage: ru size "directory"
              size...Mark directories exceeding the size in MB with character!
                   directory...Directory or drive to be evaluated
    Example: ru 1000 "j:\montreal"
    This program can be run in 2 modes: interactive (ru.bat) or
    one time (e.g. ru 10 "c:\temp" "c:\temp\results.txt") with results output
    to a file
    -----------------------------------------------------------------------
    Microsoft Windows 2000 [Version 5.00.2195]
    (C) Copyright 1985-2000 Microsoft Corp.

    There are no results showing. I know i am doing this wrong can you please let me know how to get it right.

    Many thnaks,
    Tacobell2000
    0
     
    LVL 2

    Expert Comment

    by:Znalost
    Hi Tacobell2000,
    As the message says, if you want to see resutls for example for j:\montreal directory and mark all sub-directories exceeding 400 MB, you have to type at the command prompt following:
    ru 400 "j:\montreal"
    Output will be genarated in few seconds or minutes in your command shell window. It will enumarate all sub-directories of j:\montreal but not files located directly under j:\montreal.

    Good luck
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Suggested Solutions

    Title # Comments Views Activity
    Visual C++ Runtime Error on Windows 2000 Server 2 1,393
    Group Policy 9 550
    Locking down a taskpad 1 128
    Windows startup/shutdown date/time log 7 87
    NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
    Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    This video discusses moving either the default database or any database to a new volume.

    913 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now