Solved

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

Posted on 2011-03-03
4
540 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 82

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
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…
This tutorial will walk an individual through setting the global and backup job media overwrite and protection periods in Backup Exec 2012. Log onto the Backup Exec Central Administration Server. Examine the services. If all or most of them are stop…

707 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

16 Experts available now in Live!

Get 1:1 Help Now