Quantcast
Channel: R&D Forums
Viewing all articles
Browse latest Browse all 5351

PowerShell • Re: Strange behaviour of "get-vbrbackup" items when Property is not converted to string

$
0
0
Hi Stephan,

Yes, it's expected behavior; I forget the specifics on this, but in short DirPath itself is _not_ a string value, it's a CLegacyPath object:

Code:

PS C:\Users\david.LAB> $backup.DirPath|gm   TypeName: Veeam.Backup.Common.CLegacyPathName                    MemberType Definition----                    ---------- ----------AddDelimiterIfNeeded    Method     Veeam.Backup.Common.CLegacyPath AddDelimiterIfNeeded(string delimiter)CompareTo               Method     int CompareTo(Veeam.Backup.Common.CLegacyPath other), int IComparable[CLegacyPath...Equals                  Method     bool Equals(Veeam.Backup.Common.CLegacyPath other), bool Equals(System.Object obj...FilterInvalidCharacters Method     Veeam.Backup.Common.CLegacyPath FilterInvalidCharacters(Veeam.Backup.Common.EPath...GetHashCode             Method     int GetHashCode()GetObjectData           Method     void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Ru...GetSchema               Method     System.Xml.Schema.XmlSchema GetSchema(), System.Xml.Schema.XmlSchema IXmlSerializ...GetType                 Method     type GetType()ReadXml                 Method     void ReadXml(System.Xml.XmlReader reader), void IXmlSerializable.ReadXml(System.X...ToString                Method     string ToString(), string ToString(System.IFormatProvider formatProvider)Trim                    Method     Veeam.Backup.Common.CLegacyPath Trim()TrimDelimiter           Method     Veeam.Backup.Common.CLegacyPath TrimDelimiter(char delimiter)WriteXml                Method     void WriteXml(System.Xml.XmlWriter writer), void IXmlSerializable.WriteXml(System...IsVbm                   Property   bool IsVbm {get;}PS C:\Users\david.LAB> $backup.DirPath.ToString()E:\Repo1\dd-malware-box-backup
As you can see, it's not just a string object, this is special object returned, and when you call ToString() and call the property by passing it to Select-Object, there is some work being done outside of the object to return the path you see.

In short, just call it with $backup.DirPath.ToString() to get the VBM folder path, which will reflect the job folder name you'd see on the repository.

Statistics: Posted by david.domask — Jul 16, 2024 11:52 am



Viewing all articles
Browse latest Browse all 5351

Latest Images

Trending Articles



Latest Images