Ask questions via twitter! Message any question to @answers on twitter. We'll publish the question and send you a reply each time there's a new answer.
Next Question

Answered Question

 
M$5 January 20, 2009 06:00 PM

Can you help me create a batch file (or web app) to pull a specific folder size from multiple Windows servers?

This should be really simple to someone that programs or creates batch files. In a given windows domain, I need to run something (batch file, web app on IIS, whatever) that will scan a number of remote boxes (by hostname) and pull back the folder size for one folder on a drive that is present on every server (and has the same letter assignment). I will use whatever technology necessary. It is fine if it just reports it in a command window and writes to .txt or it can run server-side and return results it in a browser window. Any ideas? I did this with WMI calls before but it took me a long time to program it and I have a critical issue.
Interesting Question?  Yes (0)   No (0)   
RSS
 
 

Best Answer  Chosen by Asker

 
January 20, 2009 08:03 PM
Create a simple command line batch file by giving it a .cmd extension, and put a few dir commands in it - 1 per server.
Detailed steps:
Create a new text file on your windows machine (New->Text File)
Double click the file to open and edit it. Enter commands like these (substitute your actual server and folder names):
Dir /A:D \\server1\folderA
dir /A:D \\server2\folderB
Notes:
the switch "/A:D" means only output the directory (the folder, not all the files in the folder).
The folders you want on the servers will have to be accessible by you as shared folders.
You can redirect the output to a file by appending "| filename.txt" to the end of each line or create a second .cmd file that calls the first file and append the above pipe command to it. The vertical line (Shift-\ on most keyboards) is the pipe command output modifier. It redirects output of the dos command.
Asker's Rating:
• Of the three, this is the one that led me to the best course of action. I copied the app "diruse" to the root of every server (I think a more experienced answer would be "pulling info remotely from batch file takes too long" as I learned) and using psexec to run the app remotely and >> into a .txt


Helpful Answer?  (1)   (0)    Tip jpod for this answer
Permalink | Report
   Reply  
 
 

Other Answers (2)

Sort By
 
January 20, 2009 06:38 PM
I think you can use curl for that.
http://curl.haxx.se/docs/manual.html

"curl is a command line tool for transferring files with URL syntax, supporting FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, LDAP, LDAPS and FILE. curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate, kerberos...), file transfer resume, proxy tunneling and a busload of other useful tricks. "

Helpful Answer?  (0)   (0)    Tip bugsy for this answer
Permalink | Report
   Reply  
 
 
 
January 20, 2009 08:35 PM
Get hold of the "du" (disk usage) utility for Windows (normally a Unix thing). Once you've got that at your disposal you can point it anyplace that Windows can see, and making a batch file out of it should be as easy as cutting and pasting N lines into a file, one for each share you need to measure. Dump the output into a report file (remembering to use the double >> notation so you append to your file with each new du call), and write the file out to a directory that is visible to IIS.

Hope that gets you started, I can provide more detail if you need it.
Source(s):
http://malektips.com/xp_dos_0028.html

http://www.microsoft.com/technet/sysinternals/FileAndDisk/du.mspx


Helpful Answer?  (0)   (1)    Tip shakespearegeek for this answer
Permalink | Report
   Reply  
 
 

Answer this Question

How tips and payments work

This question has already been resolved. You may add an answer to it but you will not be eligible to win best answer or any associated tips.

Ask a Question


140 characters left
Top of Page
Buy Mahalo Dollars with Credit Card or PayPal

Top Members

This Week All Time
  • cfinke
    cfinke
    2nd Degree Black Belt
    27330 Points
    M$29.75 Earned
  • bunnyphuph...
    bunnyphuph...
    2nd Degree Black Belt
    21386 Points
    M$762.89 Earned
  • opher
    opher
    Purple Belt with a Brown Tip
    6142 Points
    M$238.49 Earned
   See All
 

Most Popular Tags

mahalo(1791)
music(495)
iphone(485)
google(390)
online(366)
food(340)
beer(287)
money(283)
movies(279)
apple(259)
aotd(235)
free(233)
health(228)
video(222)
dog(215)
   See All
 

Categories

Welcome New Members


 
 
Mahalo Dollars are the currency of Mahalo Answers.

Each Mahalo Dollar costs $1.

Once you earn more than 40 Mahalo Dollars, you can request to be paid via PayPal. Each Mahalo Dollar is currently worth $0.75 when paid out via PayPal. Learn More

 
 

Please log in to use this function.