PowerShell script exchange
Post Reply
theq77
Novice
Posts: 7
Liked: 1 time
Joined: Apr 02, 2019 3:06 pm
Full Name: theq
Contact:

Import-session with Veeam

Post by theq77 » 1 person likes this post

Hi there,

I do want to use import-pssession to use veeam cmdlets from a remote server.

I do

Code: Select all

$PS= new-pssession CTE1W01VBR0001
Invoke-Command $ps {Add-PSSnapin VeeamPSSNapin; Connect-VBRServer }
Import-PSSession -Session $ps -CommandName @('New-VBRJobOptions','Set-VBRJobOptions','Get-VBRJob')
Now I´d like to do:

Code: Select all

$retention = New-VBRJobOptions -ForBackupJob
$retention.BackupStorageOptions.RetainCycles = $RetentionDays
Set-VBRJobOptions -Job $Job -Options $retention | Out-Null 
But I get this error message:

Code: Select all

The property 'RetainCycles' cannot be found on this object. Verify that the property exists and can be set.
At line:1 char:9
+         $retention.BackupStorageOptions.RetainCycles = $RetentionDays
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyAssignmentException 
The same scripts works on the server without pssession.

TIA
veremin
Product Manager
Posts: 20284
Liked: 2258 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Import-session with Veeam

Post by veremin »

Before we dig deeper into it, why don't you use a Connect-VBRServer to orchestrate PS activity on remote backup server? Thanks!
theq77
Novice
Posts: 7
Liked: 1 time
Joined: Apr 02, 2019 3:06 pm
Full Name: theq
Contact:

Re: Import-session with Veeam

Post by theq77 »

This way you have to install the console on the automation server - and keep it up to date, like the veeam servers.

But anyway, when this is the solution. But: I'm using system center orchestrator and therefor I have only 32bits - and your add-on seems to have 64bit.

So I know these solutions in orchestrator with PowerShell:
a) invoke-pssession
b) run powershell.exe

Or is there an other solutions, which I probably could like a bit more?
Post Reply

Who is online

Users browsing this forum: No registered users and 13 guests