Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1056
  • Last Modified:

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

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
mystikal1000
Asked:
mystikal1000
  • 3
  • 2
1 Solution
 
Bill PrewCommented:
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
 
mystikal1000Author Commented:
Yes to both.  Servers.txt
0
 
Bill PrewCommented:
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
 
mystikal1000Author Commented:
Top notch!
0
 
Bill PrewCommented:
Thanks, glad that helped.

~bp
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now