Guest maitakeboy Posted January 18, 2008 Posted January 18, 2008 I've gotten burned twice, now, by not having any automatic alert that informs me when my file server space is getting low. I can't seem to find anything built-in to Windows to do this. What is the suggested way to configure automatic alerts when a logical drive is running out of space?
Guest Pegasus \(MVP\) Posted January 18, 2008 Posted January 18, 2008 Re: Disk Free Space Alert "maitakeboy" <maitakeboy@discussions.microsoft.com> wrote in message news:54A43D54-F92C-49D0-8065-781A4ED8861B@microsoft.com... > I've gotten burned twice, now, by not having any automatic alert that > informs > me when my file server space is getting low. I can't seem to find anything > built-in to Windows to do this. What is the suggested way to configure > automatic alerts when a logical drive is running out of space? Get the Task Scheduler on the server to run this batch file once every day: $@echo off >nullfile.txt $set Drive=C: $set Limit=1000 $for /F "tokens=7" %%a in ('fsutil volume diskfree %Drive% ^| find /i "# of free"') do set free=%%a $set free=%free:~0,-6% $if %free% LSS %Limit% net send YourPCName "Warning: Free space on %ComputerName% is less than %Limit% MBytes" Note: - You must remove all $ characters. Their only purpose is to mark the beginning of each line. - The Messenger service must run on your own PC. - Set Limit=2000 if you mean 2000 MBytes (=2 GBytes)
Guest maitakeboy Posted January 18, 2008 Posted January 18, 2008 Re: Disk Free Space Alert Pegasus, Thanks for your reply! What exactly are you setting when you set the Set Limit? Is that the remaining free space? Can you do a percentage? "Pegasus (MVP)" wrote: > > "maitakeboy" <maitakeboy@discussions.microsoft.com> wrote in message > news:54A43D54-F92C-49D0-8065-781A4ED8861B@microsoft.com... > > I've gotten burned twice, now, by not having any automatic alert that > > informs > > me when my file server space is getting low. I can't seem to find anything > > built-in to Windows to do this. What is the suggested way to configure > > automatic alerts when a logical drive is running out of space? > > Get the Task Scheduler on the server to run this batch file > once every day: > $@echo off >nullfile.txt > $set Drive=C: > $set Limit=1000 > $for /F "tokens=7" %%a in ('fsutil volume diskfree %Drive% ^| find /i "# of > free"') do set free=%%a > $set free=%free:~0,-6% > $if %free% LSS %Limit% net send YourPCName "Warning: Free space on > %ComputerName% is less than %Limit% MBytes" > > Note: > - You must remove all $ characters. Their only purpose is to mark > the beginning of each line. > - The Messenger service must run on your own PC. > - Set Limit=2000 if you mean 2000 MBytes (=2 GBytes) > > >
Guest Sid Elbow Posted January 19, 2008 Posted January 19, 2008 Re: Disk Free Space Alert Pegasus (MVP) wrote: > Get the Task Scheduler on the server to run this batch file > once every day: > $@echo off >nullfile.txt > $set Drive=C: > $set Limit=1000 > $for /F "tokens=7" %%a in ('fsutil volume diskfree %Drive% ^| find /i "# of > free"') do set free=%%a > $set free=%free:~0,-6% > $if %free% LSS %Limit% net send YourPCName "Warning: Free space on > %ComputerName% is less than %Limit% MBytes" > > Note: > - You must remove all $ characters. Their only purpose is to mark > the beginning of each line. > - The Messenger service must run on your own PC. > - Set Limit=2000 if you mean 2000 MBytes (=2 GBytes) Neat ... I still think you should change your name to bat-man.
Guest Pegasus \(MVP\) Posted January 19, 2008 Posted January 19, 2008 Re: Disk Free Space Alert If you want a percentage then you can run this batch file: $@echo off $goto Start $----------------------------------------------------------------------------- $This batch file will check the amount of free disk space on the $nominated drive. If it is less than the specified percentage $then it will generate a pop-up warning on the specified computer. $ $You must set three parameters below the ":Start" label: $set Drive=C: (or any other drive) $set Limit=20 (the percentage figure below which a warning will be issued. $set Dest=Pegasus (the name of the machine that will receive the warning) $ $Note: On the %Dest% machine, the "Messenger" service must be running. $ $19.1.2008 FNL $----------------------------------------------------------------------------- $:Start $set Drive=C: $set Limit=20 $set Dest=Pegasus $ $fsutil fsinfo ntfsinfo %Drive% > nul $if ErrorLevel 1 ( $ fsutil fsinfo ntfsinfo %Drive% $ echo Press the Space Bar to close this window. $ pause > nul $ goto :eof $) $ $for /F "tokens=7" %%a in ('fsutil volume diskfree %Drive% ^| find /i "# of free"') do set free=%%a $for /F "tokens=6" %%a in ('fsutil volume diskfree %Drive% ^| find /i "# of byte"') do set total=%%a $set free=%free:~0,-6% $if "%free%"=="" set free=0 $set total=%total:~0,-6% $set /a percent=%free% * 100 / %total% $echo Free space on drive %Drive% is %percent%%% of capacity $if %percent% LSS %Limit% net send %Dest% "Warning: Free space on drive %Drive% on %ComputerName% is %Percent%%% of capacity." - You must remove all $ characters. Their only purpose is to mark the beginning of each line. - The Messenger service must run on your own PC. - Set Limit=20 if you mean 20% of capacity "maitakeboy" <maitakeboy@discussions.microsoft.com> wrote in message news:C74A966D-8ED6-4174-8FB7-120C0E542734@microsoft.com... > Pegasus, > > Thanks for your reply! What exactly are you setting when you set the Set > Limit? Is that the remaining free space? Can you do a percentage? > > "Pegasus (MVP)" wrote: > >> >> "maitakeboy" <maitakeboy@discussions.microsoft.com> wrote in message >> news:54A43D54-F92C-49D0-8065-781A4ED8861B@microsoft.com... >> > I've gotten burned twice, now, by not having any automatic alert that >> > informs >> > me when my file server space is getting low. I can't seem to find >> > anything >> > built-in to Windows to do this. What is the suggested way to configure >> > automatic alerts when a logical drive is running out of space? >> >> Get the Task Scheduler on the server to run this batch file >> once every day: >> $@echo off >nullfile.txt >> $set Drive=C: >> $set Limit=1000 >> $for /F "tokens=7" %%a in ('fsutil volume diskfree %Drive% ^| find /i "# >> of >> free"') do set free=%%a >> $set free=%free:~0,-6% >> $if %free% LSS %Limit% net send YourPCName "Warning: Free space on >> %ComputerName% is less than %Limit% MBytes" >> >> Note: >> - You must remove all $ characters. Their only purpose is to mark >> the beginning of each line. >> - The Messenger service must run on your own PC. >> - Set Limit=2000 if you mean 2000 MBytes (=2 GBytes) >> >> >>
Guest Pegasus \(MVP\) Posted January 19, 2008 Posted January 19, 2008 Re: Disk Free Space Alert > Neat ... I still think you should change your name to bat-man. Bat today, batty tomorrow . . .
Recommended Posts