PowerShell script exchange
Gunnersaurus
Service Provider
Posts: 66
Liked: 6 times
Joined: Aug 31, 2015 8:20 pm
Contact:

List all active Cloud Backup Copy jobs

Post by Gunnersaurus »

Hi,

I'm trying to find the PowerShell command that will list all active Cloud Backup Copy jobs. I am able to see this from the Veeam console under Cloud Connect > Last 24 Hours > Running

Can someone please point me in the right direction? I've tried Get-VBRJob however I don't think this includes Cloud Connect jobs as it doesn't return any results.

Cheers!
Mike Resseler
Product Manager
Posts: 8044
Liked: 1263 times
Joined: Feb 08, 2013 3:08 pm
Full Name: Mike Resseler
Location: Belgium
Contact:

Re: List all active Cloud Backup Copy jobs

Post by Mike Resseler »

Hi Gunnersaurus,

Unfortunately I cannot test at this moment but I believe you should be looking into this direction:

Code: Select all

$Job = Get-VBRBackupSession #This returns all sessions for backup, backup copy job, replication and file copy jobs
$Job | ? {$_State -eq "Working"} | %{Write-Host $_.Name "-" $_.State}
The above should give you all sessions with a running state (or working).

Let me know
Mike
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: List all active Cloud Backup Copy jobs

Post by veremin »

The following one-liner should answer your requirements:

Code: Select all

Get-VBRJob | where {$_.Jobtype -eq "BackupSync" -and $_.isCloudTargetJob() -eq $True -and $_.GetLastState() -eq "Running"} | select name
Thanks.
Gunnersaurus
Service Provider
Posts: 66
Liked: 6 times
Joined: Aug 31, 2015 8:20 pm
Contact:

Re: List all active Cloud Backup Copy jobs

Post by Gunnersaurus »

I have tried both solutions however neither return any results. I should mention that I am attempting to run this on the destination Cloud Connect Veeam server which has the console installed. In other words, tenant Backup Copy jobs are being received on the server that I am trying to run the command from.
Mike Resseler
Product Manager
Posts: 8044
Liked: 1263 times
Joined: Feb 08, 2013 3:08 pm
Full Name: Mike Resseler
Location: Belgium
Contact:

Re: List all active Cloud Backup Copy jobs

Post by Mike Resseler »

Hi Gunnersaurus,

Could you run it without the ?. So:

Code: Select all

$Job = Get-VBRBackupSession 
$Job | %{Write-Host $_.Name "-" $_.State}
This will give you the entire list and you should be able to see everything and the state and see what that returns?
Mike Resseler
Product Manager
Posts: 8044
Liked: 1263 times
Joined: Feb 08, 2013 3:08 pm
Full Name: Mike Resseler
Location: Belgium
Contact:

Re: List all active Cloud Backup Copy jobs

Post by Mike Resseler »

Or the oneliner of Vova but remove the last query

Code: Select all

Get-VBRJob | where {$_.Jobtype -eq "BackupSync" -and $_.isCloudTargetJob() -eq $True} | select name, state
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: List all active Cloud Backup Copy jobs

Post by veremin »

In other words, tenant Backup Copy jobs are being received on the server that I am trying to run the command from.
Ah, tenants' backup copy jobs are not returned by PowerShell queries executed on SP's backup console. Feel free to leverage Veeam ONE Free that should have reports you're looking for. Thanks.
Gunnersaurus
Service Provider
Posts: 66
Liked: 6 times
Joined: Aug 31, 2015 8:20 pm
Contact:

Re: List all active Cloud Backup Copy jobs

Post by Gunnersaurus »

v.Eremin wrote:Ah, tenants' backup copy jobs are not returned by PowerShell queries executed on SP's backup console. Feel free to leverage Veeam ONE Free that should have reports you're looking for. Thanks.
Will using Veeam ONE still allow me use that informatoin in a PowerShell script?

Basically, I want to temporarily disable a tenants account but before doing so, I need to make sure no Backup Copy Jobs are running to the MSP backup repository.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: List all active Cloud Backup Copy jobs

Post by veremin »

Veeam ONE does not expose information through PowerShell. As to disabling inactive tenants, have you thought about leveraging LastActive parameter of Tenant object? Make script check the said parameter and disable an account, if last activity happened, say, more than 30 minutes ago.
Gunnersaurus
Service Provider
Posts: 66
Liked: 6 times
Joined: Aug 31, 2015 8:20 pm
Contact:

Re: List all active Cloud Backup Copy jobs

Post by Gunnersaurus »

I had a look at LastActive however for customers where the console shows an active backup, it shows LastActive as either a few hours ago or 1/01/1900.
StigSornsen
Novice
Posts: 8
Liked: 1 time
Joined: Nov 17, 2016 2:39 pm
Full Name: Stig Sörnsen
Contact:

[MERGED] Last 24 hours in Powershell?

Post by StigSornsen »

Hi, I would like to get the "Last 24 hours" view in Cloud Connect through Powershell.
But I can't see how to do that?

In Powershell regarding Cloud Connect I can only do the same as the in built Report shows. But the "Last 24 hours" view is quite useful to see if everything has worked as intended an also see which objects has failed if so.

Any help getting that useful info?
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: List all active Cloud Backup Copy jobs

Post by veremin » 1 person likes this post

The information you're looking for currently is not exposed via PowerShell. Have you checked Veeam ONE Cloud Connect free report pack?
StigSornsen
Novice
Posts: 8
Liked: 1 time
Joined: Nov 17, 2016 2:39 pm
Full Name: Stig Sörnsen
Contact:

Re: List all active Cloud Backup Copy jobs

Post by StigSornsen »

v.Eremin wrote:The information you're looking for currently is not exposed via PowerShell. Have you checked Veeam ONE Cloud Connect free report pack?

Hi Eremin, thank you for quick reply. Do you know how I can find that information in database? I have gone through alot of tables but haven't found it yet.
StigSornsen
Novice
Posts: 8
Liked: 1 time
Joined: Nov 17, 2016 2:39 pm
Full Name: Stig Sörnsen
Contact:

Re: List all active Cloud Backup Copy jobs

Post by StigSornsen » 1 person likes this post

Found it with a profiler:

Code: Select all

SELECT  *  FROM ReportCloudFilteredSessionsView WITH (readuncommitted, nolock) WHERE (([end_time]  >  '2017-06-18T15:02:13' or [end_time]  =  '1900-01-01T00:00:00')) AND (([session_type]  =  '1' or ([session_type]  =  '2' or ([session_type]  =  '4' or [session_type]  =  '6')))) AND (not (([session_type]  =  '2' and ([productId]  =  '{819A7952-2B80-4287-A99A-79DD0578E5AD}' or [productId]  =  '{2C9E3B09-F27C-4E27-8A8E-CFEF030041F2}')))) AND (([end_time]  >  '2017-06-18T15:02:13' or [end_time]  =  '1900-01-01T00:00:00')) AND ([usn]  >  '0')  ORDER BY creation_time  desc

This give me exactly what I want. Though I would love to be able to do this with Powershell natively :)
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: List all active Cloud Backup Copy jobs

Post by veremin »

Your voice has been heard, we will see what we can add for this matter in future product releases. By the way, great workaround!
sgarcianf
Service Provider
Posts: 2
Liked: never
Joined: Feb 23, 2018 7:47 pm
Full Name: Steven Garcia
Contact:

Re: List all active Cloud Backup Copy jobs

Post by sgarcianf »

v.Eremin.. clearly he is looking for a programmatic means to work around tenant jobs but you keep pushing veeam one reporter? This is not helpful. What is helpful is a way to insert this request into a voting list or some means by which we as Veeam SPs can input our needs as stakeholders.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: List all active Cloud Backup Copy jobs

Post by veremin »

I'm not trying to push anything, it's more about me suggesting existing solution that answers OP's requirements.

If Veeam ONE is not something you'd like to stick with, then, there is a programmatic workaround given on a previous page.

Anyway, consider your vote for PS enhancement counted.

Thanks.
christophe.niel.AID
Service Provider
Posts: 11
Liked: never
Joined: Jul 25, 2019 1:11 pm
Full Name: Christophe Niel
Contact:

[MERGED] List running jobs/session in Cloud Connect replicas

Post by christophe.niel.AID »

Hello
I'm hosting a cloud connect with multiple tenants, one gateway a few dozen replicas

I'm trying to get the running replicas jobs (or more precisely the ones named "Cloud Backup Copy" in the Session Type)

my goal is to know when there are no active replication to do a bit of maintenance and cleanup on my proxies as I have a bug where the disks are staying mounted on the proxies and that is causing a lot of problems. this is not the issue of this post, ticket are already opened.

