|Oh, so you did not write this code and do not know how to script?|
I reported this post to the Programming Forum so that they will move it to the right place. You will get petter support from them.
Ok, here is some code that will work until another programmer can figure out the math part that stumped me.
rem You need to initialize your vars at the top to prevent undefined vars.
set /a totalspace=0
set /a percentused=0
set /a percentfree=0
set /a totalused=0
set /a freespace=0
rem You should initialize the files.
echo Tested Following IPs: > pingLOG.txt
echo Current IP Config: > ipconf.txt
echo Disk Info: > util.txt
echo Disk Space Ussage: > space.txt
rem Call :pinger
rem you need code to pars the util.txt
rem set /a totalspace=!totalused!+!freespace!
rem set /a percentused=(!totalused!*100)/!totalspace!
rem set /a percentfree=100-!percentused!
echo Total space: %totalspace% GB>>space.txt
echo Free space: %freespace% GB >>space.txt
echo Used space: %totalused% GB >>space.txt
for /f "tokens=*" %%I in (IPlist.txt) do (
echo Tested %1 on %TIME% >> pingLOG.txt
echo Errors Found: >> pingLOG.txt
ping %%I | find /i "reply" > nul
if errorlevel 1 echo %%I >> pingLOG.txt
fsutil volume diskfree c:>util.txt
for /f "tokens=1-3 delims=:" %%A in (util.txt) do (
call :SetVar %%B %%A
echo %1 %5
if "%5" == "free" set totalused=%1
if "%5" == "bytes" set totalspace=%1
if "%5" == "avail" set freespace=%1
This code should answer 3-6 but it uses an IPLIST.TXT file that is pre-populated with the IPs of your servers. This is because this code was written for a different purpose.
1. IP Number of the server
2. Name of the server
This will be hard to do but this should help...