• Please help support our sponsors by considering their products and services.
    Our sponsors enable us to serve you with this high-speed Internet connection and fast webservers you are currently using at ADSM.ORG.
    They support this free flow of information and knowledge exchange service at no cost to you.

    Please welcome our latest sponsor Tectrade . We can show our appreciation by learning more about Tectrade Solutions
  • Community Tip: Please Give Thanks to Those Sharing Their Knowledge.

    If you receive helpful answer on this forum, please show thanks to the poster by clicking "LIKE" link for the answer that you found helpful.

  • Community Tip: Forum Rules (PLEASE CLICK HERE TO READ BEFORE POSTING)

    Click the link above to access ADSM.ORG Acceptable Use Policy and forum rules which should be observed when using this website. Violators may be banned from this website. This notice will disappear after you have made at least 3 posts.

Modify dsm.opt

TaSMania

ADSM.ORG Member
#1
Need help automizing dsm.opt. What is a good application to use to execute such a task, batch, vba, perl or others?
1. query for which SP server Node resides on
2. connect to client server and upate dsm.opt:
NODENAME %COMPUTERNAME%
TCPSERVERADDRESS <output from step1>
 

moon-buddy

ADSM.ORG Moderator
#2
I am a UNIX/Linux man and I use KSH scripts for most of my TSM automation. However, you will need a "universal" takeoff platform that can update nodes whether these are Windows or UNIX/Linux.

If you are only on just a pure Windows environment, then Batch or Powershell scripts can easily accomplish what you want.
 

TaSMania

ADSM.ORG Member
#3
I work with batch and shell, but I can't seem to find the command/code to just open a file and edit then save without changing to different name.
I guess I can script shell to run a second bat file to rename it back.
I guess I need help with:
Search word<node name> in file <dsm.opt> replace following word <node name> with <new node name>
 

moon-buddy

ADSM.ORG Moderator
#4
Here is an example of how to replace a TSM server name with a new one and/or replace the TCPPort.

There are 2 DOS batch scripts: The main, called OPT_BAClient.cmd calls a secondary script called dsm_opt.cmd.

(Explanations are in ( ) when called for on the script lines)

OPT_BAClient.cmd:

@echo off

c:
cd "Program Files\Tivoli\TSM\baclient"

REM ****************************************
REM sets the correct TSM Servername and Port
REM ****************************************

call dsm_opt.cmd <old_TSM_ServerName> <new_TSM_ServerName> (use server name that is DNS defined)
call dsm_opt.cmd <old_TCPPort> <new_TCPPort> (use TCPPort number, i.e., 1500)

REM *****************************************************
REM Updates the TSM userid and password on current server
REM *****************************************************

dsmcutil updatepw /node:%COMPUTERNAME% /password:%COMPUTERNAME%

dsm_opt.cmd:

@echo off &setlocal
set "search=%1"
set "replace=%2"
set "textfile=dsm.opt" (This sets the files to be searched and lines to be replaced)
set "newfile=dsm1.opt"
(for /f "delims=" %%i in (%textfile%) do (
set "line=%%i"
setlocal enabledelayedexpansion
set "line=!line:%search%=%replace%!"
echo(!line!
endlocal
))>"%newfile%"
del %textfile%
rename %newfile% %textfile%

Notes:

1. You can add as many lines on the DSM.OPT for to be reaplaced
2. If you need to replace the nodename or COMPUTERNAME, add some substitution commands within OPT_BAClient.cmd
 

TaSMania

ADSM.ORG Member
#5
I'm a bit confused. What you offered, I saw already. it's a little much than I need or to follow.

Which step is the one to search word "NODENAME" ?
I do not want to replace NODENAME but anything(unknown) after NODENAME, which would be the server name with %COMPUTERNAME%
 

moon-buddy

ADSM.ORG Moderator
#6
I'm a bit confused. What you offered, I saw already. it's a little much than I need or to follow.

Which step is the one to search word "NODENAME" ?
I do not want to replace NODENAME but anything(unknown) after NODENAME, which would be the server name with %COMPUTERNAME%
Then, this will not work for you.

I will see if there is any other way
 

TaSMania

ADSM.ORG Member
#7
Thanks for helping. I think scripted something similar awhile back using SHELL get content but can't find it. I'm still googleing and youtubing also :)
 

TaSMania

ADSM.ORG Member
#8
I think I'm close to what I'm after but need or missing something here.
I'm using Powershell:
Code:
Get-Content "C:\Program Files\Tivoli\TSM\baclient\dsm.opt" -replace "NODENAME*","NODENAME     %COMPUTERNAME%"  | Set-Content "C:\Program Files\Tivoli\TSM\baclient\dsm2.opt"
 

TaSMania

ADSM.ORG Member
#9
Ok I got it!
Code:
$path = "C:\Program Files\Tivoli\TSM\baclient\dsm.opt" 
(Get-Content $path) -replace "nodename(.*)","NODENAME                $env:computername" | out-file $path
 

Advertise at ADSM.ORG

If you are reading this, so are your potential customer. Advertise at ADSM.ORG right now.

UpCloud high performance VPS at $5/month

Get started with $25 in credits on Cloud Servers. You must use link below to receive the credit. Use the promo to get upto 5 month of FREE Linux VPS.

The Spectrum Protect TLA (Three-Letter Acronym): ISP or something else?

  • Every product needs a TLA, Let's call it ISP (IBM Spectrum Protect).

    Votes: 17 19.5%
  • Keep using TSM for Spectrum Protect.

    Votes: 53 60.9%
  • Let's be formal and just say Spectrum Protect

    Votes: 10 11.5%
  • Other (please comement)

    Votes: 7 8.0%

Forum statistics

Threads
31,472
Messages
134,143
Members
21,569
Latest member
srinathkodela
Top