we've got some SureBackup jobs that keep running even after they have finished (sounds strange, I know, I'll open a SR for this). In the meantime the VBR PowerCLI cmdlets came to my mind as a workaround. Idea: simply set up a task that runs every morning and stops the SureBackup jobs. However, Stop-VSBJob throws a InvalidCast exception when fed with output from Get-VSBJob. Has anyone used this successfully?
PS C:\Users\Administrator> get-vsbjob
Job Name State Last Result Description
-------- ----- ----------- -----------
sb-job01 Created by VEEAM\Administr...
PS C:\Users\Administrator> get-vsbjob | %{ stop-vsbjob $_ }
Stop-VSBJob : Die angegebene Umwandlung ist ungültig.
Bei Zeile:1 Zeichen:25
+ get-vsbjob | stop-vsbjob <<<<
+ CategoryInfo : InvalidOperation: (Veeam.Backup.Po...mand.StopVS
BJob:StopVSBJob) [Stop-VSBJob], InvalidCastException
+ FullyQualifiedErrorId : Backup,Veeam.Backup.PowerShell.Command.StopVSBJo
b
Once this is working, how can the VBR cmdlets be loaded into a regular PowerShell instance that's started from a scheduled task (via: powershell "<path-to-script>")? Currently they are only available when the PowerShell window is started from within VBR.
Sebastian, to make Veeam B&R PowerShell cmdlets available for scheduled tasks, you should register Veeam PSSnapin with the command below before executing your script:
Sebastian, after consulting to our PowerShell developer, I can say that these cmdlets should work. Could you please open a support ticket regarding PS cmdlets as well?