How would I query backups for the existence of a server?

PowerShell script exchange

Re: How would I query backups for the existence of a server?

Veeam Logoby electricd7 » Tue May 05, 2015 1:39 pm

Anyone? Just trying to get these values into a string so I can input them into a database.
electricd7
Expert
 
Posts: 103
Liked: 5 times
Joined: Tue Mar 27, 2012 10:13 pm
Full Name: Chad Killion

Re: How would I query backups for the existence of a server?

Veeam Logoby v.Eremin » Wed May 06, 2015 2:16 pm

What if instead of using select, you will put just a dot into use:
Code: Select all
(Get-VBRRestorePoint -name "$VM" | sort creationtime -Descending | select -first 1).FindSourceJob().name


Otherwise, you can subtract the unnecessary information, working with substring method.

Thanks.
v.Eremin
Veeam Software
 
Posts: 13255
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: How would I query backups for the existence of a server?

Veeam Logoby electricd7 » Wed May 06, 2015 7:24 pm

Yea that worked. Thanks
electricd7
Expert
 
Posts: 103
Liked: 5 times
Joined: Tue Mar 27, 2012 10:13 pm
Full Name: Chad Killion

Re: How would I query backups for the existence of a server?

Veeam Logoby electricd7 » Thu May 07, 2015 12:45 pm

Almost have this just how I want it. It is still returning instances of copy jobs. I think I can eliminate those if I can just exclude any job who's name includes the word "Copy" in it as I have named all the copy jobs that way. The query I am currently using is:

(Get-VBRRestorePoint -name "$VM" | sort creationtime -Descending | select -first 1).FindSourceJob().name

So I just need one more entry where I can deslect anything in the -name field which has the word "Copy" in it.
electricd7
Expert
 
Posts: 103
Liked: 5 times
Joined: Tue Mar 27, 2012 10:13 pm
Full Name: Chad Killion

Re: How would I query backups for the existence of a server?

Veeam Logoby v.Eremin » Thu May 07, 2015 4:05 pm

You can put into use the example that I've shown you previously; the one using JobType parameter:

Code: Select all
(Get-VBRRestorePoint -name "VM Name" | where {$_.FindSourceJob().JobType -eq "Backup"} | sort creationtime -Descending | select -first 1).FindSourceJob().name


I'm currently out of the office, thus, typos and code inconsistencies are expected.

Thanks.
v.Eremin
Veeam Software
 
Posts: 13255
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Previous

Return to PowerShell



Who is online

Users browsing this forum: Bing [Bot] and 5 guests