PowerShell script exchange
Post Reply
normunds
Novice
Posts: 5
Liked: never
Joined: Nov 26, 2014 12:54 pm
Full Name: Normunds
Contact:

Get Job backup Target directory

Post by normunds »

Hi!

Veeam B&R version 9.5.0.711
Command

Code: Select all

(Get-VBRJob -Name $jobname).TargetDir
does not return "D:\FolderName" anymore. I get only

Code: Select all

  IsVbm
  -----
  False
Is this a bug or something is not correct with my local powershell? I think this issue is after B&R 9.5 upgrade.
Any suggestions?
tdewin
Veeam Software
Posts: 1775
Liked: 646 times
Joined: Mar 02, 2012 1:40 pm
Full Name: Timothy Dewin
Contact:

Re: Get Job backup Target directory

Post by tdewin » 1 person likes this post

Might consider

Code: Select all

$job = (Get-VBRJob -Name $jobname)
$job.GetTargetRepository()
normunds
Novice
Posts: 5
Liked: never
Joined: Nov 26, 2014 12:54 pm
Full Name: Normunds
Contact:

Re: Get Job backup Target directory

Post by normunds »

tdewin wrote:Might consider

Code: Select all

$job = (Get-VBRJob -Name $jobname)
$job.GetTargetRepository()
Thank you! I got correct result with:

Code: Select all

($job.GetTargetRepository()).FriendlyPath
But same issue with:

Code: Select all

($job.GetTargetRepository()).Path
Based on my previous powershell experience, this command doesn't work as expected

Code: Select all

($job.GetTargetRepository()).Path
veremin
Product Manager
Posts: 20284
Liked: 2258 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Get Job backup Target directory

Post by veremin »

Not sure what's wrong in your case. For me both parameters (.Path, .FriendlyPath) work flawlessly. Anyway, glad to hear you've found the way to achieve your goal.
final
Enthusiast
Posts: 33
Liked: 13 times
Joined: Aug 14, 2016 7:19 pm
Contact:

Re: Get Job backup Target directory

Post by final »

Just stumbled over this issue. The TargetDir-Property is not a string (Get-VBRJob -Name $jobname | select TargetDir might suggest); it's an object of Type CLegacyPath that has only one Property IsVbm. What you're probably interested in is it's ToString() Method.

So, what you probably want is (Get-VBRJob -Name $jobname).TargetDir.ToString()
Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests