Sorry to jump in, but
@kpolsana, I think some of your challenges with the date items are due to ConvertTo-JSON's handling of DateTime objects pre-Powershell 7:
https://learn.microsoft.com/en-us/power ... rshell-7.3
As of PowerShell 7.2, Extended Type System properties of DateTime and String objects are no longer serialized and only the simple object is converted to JSON format
For example, on Powershell 5, running the examples from Microsoft's article don't produce the same output as the article, and I'm assuming that it's due to the improvements in Powershell 7
For your test with the JobObject, it's because the property name is ApproxSizeString, not ApproxSize:
Code: Select all
PS C:\Users\Administrator> Get-VBRJobObject -Job "linux-backup" | select Name, ApproxSizeString |ConvertTo-JSON
{
"Name": "ddom-debian-backmeup",
"ApproxSizeString": "16 GB"
}
So for DateTime objects, you're going to want to probably write some function to build a PSCustomObject from the desired data, and then pass that to ConvertTo-JSON, for the others, check that you're calling the correct properties and what type the data is.