An object you receive to the output when you call $jobs.FindLastBackup() is of CBackup type. Inside this type a method to directly get DirPath is implemented:
Code: Select all
PS C:\WINDOWS\system32> job = Get-VBRJob
$backup = $job.FindLastBackup()
$backup.GetType()
$backup | Select-Object DirPath
$cbackup = [Veeam.Backup.Core.CBackup]
$cbackup.DeclaredProperties | where {$_.Name -eq 'DirPath'}
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True False CBackup System.Object
DirPath : BACKUP-TO-SOBR
MemberType : Property
Name : DirPath
DeclaringType : Veeam.Backup.Core.CBackup
ReflectedType : Veeam.Backup.Core.CBackup
MetadataToken : 385891610
Module : Veeam.Backup.Core.dll
PropertyType : Veeam.Backup.Common.CLegacyPath
Attributes : None
CanRead : True
CanWrite : False
GetMethod : Veeam.Backup.Common.CLegacyPath get_DirPath()
SetMethod :
IsSpecialName : False
CustomAttributes : {}
So, despite the fact that DirPath property inside CBackup type actually holds an object of CLegacyPath type, when returning $jobs.FindLastBackup() you see a precise name of the path.
Now, if we dive inside CLegacyPath type, we can see that the field for getting a DirPath name is implemented internally, while there is only isVbm property that is publicly available:
Code: Select all
PS C:\WINDOWS\system32> $path = [Veeam.Backup.Common.CLegacyPath]
$path.DeclaredFields | select Name, FieldType, ReflectedType -First 1 | fl
Name : _internal
FieldType : System.String
ReflectedType : Veeam.Backup.Common.CLegacyPath
PS C:\WINDOWS\system32> $path.DeclaredProperties | select Name, PropertyType, ReflectedType | fl
Name : Empty
PropertyType : Veeam.Backup.Common.CLegacyPath
ReflectedType : Veeam.Backup.Common.CLegacyPath
Name : IsVbm
PropertyType : System.Boolean
ReflectedType : Veeam.Backup.Common.CLegacyPath
Name : InternalComparer
PropertyType : System.Collections.Generic.IEqualityComparer`1[Veeam.Backup.Common.CLegacyPath]
ReflectedType : Veeam.Backup.Common.CLegacyPath
That's why you see an actual repository path name in CBackup object and still need to apply ToString() method when acting on CLegacyPath object.
Thanks!