my problem is I can't seem to find active session for Jobs I don't have (they setup in my tenant server I don't see), and I could find a command in powershell Cloud Connect API to get active sessions.

Is there a way to get the running sessions in a command line (not powershell would be ok) ?
if there are no way to get it now, is it planned some time in the future?

thanks in advance
Christophe Niel
billcouper
Service Provider
Posts: 150
Liked: 30 times
Joined: Dec 18, 2017 8:58 am
Full Name: Bill Couper
Contact:

Re: List running jobs/session in Cloud Connect replicas

Post by billcouper »

Don't do cloud connect replicas here, but if it works similar to cloud connect backups the 'last active date' is set to 1/1/1900 when it's running
christophe.niel.AID
Service Provider
Posts: 11
Liked: never
Joined: Jul 25, 2019 1:11 pm
Full Name: Christophe Niel
Contact:

Re: List running jobs/session in Cloud Connect replicas

Post by christophe.niel.AID »

Hi, thanks for your response

My problem is I can't even list the jobs or sessions from the veaam cloud connect.
I can get normal veeam B&R job and session.

What do you use as a command to event list the jobs?

Thanks in advance
christophe.niel.AID
Service Provider
Posts: 11
Liked: never
Joined: Jul 25, 2019 1:11 pm
Full Name: Christophe Niel
Contact:

Re: List running jobs/session in Cloud Connect replicas

Post by christophe.niel.AID »

ah, I can't edit a post

maybe I should insist on the fact I am on the Service Provider (SP) side, not the Client side.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: List all active Cloud Backup Copy jobs

Post by veremin »

This information is not available in PS or REST. You can use Veeam ONE free report pack, though. Thanks!
christophe.niel.AID
Service Provider
Posts: 11
Liked: never
Joined: Jul 25, 2019 1:11 pm
Full Name: Christophe Niel
Contact:

Re: List all active Cloud Backup Copy jobs

Post by christophe.niel.AID »

Thanks for your answer, but that is not a valid (acceptable) answer but I'll contact support from now on, even with the B&R admin console I don't even know which resources (ie: MY proxies) are being used by the clients..

I'm setting up a cloud with automation and bots, and I'm not sure if I need a software that must to have an UI and a human to read the output to make our cloud working.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: List all active Cloud Backup Copy jobs

Post by veremin »

I'm not sure that support team will help you with this issue. The can log feature request, sure, but you've done exactly that by posting your query here.

For now you can try db approach mentioned above or CC reports available in Veeam ONE.

Thanks; consider your vote counted!
christophe.niel.AID
Service Provider
Posts: 11
Liked: never
Joined: Jul 25, 2019 1:11 pm
Full Name: Christophe Niel
Contact:

Re: List all active Cloud Backup Copy jobs

Post by christophe.niel.AID »

Thanks for your answer
Yes i was hoping to ask for a feature request to support, didn't know posting here would help for this.
I'll look into the db in the next days, if I find something I'll post it
Veeamone is not in my scope, I'll check with the team.

Best regards
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: List all active Cloud Backup Copy jobs

Post by veremin »

Since you're a Cloud Connect Provider, then, Veeam ONE (or its Cloud Connect report features) are available for you free. So, might be worth checking. Thanks!
chris.arceneaux
VeeaMVP
Posts: 667
Liked: 358 times
Joined: Jun 24, 2019 1:39 pm
Full Name: Chris Arceneaux
Location: Georgia, USA
Contact:

Re: List all active Cloud Backup Copy jobs

Post by chris.arceneaux » 2 people like this post

I've discovered a PowerShell method for retrieving this information. Please keep in mind that an undocumented API is being used so it's subject to change.

Code: Select all

[Veeam.Backup.Core.CCloudSession]::GetAll()
The output shows more than just Backup Copy Jobs and Replica Jobs:

Image

If you're simply checking if there are any active sessions, let's say prior to a scheduled maintenance, the below one-liner will report the number of active sessions:

Code: Select all

([Veeam.Backup.Core.CCloudSession]::GetAll() | ?{$_.JobName -ne "Console"} | ?{$_.State -eq "Working"}).Count
TheOnlyWizard17
Service Provider
Posts: 50
Liked: 15 times
Joined: Nov 15, 2016 3:38 pm
Full Name: Bart van de Beek
Contact:

Re: List all active Cloud Backup Copy jobs

Post by TheOnlyWizard17 » 1 person likes this post

Even a little more direct for what people are looking for here:
[Veeam.Backup.Core.CCloudSession]::GetRunning()|? CloudType -eq BackupCopy

(GetAll() takes ages, at least in my environment, while the above one completes in seconds)
tjurgens
Service Provider
Posts: 170
Liked: 54 times
Joined: Nov 20, 2019 5:44 pm
Full Name: Tyler Jurgens
Contact:

Re: List all active Cloud Backup Copy jobs

Post by tjurgens »

I ran into the same command a long while back as well
[Veeam.Backup.Core.CCloudSession]::GetRunning()
However, it seems with v12 it no longer returns anything.

Code: Select all

PS C:\Windows\system32> [Veeam.Backup.Core.CCloudSession]::GetRunning()
Exception calling "GetRunning" with "0" argument(s): "Object reference not set to an instance of an object."
At line:1 char:1
+ [Veeam.Backup.Core.CCloudSession]::GetRunning()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : NullReferenceException
Anyone have an updated command that works with v12, or maybe even a proper powershell module?
david.domask
VeeaMVP
Posts: 1034
Liked: 278 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: List all active Cloud Backup Copy jobs

Post by david.domask » 2 people like this post

Hi @tjurgens,

I think it's likely that the modules haven't fully loaded. I noticed that .NET reflection doesn't seem to work in v12 until you actually run an official cmdlet; I'm not sure on the reason, but I suspect it's that the DLLs don't get fully loaded for reflection until you actually invoke a cmdlet; likely it's a performance improvement to avoid unnecessary loading.

Try running a simple cmdlet before you run any .NET reflection (like Connect-VBRServer or Get-VBRLicenseAutoUpdateStatus), then try the reflection again.
David Domask | Director: Customer Care | Veeam Technical Support
Post Reply

Who is online

Users browsing this forum: bct44 and 22 guests