Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

script to let me know disk space usage

Posted on 2004-10-26
7
Medium Priority
?
221 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
Comment
Question by:Tacobell2000
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 2

Expert Comment

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

Author Comment

by:Tacobell2000
ID: 12414595
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
ID: 12415375
0
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

 
LVL 11

Accepted Solution

by:
KaliKoder earned 2000 total points
ID: 12415449
0
 
LVL 2

Expert Comment

by:Znalost
ID: 12416709
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
ID: 12423285
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
ID: 12448712
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

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Article by: evilrix
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data defin…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

618 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