Solved

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

Posted on 2013-01-16
5
1,014 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 54

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 54

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 54

Expert Comment

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

~bp
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SSRS - Powershell 7 73
Comparing two directory structures, and reporting differences. 6 51
RDP authentication error 3 64
DOS Script 4 30
The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
This article explains how to install and use the NTBackup utility that comes with Windows Server.
This tutorial will give a an overview on how to deploy remote agents in Backup Exec 2012 to new servers. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as connecting to a remote Back…
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…

738 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