PowerShell script exchange
Post Reply
zschaffner
Lurker
Posts: 2
Liked: never
Joined: Dec 30, 2013 6:57 pm
Full Name: Zach Schaffner
Contact:

job processing question

Post by zschaffner »

I am working on a script to perform backups of enterprise vault for Microsoft exchange and have the process layed out and working for the most part. The scheduled task runs daily and follows the following steps.

1. Puts the vault store in backup mode
2. puts the index locations in backup mode
3. adds the Veeam ps snapin
4. starts the Veeam backup job

My problem is that when the script gets to the last step to start the job I am getting an error, Start-VBRJob : Exception has been thrown by the target of an invocation.

The backup will start if I add -fullbackup to the command but I don't want to get a full backup everyday for obvious reasons.

Here is the code that I have as of now that works up until the start-vbrjob piece.

Code: Select all

#EV-VEEAM Pre-job

#Create new session to EV Server
$EVSession = New-PSSession -ComputerName Coleman.encorefbo.com -ConfigurationName Microsoft.Powershell32

#Load snapin and please Vault in backup mode
Invoke-Command -Session $EVSession -ScriptBlock {Add-PSSnapin Symantec.EnterpriseVault.PowerShell.Snapin}
Invoke-Command -Session $EVSession -ScriptBlock {Set-vaultstorebackupmode -name "VSG1" -evservername evserver1.encorefbo.com -evobjecttype vaultstoregroup}
Invoke-Command -Session $EVSession -ScriptBlock {set-indexlocationbackupmode -evservername evserver1.encorefbo.com}
invoke-command -Session $EVSession -ScriptBlock {Remove-Item "M:\Enterprise Vault Stores\VS1 Ptn1\ignorearchivebittrigger.old"}

#Clean up session
Remove-PSSession -ComputerName Coleman.encorefbo.com

#Load veeam snapin
add-pssnapin veeampssnapin

#Start Veeam BackupJob
get-vbrjob | where {$_.name -eq "Vault"} | start-vbrjob -FullBackup
Here is the error from the powershell instance when I run the script manually.

Code: Select all

PS C:\Users\zschaffneradmin> get-vbrjob -name "Vault" | Start-VBRJob
Start-VBRJob : Exception has been thrown by the target of an invocation.
At line:1 char:28
+ get-vbrjob -name "Vault" | Start-VBRJob
+                            ~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Start-VBRJob], TargetInvocationException
    + FullyQualifiedErrorId : System.Reflection.TargetInvocationException,Veeam.Backup.PowerShell.Command.StartVBRJob
Any help is greatly appreciated.
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: job processing question

Post by veremin »

What is the account under which the script is executed? Can you try an admin one and see whether it makes any difference? Thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests