Solved

Create a script to copy .opt file from multiple servers to one location

Posted on 2011-03-03
4
542 Views
Last Modified: 2012-06-21
Throughout our enterprise we have 400+ Windows 2003 and 2008 servers that use Tivoli® Storage Manager to backup files and directories.
Each server has an options file named dsm.opt  in the following location:
 C:\Program Files\Tivoli\TSM\baclient\dsm.opt
I would like to create a script that would
1. Pull server name from server.txt file(our server names all have hyphens in the name
2. Copy dsm.opt file from the following path
     a. \\ServerName\c$\Program Files\Tivoli\TSM\baclient
3. Copy to Server or PC I am running Script from
     a. Create a folder with the server name and copy the .opt file to that folder.

I have zero scripting experience, any help would be appreciated.
Thanks - brewersewer
0
Comment
Question by:brewersewer
  • 2
4 Comments
 

Author Comment

by:brewersewer
ID: 35030938
Thanks.
0
 
LVL 83

Accepted Solution

by:
oBdA earned 500 total points
ID: 35031422
Something like this?
@echo off
setlocal
for /f %%a in ('type server.txt') do (
  if not exist "%~dp0%%a" md "%~dp0%%a"
  copy "\\%%a\C$\Program Files\Tivoli\TSM\baclient\dsm.opt" "%~dp0%%a\dsm.opt"
)

Open in new window

0
 

Author Closing Comment

by:brewersewer
ID: 35037632
Worked perfectly - Thanks for your help.
0
 

Expert Comment

by:gihrnm
ID: 35473121
Mine is a slight variation from this one. Perfect.
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This tutorial will walk an individual through locating and launching the BEUtility application and how to execute it on the appropriate database. Log onto the server running the Backup Exec database. In a larger environment, this would generally be …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

778 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