Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2011-03-03
4
Medium Priority
?
556 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 2000 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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

A safe way to clean winsxs folder from your windows server 2008 R2 editions
I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
To efficiently enable the rotation of USB drives for backups, storage pools need to be created. This way no matter which USB drive is installed, the backups will successfully write without any administrative intervention. Multiple USB devices need t…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

721 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