Things I have tried so far:
- Try to verify, that the
TypeNameinps1xmlmatches with the custom class, and that the overall syntax of the XML file is correct (I assume,Update-FormatDatawould throw an error if there was an error here?) - Check with
Get-FormatData, that the imported format data is available in the current session (that does not appear to be the case, see attached screenshot)
More context: Battery is a custom class that's returned from a Get-Battery Cmdlet:
[NoRunspaceAffinity()]
class Battery {
[int] $ChargeRemaining
[timespan] $Runtime
[bool] $IsCharging
[string] $Status
Battery([int] $ChargeRemaining, [timespan] $Runtime, [bool] $IsCharging, [string] $Status) {
$this.ChargeRemaining = $ChargeRemaining
$this.Runtime = $Runtime
$this.IsCharging = $IsCharging
$this.Status = $Status
}
}
I am following this Guide here
for exporting classes which seems to be working great, except that FormatsToProcess is also failing silently here, meaning that the verbose output message indicates that the format data was updated, yet it not applied on the object if returned from a Cmdlet.
Any ideas what else could be the issue here?