-
- Enthusiast
- Posts: 28
- Liked: 3 times
- Joined: Dec 10, 2019 5:37 pm
- Full Name: Larry Heintz
- Contact:
veeam cmdlet or code to show job creation time
Hello, was wondering if there is a way to get a date as to when a job was created via veeam cmdlets? I can't seem to find the information I am looking for in the get-vbrjob cmdlet. Grateful for any help!
-
- Veeam Software
- Posts: 2010
- Liked: 670 times
- Joined: Sep 25, 2019 10:32 am
- Full Name: Oleg Feoktistov
- Contact:
Re: veeam cmdlet or code to show job creation time
Hi Larry,
We do write job creation time to our DB, but when it comes to our Powershell module, there isn't any straightforward way to get it. Neither CBackupJob, nor CDbBackupJobInfo class have this property. The only way I could figure out to get it apart from a direct SQL query is to write custom message to job description containing current datetime either through UI or Powershell and then parse it from there.
Thanks,
Oleg
We do write job creation time to our DB, but when it comes to our Powershell module, there isn't any straightforward way to get it. Neither CBackupJob, nor CDbBackupJobInfo class have this property. The only way I could figure out to get it apart from a direct SQL query is to write custom message to job description containing current datetime either through UI or Powershell and then parse it from there.
Thanks,
Oleg
-
- Enthusiast
- Posts: 28
- Liked: 3 times
- Joined: Dec 10, 2019 5:37 pm
- Full Name: Larry Heintz
- Contact:
Re: veeam cmdlet or code to show job creation time
Thank you for the reply Oleg.
Should I open a support case to discuss acquiring SQL Queries to provide the information we are looking for?
Should I open a support case to discuss acquiring SQL Queries to provide the information we are looking for?
-
- Veeam Software
- Posts: 2010
- Liked: 670 times
- Joined: Sep 25, 2019 10:32 am
- Full Name: Oleg Feoktistov
- Contact:
Re: veeam cmdlet or code to show job creation time
Larry, here is a simple SQL query through Powershell to get job creation time:
It will select and display id, name and creation time utc for each job. If you feel confident with SQL, try the query above. Should you need any further help with it, please, let me know. Since this is a custom query/script you are asking for, the best way to discuss it is on forums. Our support can help with SQL queries only if it is needed to fix issues and inconsistencies within the product and its db. This is clearly not the case.
Also, keep in mind that querying veeam data directly through SQL is unofficial and not supported.
Thanks,
Oleg
Code: Select all
$instance = 'DBServerInstance'
$db = 'Veeam Backup Database'
$creds = Get-Credential
$user = $creds.GetNetworkCredential().Username
$pass = $creds.GetNetworkCredential().Password
Invoke-Sqlcmd -ServerInstance $instance -Database $db `
-Username $user -Password $pass -Query 'SELECT id, name, creation_date_utc FROM [BJobs]'
Also, keep in mind that querying veeam data directly through SQL is unofficial and not supported.
Thanks,
Oleg
-
- Veeam Software
- Posts: 2010
- Liked: 670 times
- Joined: Sep 25, 2019 10:32 am
- Full Name: Oleg Feoktistov
- Contact:
Re: veeam cmdlet or code to show job creation time
You might need to install this powershell module though to use Invoke-SQLCmd. Thanks!
-
- Enthusiast
- Posts: 28
- Liked: 3 times
- Joined: Dec 10, 2019 5:37 pm
- Full Name: Larry Heintz
- Contact:
Re: veeam cmdlet or code to show job creation time
Thank you Oleg.
I have access to the SQL Server that the Veeam B/R is on so I can just run the query to grab the information I need this afternoon.
I do need to install that PS module, but I will do that next week. We never install anything new on our personal dev machines on a friday
Thank again for the quick and helpful responses!
The support your company provides is awesome!
Have a great weekend as well!
I have access to the SQL Server that the Veeam B/R is on so I can just run the query to grab the information I need this afternoon.
I do need to install that PS module, but I will do that next week. We never install anything new on our personal dev machines on a friday
Thank again for the quick and helpful responses!
The support your company provides is awesome!
Have a great weekend as well!
-
- Veeam Software
- Posts: 2010
- Liked: 670 times
- Joined: Sep 25, 2019 10:32 am
- Full Name: Oleg Feoktistov
- Contact:
Re: veeam cmdlet or code to show job creation time
Glad to help! Let me know how it turns out. Thanks!
-
- Enthusiast
- Posts: 28
- Liked: 3 times
- Joined: Dec 10, 2019 5:37 pm
- Full Name: Larry Heintz
- Contact:
Re: veeam cmdlet or code to show job creation time
I have decided not to use the powershell commands to run it and just run via SMSS against the database.
If I see a need to connect to a sql server via Powershell I will definitely install the powershell module.
If I see a need to connect to a sql server via Powershell I will definitely install the powershell module.
-
- Influencer
- Posts: 20
- Liked: 1 time
- Joined: May 28, 2018 10:30 pm
- Location: France
- Contact:
Re: veeam cmdlet or code to show job creation time
Hello, Thanks for sharing, when i tried this script it did not work, i managed to get what i want by removing the auth part.
Thanks
Code: Select all
$instance = 'HOSTNAME\VEEAMSQL2016'
$db = 'VeeamBackup'
#$creds = Get-Credential
#$user = $creds.GetNetworkCredential().Username
#$pass = $creds.GetNetworkCredential().Password
Invoke-Sqlcmd -ServerInstance $instance -Database $db `
-Query 'SELECT id, name, creation_date_utc FROM [BJobs]'
-
- Veeam Software
- Posts: 2123
- Liked: 513 times
- Joined: Jun 28, 2016 12:12 pm
- Contact:
Re: veeam cmdlet or code to show job creation time
Maybe I'm misunderstanding the need here, but isn't this reflected in the Info.CreationTimeUTC property?
This is from my lab and these all align with the creation date of my jobs. But perhaps I misunderstand what is being looked for here.
Code: Select all
PS C:\Users\Administrator> $jobs = Get-VBRjob
PS C:\Users\Administrator> $jobs |Select Name, @{n="Creationtime";e={$_.Info.CreationTimeUtc}} |sort Name
Name Creationtime
---- ------------
gfs-test_clone1 1/26/2023 4:45:02 PM
old-vbr 1/31/2023 1:54:09 PM
quick-rep 1/31/2023 12:15:30 PM
restore-test 2/1/2023 10:37:54 AM
simple-replica 9/30/2022 8:24:16 AM
vaw-vbr 1/31/2023 9:47:40 AM
vmware-direct-objstg 2/1/2023 11:03:48 AM
vmware-ffi-cap-bb 8/30/2022 6:15:17 AM
vmware-per-job 1/19/2023 3:11:07 PM
David Domask | Product Management: Principal Analyst
-
- Influencer
- Posts: 20
- Liked: 1 time
- Joined: May 28, 2018 10:30 pm
- Location: France
- Contact:
Re: veeam cmdlet or code to show job creation time
Hello,
On my side, the goal easy simple, "when this jobs was created?" The description was not revelent since this was a copy of an existing job.
I give a try to your way but for me "Creationtime" is empty.
with the other way
Thnks for your reply
On my side, the goal easy simple, "when this jobs was created?" The description was not revelent since this was a copy of an existing job.
I give a try to your way but for me "Creationtime" is empty.
Code: Select all
PS C:\Users\Administrateur> $jobs = Get-VBRjob
PS C:\Users\Administrateur> $jobs |Select Name, @{n="Creationtime";e={$_.Info.CreationTimeUtc}} |sort Name
Name Creationtime
---- ------------
14-
14-
14-
14-
14-
14-
14-
14-
27-
27-
50-
50-
50-
50-
50-
50-
Backup Job 1
Backup Job 2
Backup Job 3
Backup Job 4
DC
LINUX-IMMUABLE
Code: Select all
id name creation_date_utc
-- ---- -----------------
6952cfaa-3937-4c70-b307-012e64cfd9d9 07/01/2023 14:39:33
4b798a06-017a-43c3-9488-0397ea5eb632 03/02/2023 15:47:57
00a0160b-e649-4888-8a3d-071cb39c7b51 03/02/2023 15:50:48
9581c437-1c09-46d9-82e8-0aed0e1e3de7 03/02/2023 14:25:39
3efe1648-a35e-404f-adbd-293f36bbbd24 07/01/2023 14:40:30
5351a345-1b13-4fa0-8213-333fc5eadd2d 03/02/2023 15:05:46
e8cb5375-6c4a-4bee-a7e6-335ac0cbc862 03/02/2023 14:23:03
07c4a4ff-5357-45f3-8acc-34f8360669fa 30/01/2023 11:27:09
f416dda4-b29c-4771-ac29-3597e095cde5 06/10/2022 16:35:05
73fff06b-f9da-4bc1-a91e-3d58f1f57416 03/02/2023 17:19:30
d7046d4e-ff92-4fb4-adc8-4433b7ef4c21 03/02/2023 17:32:28
84d11877-9383-45c5-9ccb-490a109ada45 30/01/2023 11:27:09
5596371f-cee5-4f2d-9849-649a70d2b213 03/02/2023 17:22:23
ad8a1023-5bdf-4715-93d4-69ac67ddef5b 03/02/2023 14:59:22
2686d447-22d8-4948-a84e-74c14b77458d 03/02/2023 15:09:26
5ac45ea2-f3b9-4061-814b-78ebe4bcb8ee 03/02/2023 17:35:25
99d1bf3d-e2e0-4bec-b2b3-820c0b87d212 06/10/2022 16:35:06
17172e28-0595-4ee5-b1e6-92ee8b680845 03/02/2023 14:14:23
2e959ad4-8b7d-45eb-9da2-96bad15898ae 03/02/2023 17:14:57
ef4e2533-cf8e-4642-9340-9f03157c12ef 03/02/2023 17:26:58
1de82121-d9f3-4741-b25a-a37f24b1f364 07/01/2023 14:48:19
686660f9-a3dc-4b31-bccf-a4c8b9c88190 03/02/2023 15:45:49
b74df8f7-7bef-4971-97d5-b915f6755255 21/01/2023 10:56:00
68284cbd-675d-4fcc-8654-bb954f2ff4ef 30/01/2023 11:27:09
06b0a7b5-8760-4957-a426-cc0f4ef6d851 03/02/2023 15:53:20
fb9041fe-b50d-450b-81aa-e1703983af86 30/01/2023 11:27:09
9a5f85b8-e2af-41eb-a75c-e3ee9cdf1e68 30/01/2023 11:27:09
f06f4e10-efac-4b3d-aa97-e7008e1c80a8 03/02/2023 15:56:31
-
- Veeam Software
- Posts: 2123
- Liked: 513 times
- Joined: Jun 28, 2016 12:12 pm
- Contact:
Re: veeam cmdlet or code to show job creation time
Hi @m@mog54, can you add JobType to your first output? My guess is that it's handled differently for different types of jobs.
David Domask | Product Management: Principal Analyst
Who is online
Users browsing this forum: No registered users and 8 guests