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

Legal Hold Backup

Hello everyone every month I have to run the command "GENERATE BACKUPSET RWEXCH1AH21 LGL052012 Devclass=ltodev toc=preferred wait=no retention=nolimit" to run our monthly legal hold backup of our exchange servers. Im trying to automate this process by using a script but I need some help. I would need to change LGL052012 to the previous month and year everymonth before I run the backup so TSM knows to backup the previous month. Also how can I get these tapes that it dos the backup to to eject automatically when done. Thanks everyone for your help


ADSM.ORG Moderator
What environment are you on - I would be suggesting a script outside of TSM but the script depends on whether you are in Windows or Unix/Linux.


ADSM.ORG Moderator
This works by default in Windows 2008 and later. Powershell is needed.

@echo off

ren Run this in c:\Program Files\Tivoli\TSM\balient where
ren dsmadmc.exe is located

PowerShell $date = Get-Date; $date=$date.AddMonths(-1); $date.ToString('MMyyyy') > lastMth.dat

for /F %%i in (lastMth.dat) do (
dsmadmc -id=admin -pa=adminpass "GENERATE BACKUPSET RWEXCH1AH21 LGL%%i Devclass=ltodev toc=preferred wait=no retention=nolimit"

Save as a cmd fle.

Schedule it to run at the first of each month.
Thanks so much this looks like it is going to work perfect. Is there any way I can get TSM to eject these tapes once the backup is done?


ADSM.ORG Moderator
Thanks so much this looks like it is going to work perfect. Is there any way I can get TSM to eject these tapes once the backup is done?
When something like this is executed from outside TSM, the challenge is to know when a process such as this is done and go on to the next step.

Well, it won't be straightforward and easy to do. What you can try is look for the AN code from the actlog that signals the 'generate backupset' is done and base the tape ejection from there. I don't know the AN code for this!
Last edited:


ADSM.ORG Moderator
Replace: PowerShell $date = Get-Date; $date=$date.AddMonths(-1); $date.ToString('MMyyyy') > lastMth.dat

with: PowerShell $date = Get-Date; $date.ToString('MMyyyy') > lastMth.dat

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

    Votes: 60 61.2%
  • Let's be formal and just say Spectrum Protect

    Votes: 12 12.2%
  • Other (please comement)

    Votes: 8 8.2%

Forum statistics

Latest member