Solved

Need a batch script to check if a remote folder exists from a list of machines

Posted on 2011-09-20
6
4,324 Views
Last Modified: 2012-05-12
Hi,

I need a batch script that will check to see if a remote folder exists based on a list of machines in a text file.  I will be running this script from my desktop and need to verify the existence of a folder on each of our servers.

For example, I'd like to verify that c:\windows\system32\test folder exists from a list of machines in machines.txt

Thanks!
0
Comment
Question by:windows7expert
6 Comments
 
LVL 13

Expert Comment

by:5g6tdcv4
ID: 36568708
0
 

Author Comment

by:windows7expert
ID: 36568709
I would also like it to output to another text file detailing the results of whether or not the folder exists on that specific machine.
0
 
LVL 53

Accepted Solution

by:
Bill Prew earned 500 total points
ID: 36568738
How about something like this.  Save as a BAT file and run from same folder as machines.txt.

@echo off
if exist "exists.txt" del "exists.txt"
for /F %%A in (machines.txt) do (
  if exist "\\%%A\C$\windows\system\test\" (
    echo %%A : FOUND >>exists.txt
  ) else (
    echo %%A : MISSING >>exists.txt
  )
)

Open in new window

~bp
0
Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

 
LVL 3

Expert Comment

by:pnorms
ID: 36569167
Are you using admin shares?
0
 

Author Closing Comment

by:windows7expert
ID: 36569258
BP, that worked perfectly!
0
 
LVL 53

Expert Comment

by:Bill Prew
ID: 36569282
Great, glad that helped.

~bp
0

Featured Post

Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Our Group Policy work started with Small Business Server in 2000. Microsoft gave us an excellent OU and GPO model in subsequent SBS editions that utilized WMI filters, OU linking, and VBS scripts. These are some of experiences plus our spending a lo…
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question