Solved

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

Posted on 2013-01-16
5
982 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 51

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 51

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 51

Expert Comment

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

~bp
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
A safe way to clean winsxs folder from your windows server 2008 R2 editions
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…
To efficiently enable the rotation of USB drives for backups, storage pools need to be created. This way no matter which USB drive is installed, the backups will successfully write without any administrative intervention. Multiple USB devices need t…

746 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

15 Experts available now in Live!

Get 1:1 Help Now