How to write a batch file script for chkdsk for multiple com

September 12, 2012 at 12:52:02
Specs: Windows XP
Hi ,

I want check multiple computers disk space by using chkdsk cmd by writing the code using batch file in win xp. pls help me out , many thanks

( How to write a batch file script for chkdsk for multiple computers )


See More: How to write a batch file script for chkdsk for multiple com

Report •


#1
September 12, 2012 at 15:33:37
You can't use chkdsk to get the fre disk space.

Something like this should work. Create a text file called hosts.txt with IP address or host names, one per line.

@echo off
for /f "tokens=*" %%i in (
hosts.txt
) do (
wmic /node:%%i /user:your_account process call create "cmd.exe /c fsutil volume diskfree C: >> \\your_ip\share\output.txt"
)

Alternatively, you could use psexec

Tony


Report •

#2
September 12, 2012 at 19:07:47
Perhaps a little more forgiving for offline computers:

@ECHO OFF
FOR /F "tokens=1 delims=\ " %%I IN ('NET VIEW^|FINDSTR /C:"\\"') DO (
    IF /I "%%I" EQU "%COMPUTERNAME%" (
        WMIC PATH  Win32_LogicalDisk GET Name,FreeSpace,Size,SystemName
    ) ELSE (
        WMIC /NODE:'%%I' PATH  Win32_LogicalDisk GET Name,FreeSpace,Size,SystemName
    )
)

The output from the above (from my network):

Wed 09/12
21:05:36=>28398
FreeSpace    Name  Size         SystemName
1108340736   C:    10733957120  D610-LAPTOP
1734071296   D:    10733957632  D610-LAPTOP
14635069440  E:    38543626240  D610-LAPTOP
0            Z:    23232512     D610-LAPTOP

FreeSpace     Name  Size          SystemName
              A:                  DL380-SERVER
403369984     C:    10929418240   DL380-SERVER
116319023104  D:    134733737984  DL380-SERVER
67115980288   F:    145661450752  DL380-SERVER
              Z:                  DL380-SERVER

FreeSpace      Name  Size           SystemName
               A:                   SY-6BA-100
2482933760     C:    10733957120    SY-6BA-100
133953018880   D:    178570828288   SY-6BA-100
9793061888     E:    10742215168    SY-6BA-100
1009109303296  F:    2000396288000  SY-6BA-100
127608619008   G:    2000396288000  SY-6BA-100
481654538240   I:    2000396812288  SY-6BA-100
               Y:                   SY-6BA-100

When your only tool is a hammer, every problem looks like a nail.


Report •

#3
September 13, 2012 at 04:22:33
"You can't use chkdsk to get the fre disk space."

since when?


The simplest solution is usually the best.
:: ===== script starts here ===============
::
:: free.bat 2012-09-13 18:10:36.15
@echo off & setLocal enableDELAYedeXpansioN

for /f "tokens=3 delims= " %%a in ('dir C:') do (
set free=%%a
)
echo !free!
::====== script ends here =================


====================================
Life is too important to be taken seriously.

M2


Report •

Related Solutions

#4
September 13, 2012 at 06:50:04
Hmm, well I have never used it to get the free space, and I don't see why you would want to wait for chkdsk to get it when there are other, better alternatives.

Tony


Report •

#5
September 14, 2012 at 01:40:15

Hi, ThnQ for all responses,,, but it wont work,
I will explain my question again ,,,, follows

How to write a batch file script for checking disk space for all computers within the same network and it should leave a result report in text formate to the server of IT admin. and the condition is
1. When the IT admin enter the asset number ( Means computer tag number ) it will give you the disk details and leave the report in text formate to the IT admin server .

If anyone help me for this i would really greate thankfull to them...and thanQ for your all responses ... :) Have good day


Report •

#6
September 14, 2012 at 02:41:29
Are the drives mapped?


====================================
Life is too important to be taken seriously.

M2


Report •

#7
September 14, 2012 at 02:48:41
No itz not mapped

Report •

Ask Question