• 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.


    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.

Windows client script to update opt file

Does anyone have a script (bat, vbs, or powershell) that can modify the existing .opt file on a Windows Server Client?

I need to update the backup server name, tcpport, and tcpserveraddress. I already have the tools to deploy the script, just need to modify the existing opt file.


ADSM.ORG Moderator
Here is something I wrote a while back and does exactly what you want. The DOS batch file is in two parts:

Part 1 - replaces the parts like TCPSERVERADDRESS and TCPPort values:
@echo off &setlocal

set "search=%1"
set "replace=%2"
set "textfile=dsm.opt"
set "orifile=dsm_ori.opt"
set "newfile=dsm_mod.txt"

copy %textfile% %orifile%

(for /f "delims=" %%i in (%textfile%) do (
    set "line=%%i"
    setlocal enabledelayedexpansion
    set "line=!line:%search%=%replace%!"

del %textfile%

rename %newfile% %textfile%
This script is saved as dsm_opt.cmd

Part 2 - (1) implements the changes, (2) updates the password, and (3) restarts the TSM Service

@echo off

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

call dsm_opt.cmd <OLD_TSM_server_DNS_name> <NEW_TSM_server_DNS_name>
call dsm_opt.cmd <OLD_TCPPort> <NEW_TCPPort>

REM *****************************************************
REM Updates the TSM userid and password on new TSM Server
REM *****************************************************

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

REM ******************************
REM Restarts the right TSM Service
REM ******************************

sc query type= service state= all|find /i "TSM Client Acceptor" > tsm_srvc

for %%a in (tsm_srvc) do set length=%%~za

if %length% == 0 (
  net stop TSM Acceptor
  net start TSM Acceptor
) else (
  net stop TSM Client Acceptor
  net start TSM Client Acceptor

del tsm_srvc
You can save this to something like DSMOPT_Main.cmd

As you can see, the TSM Server and TCPPort values are changed against TCPSERVERADDRESS and TCPPort options, respectively.

The node name and password used here (in this case) is the Net BIOS server name.

The last portion allocates for variances with the TSM Service naming. If you use a TSM CAD to initiate the TSM backup, all you need is to restart the TSM Client Acceptor service.


The scripts MUST see the dsmcutil.exe path. Better yet, execute the scripts on where the dsmcutil.exe lives.

All that is needed is to run DSMOPT_Main.cmd


Added missed line: copy %textfile% %orifile%
Last edited:

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: 8 21.6%
  • Keep using TSM for Spectrum Protect.

    Votes: 19 51.4%
  • Let's be formal and just say Spectrum Protect

    Votes: 6 16.2%
  • Other (please comement)

    Votes: 4 10.8%

Forum statistics

Latest member