Solved

Batch Script to check a file date/time on multiple servers

Posted on 2013-01-16
5
987 Views
Last Modified: 2013-01-17
Does anyone have a quick script that will check the file (date and time) below on multiple servers?  I need to verify this file on over 1000 servers. I would like the output in comma delimited format.  I appreciate the help!


c:\documents and settings\mandatory\ntuser.man
0
Comment
Question by:mystikal1000
  • 3
  • 2
5 Comments
 
LVL 52

Expert Comment

by:Bill Prew
ID: 38784653
Will the list of the 100 server names be in a TXT file?

Will the person running the script have access to the C$ administrative share on all the servers?

~bp
0
 
LVL 1

Author Comment

by:mystikal1000
ID: 38784836
Yes to both.  Servers.txt
0
 
LVL 52

Accepted Solution

by:
Bill Prew earned 500 total points
ID: 38785576
See if this gives you some ideas.

@echo off
setlocal

set Servers=servers.txt
set Output=results.csv
set File=c$\documents and settings\mandatory\ntuser.man

(
  for /F "usebackq tokens=*" %%A in ("%Servers%") do (
    if exist "\\%%A\%File%" (
      for %%B in ("\\%%A\%File%") do echo "\\%%A\%File%","%%~tB"
    ) else (
      echo "\\%%A\%File%","MISSING"
    )
  )
) > "%Output%"

Open in new window

~bp
0
 
LVL 1

Author Closing Comment

by:mystikal1000
ID: 38787389
Top notch!
0
 
LVL 52

Expert Comment

by:Bill Prew
ID: 38787591
Thanks, glad that helped.

~bp
0

Featured Post

Why won’t your email signature format correctly?

Struggling to get your corporate email signatures to format correctly? Does the logo keep resizing? Is the text appearing too big? What can you do to prevent this? Find out how you can save your signatures today.

Question has a verified solution.

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

I have published numerous articles here at Experts Exchange that present programs/scripts written in a language called AutoHotkey. Each of those articles has a brief paragraph describing where to download the product and how to install it. I have al…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
This tutorial will give a short introduction and overview of Backup Exec 2012 and how to navigate and perform basic functions. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as conne…
This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…

910 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now