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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|