Find amount of available disk space on Remote Server?

Discussion in 'Windows Server' started by Jane Doe, Nov 6, 2006.

  1. Jane Doe

    Jane Doe Guest

    Windows 2003 SP1
    Does anyone have a script or know of freeware that will let me find the
    available free disk space on all the remote servers. I know I can do a
    manual net use \\server\c$ but I'd like to automate the task as I've got
    about 40 servers and need to get the info weekly.

    Jane Doe, Nov 6, 2006
    1. Advertisements

  2. You can do it with this batch file:

    @echo off
    echo Disk statistics created on %date% at %time:~0,5% > c:\ServerSpace.txt
    echo ================================================== >>
    for /F %%a in (c:\Servers.txt) do call :Sub %%a
    notepad c:\ServerSpace.txt
    goto :eof

    for /F "tokens=3" %%a in ('dir \\%1\c$ ^| find /i "bytes free"') do set
    echo %1 %free% bytes free >> c:\ServerSpace.txt

    The file c:\Servers.txt must contain a list of your 40 servers.
    Pegasus \(MVP\), Nov 6, 2006
    1. Advertisements

  3. Jane Doe

    Jane Doe Guest

    Jane Doe, Nov 6, 2006
  4. You're welcome.
    Pegasus \(MVP\), Nov 6, 2006
  5. Jane Doe

    Jane Doe Guest

    I've created the servers.tx file and put it in the root of the C: drive but
    when I run the batch file I only get the date/time stamp in the output file.
    Do I need to do any editing of your batch file?
    Jane Doe, Nov 6, 2006
  6. I suspect that you unwrapped your lines incorrectly. Include
    your version of the batch file as an attachment in your reply.
    Pegasus \(MVP\), Nov 7, 2006
  7. Jane Doe

    Jane Doe Guest

    Thank you for spending your time with this.
    Batch attached, renamed ext for mail filter.
    Jane Doe, Nov 7, 2006
  8. As I suspected: incorrect line breaks - see attached.
    Pegasus \(MVP\), Nov 7, 2006
  9. Try this version - its output is somewhat more useful.
    Pegasus \(MVP\), Nov 7, 2006
  10. Jane Doe

    Jane Doe Guest

    Works Great!
    Thanks again!
    Jane Doe, Nov 8, 2006
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.