If the end points are v2 you can still use the CIM cmdlets but you have to create a DCOM based CIMsession to the endpoint
if you are staying with wmi cmdlets looks like your code will be something like
(gwmi namespacegoeshere -ComputerName ‘test’).endtime | foreach { [System.Management.ManagementDateTimeConverter]::ToDateTime($_) }
depends what else your class is returning as to whether you need to do anything else