-
- Service Provider
- Posts: 48
- Liked: 7 times
- Joined: Feb 20, 2023 9:28 am
- Full Name: Marco Glavas
- Contact:
How to manage jobs in the "Running" View
Hi everyone
For reasons I'm not going to get into right now, I spend a lot of time manually killing SOBR Offload jobs.
I was wondering if I could automate this with powershell.
Is there a way to get a list of jobs currently in the "Running" pane of the GUI and killing them by name? I need jobs that are in Running, Starting or Waiting for...resources states.
It would be QUITE the bonus if we could extract the jobs' IDs so we could also terminate the corresponding processes if necessary.
Thanks for your input.
For reasons I'm not going to get into right now, I spend a lot of time manually killing SOBR Offload jobs.
I was wondering if I could automate this with powershell.
Is there a way to get a list of jobs currently in the "Running" pane of the GUI and killing them by name? I need jobs that are in Running, Starting or Waiting for...resources states.
It would be QUITE the bonus if we could extract the jobs' IDs so we could also terminate the corresponding processes if necessary.
Thanks for your input.
-
- Veeam Software
- Posts: 2010
- Liked: 669 times
- Joined: Sep 25, 2019 10:32 am
- Full Name: Oleg Feoktistov
- Contact:
Re: How to manage jobs in the "Running" View
Hi Marco,
You can get all backup sessions and filter them out by not "Stopped" state:
That will pretty much imitate the "Running" pane.
To filter sessions by other states, take a look at the available states in the following enum:
To extract Job id from session object, access this property:
Hope that helps,
Oleg
You can get all backup sessions and filter them out by not "Stopped" state:
Code: Select all
$sessions = Get-VBRBackupSession | where {$_.State -ne 'Stopped'}
$sessions
To filter sessions by other states, take a look at the available states in the following enum:
Code: Select all
[Veeam.Backup.Model.CBaseSessionInfo+EState].GetEnumValues()
Code: Select all
$sessions[0].JobId
Oleg
-
- Service Provider
- Posts: 48
- Liked: 7 times
- Joined: Feb 20, 2023 9:28 am
- Full Name: Marco Glavas
- Contact:
Re: How to manage jobs in the "Running" View
Unfortunately, that is not a solution to my problem. The software seems to make a difference between Offloading Jobs and everything else. I have about 80 jobs in the GUI view but this command only returns like four.
-
- Service Provider
- Posts: 48
- Liked: 7 times
- Joined: Feb 20, 2023 9:28 am
- Full Name: Marco Glavas
- Contact:
Re: How to manage jobs in the "Running" View
Can I assume Offload Job management has kinda been forgotten by the PowerShell devs at this point?
-
- Veeam Software
- Posts: 2010
- Liked: 669 times
- Joined: Sep 25, 2019 10:32 am
- Full Name: Oleg Feoktistov
- Contact:
Re: How to manage jobs in the "Running" View
Forgotten - no, planned for future versions - yes. My bad, I forgot that the main point was about offload sessions. They are not, indeed, exposed with the official cmdlets, but you can still get them with unsupported methods.
For instance, the method below will return running sessions only thus emulating Running pane precisely + it will show shell run sessions:
Further on, make sure to filter them by job type and not abort the shell run sessions. You can get job types here:
The values that are related to offload all start with Archive.
Thanks,
Oleg
For instance, the method below will return running sessions only thus emulating Running pane precisely + it will show shell run sessions:
Code: Select all
$runningSessions = [Veeam.Backup.Core.CBaseSession]::GetRunning()
$runningSessions
Code: Select all
[Veeam.Backup.Model.EDbJobType].GetEnumValues()
Thanks,
Oleg
-
- Service Provider
- Posts: 48
- Liked: 7 times
- Joined: Feb 20, 2023 9:28 am
- Full Name: Marco Glavas
- Contact:
Re: How to manage jobs in the "Running" View
Thank you, this looks very promising.
I have one little issue: When running this on a fresh session I get an error.
Exception calling "GetRunning" with "0" argument(s): "Database connection was closed"
Can you tell me how to open and close the DB session? I've tried a simple connect-vbrserver but that doesn't seem to work when running the script.
I have one little issue: When running this on a fresh session I get an error.
Exception calling "GetRunning" with "0" argument(s): "Database connection was closed"
Can you tell me how to open and close the DB session? I've tried a simple connect-vbrserver but that doesn't seem to work when running the script.
-
- Veeam Software
- Posts: 2109
- Liked: 509 times
- Joined: Jun 28, 2016 12:12 pm
- Contact:
Re: How to manage jobs in the "Running" View
Hey @EWMarco
After Connect-VBRServer, run any cmdlet first and just pipe the output to NULL
Get-VBRLicenseAutoUpdateStatus | Out-Null
The method Oleg mentioned is .NET Reflection, and it calls the DLLs directly; sometimes they need a chance to get "hot", but running a cmdlet should do it.
In my lab, even with a script, it works fine just by doing a quick call.
After Connect-VBRServer, run any cmdlet first and just pipe the output to NULL
Get-VBRLicenseAutoUpdateStatus | Out-Null
The method Oleg mentioned is .NET Reflection, and it calls the DLLs directly; sometimes they need a chance to get "hot", but running a cmdlet should do it.
In my lab, even with a script, it works fine just by doing a quick call.
David Domask | Product Management: Principal Analyst
-
- Service Provider
- Posts: 48
- Liked: 7 times
- Joined: Feb 20, 2023 9:28 am
- Full Name: Marco Glavas
- Contact:
Re: How to manage jobs in the "Running" View
Thank you!
Who is online
Users browsing this forum: No registered users and 1 guest