Sounds familiar?
With (native) Windows XP Professional or Windows Server 2003 commands:
FOR /F %%A IN (servers.txt) DO (
WMIC /Node:%%A LogicalDisk Where DriveType="3" Get DeviceID,FileSystem,FreeSpace,Size /Format:csv | MORE /E +2 >> SRVSPACE.CSV
)
The only prerequisites are:
- SRVSPACE.CSV should not exist or be empty,
- a list of server names in a file named SERVERS.TXT, one server name on each line,
- and WMIC.EXE, which is native in Windows XP Professional, Windows Server 2003 and Vista.
The CSV file format is ServerName,DeviceID,FileSystem,FreeSpace,Size (one line for each harddisk partition on each server).
If you have a strict server naming convention, SERVERS.TXT itself can be generated with the NET
command:
FOR /F "delims=\ " %%A IN ('NET VIEW ^| FINDSTR /R /B /C:"\\\\SRV\-"') DO (>>SERVERS.TXT ECHO.%%A)
Notes: | (1) | assuming server names start with "SRV-"; modify to match your own naming convention. |
| (2) | delims is a backslash, followed by a tab and a space. |