CommVault Backups: Pre and Post Commands
Date: 2014-02-06 14:48:20
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...
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command d:\PrepRestore.ps1 -DBServer "MtSrv" -DBName "MyDB"