Solved

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

Posted on 2013-01-16
5
998 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 53

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 53

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 53

Expert Comment

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

~bp
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBSScript Error IP Array 6 23
Dell PowerEdge 2950 crashing on a weekly basis 5 37
lock down downloads folder 8 57
WMI - Issue Server 2012 R2 1 10
The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
A procedure for exporting installed hotfix details of remote computers using powershell
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…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…

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