CommVault Backups: Pre and Post Commands
Author: jason
Date: 2014-02-06 14:48:20
Category: Musing

I wanted to use PowerShell scripts from CommVault as Pre/Post Commands to be run before and after the Restore of a SQL Database.

1) To execute the Powershell I used the powershell.exe path with the -Command switch to call the script file
2) The script and powershell.exe are local to the server the restore or backup is happening to, i.e. I'm backing up ServerA from CommVault ServerB. The PowerShell path and Script commands are run on ServerA via the CommVault Agent.
3) I included parameters for my PowerShell script so I could pass in the Server and Database names

Here's how my setup looks




Note if the Pre Command script fails the actual Restore won't start. The Job will stay in Pending or Waiting or something like that...




http://documentation.commvault.com/commvault/v10/article?p=features/pre_post/prepost_process_how_to.htm

http://documentation.commvault.com/dell/release_7_0_0/books_online_1/english_us/features/pre_post/prepost_process_how_to.htm

http://documentation.commvault.com/hds/release_8_0_0/books_online_1/english_us/features/pre_post/prepost_process.htm

Code

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command d:\PrepRestore.ps1 -DBServer "MtSrv" -DBName "MyDB"




jason @ jasonthomasfrance.com - www.masterstationlog.com - copyright 2009