A Windows XP help forum. PCbanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » PCbanter forum » Microsoft Windows XP » General XP issues or comments
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Script to Send Email If Network Drive Low on Disk Space



 
 
Thread Tools Display Modes
  #1  
Old October 29th 09, 09:03 PM posted to microsoft.public.windowsxp.general
No_Name
external usenet poster
 
Posts: 5
Default Script to Send Email If Network Drive Low on Disk Space

Hi,

I would greatly appreciate it if somebody can send me a script (Or a
link to
one) for a procedure in XP that will check a network drive (Say mapped
as \\server\share locally to Z for a specified amount of disk space
(Can be hard-coded) and send an email if the amount of free disk
space is less than the threshhold.

I use blat for email, but I can adapt a script that uses another email
command.


Thanks,QZ
Ads
  #2  
Old October 29th 09, 10:27 PM posted to microsoft.public.windowsxp.general
Pegasus [MVP]
external usenet poster
 
Posts: 2,361
Default Script to Send Email If Network Drive Low on Disk Space


wrote in message
...
Hi,

I would greatly appreciate it if somebody can send me a script (Or a
link to
one) for a procedure in XP that will check a network drive (Say mapped
as \\server\share locally to Z for a specified amount of disk space
(Can be hard-coded) and send an email if the amount of free disk
space is less than the threshhold.

I use blat for email, but I can adapt a script that uses another email
command.


Thanks,QZ


Here you go:
[1] @echo off
[2] set Limit=10000
[3] set Drive=E:
[4]
[5] for /F "tokens=3" %%a in ('dir %Drive%\ /-c ^| find /i "bytes free"') do
set FreeBytes=%%a
[6] set FreeMBytes=%FreeBytes:~0,-6%
[7] if "%FreeMBytes%"=="" set FreeMBytes=0
[8] if %FreeMBytes% LSS %Limit% echo blat /.. /..

Please note:
- Do not retype the code - use copy & paste instead.
- Set the Limit in MBytes
- You could do the whole job with a VB Script but it would take about four
times as much code.


  #3  
Old October 30th 09, 06:35 PM posted to microsoft.public.windowsxp.general
No_Name
external usenet poster
 
Posts: 5
Default Script to Send Email If Network Drive Low on Disk Space

Hi Pegasus,

Thanks for taking the time to answer this question.
I copied an existing *.bat file, removed its contents and copied the
script to it,
but it indicated that the syntax of the command was incorrect.
Also, do I remove [1], [2], etc...
To what do I copy and paste your script?


Thanks,
QZ



On Oct 29, 6:27*pm, "Pegasus [MVP]" wrote:
wrote in message

...

Hi,


I would greatly appreciate it if somebody can send me a script (Or a
link to
one) for a procedure in XP that will check a network drive (Say mapped
as \\server\share locally to Z for a specified amount of disk space
(Can be hard-coded) and send an email if the amount of free disk
space is less than the threshhold.


I use blat for email, but I can adapt a script that uses another email
command.


Thanks,QZ


Here you go:
[1] @echo off
[2] set Limit=10000
[3] set Drive=E:
[4]
[5] for /F "tokens=3" %%a in ('dir %Drive%\ /-c ^| find /i "bytes free"') do
set FreeBytes=%%a
[6] set FreeMBytes=%FreeBytes:~0,-6%
[7] if "%FreeMBytes%"=="" set FreeMBytes=0
[8] if %FreeMBytes% LSS %Limit% echo blat /.. /..

Please note:
- Do not retype the code - use copy & paste instead.
- Set the Limit in MBytes
- You could do the whole job with a VB Script but it would take about four
times as much code.


  #4  
Old October 30th 09, 08:41 PM posted to microsoft.public.windowsxp.general
Pegasus [MVP]
external usenet poster
 
Posts: 2,361
Default Script to Send Email If Network Drive Low on Disk Space


wrote in message
...
Hi Pegasus,

Thanks for taking the time to answer this question.
I copied an existing *.bat file, removed its contents and copied the
script to it,
but it indicated that the syntax of the command was incorrect.
Also, do I remove [1], [2], etc...
To what do I copy and paste your script?

Thanks,
QZ

================

The line numbers are there for your guidance only and to allow you to unwrap
lines that your newsreader might have wrapped around. You MUST remove each
and every one of them.

You can save the code into any file with a .bat extension, e.g. into
c:\supercalifragilisticexpialidocious.bat. When it works then you should use
the Task Scheduler to run it once or twice each day. Remember to test it
under the Task Scheduler!


  #5  
Old November 9th 09, 09:16 PM posted to microsoft.public.windowsxp.general
undisclosed
external usenet poster
 
Posts: 488
Default Script to Send Email If Network Drive Low on Disk Space


How do you specify what the threshold for it to trigger the message? Is
it in bytes, kilobytes, megabytes, or gigabytes?


--
nitebreed52
  #6  
Old November 9th 09, 10:24 PM posted to microsoft.public.windowsxp.general
Pegasus [MVP]
external usenet poster
 
Posts: 2,361
Default Script to Send Email If Network Drive Low on Disk Space


undisclosed wrote in message
...

How do you specify what the threshold for it to trigger the message? Is
it in bytes, kilobytes, megabytes, or gigabytes?


--
nitebreed52


Have another look at my response to the OP. It clearly states the unit I
used for the limit.


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off






All times are GMT +1. The time now is 02:23 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 PCbanter.
The comments are property of their posters.