Solved

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

Posted on 2011-03-03
4
549 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
[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
  • 2
4 Comments
 

Author Comment

by:brewersewer
ID: 35030938
Thanks.
0
 
LVL 85

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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Background Information Recently I have fixed file server permission issues for one of my client. The client has 1800 users and one Windows Server 2008 R2 domain joined file server with 12 TB of data, 250+ shared folders and the folder structure i…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…
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…
Suggested Courses

622 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