The data you provided is an unorganized string. It's no YAML, or JSON. It's just a comma separated series of Name/Value pairs. If the data are separated into individual components (assuming "ServiceName" to be the beginning of each set), you could try this:
$data = "ServiceName: CcmExec, Status: Not Installed",
"ServiceName: IntuneManagementExtension, DisplayName: Microsoft Intune Management Extension, Status: Running, CanPauseAndContinue: False, CanShutdown: True, CanStop: True, ServiceType: Win32OwnProcess",
"ServiceName: Nexthink Service, DisplayName: Nexthink Collector Service, Status: Running, CanPauseAndContinue: False, CanShutdown: True, CanStop: True, ServiceType: Win32OwnProcess",
"ServiceName: Nanoheal Client, Status: Not Installed",
"ServiceName: CcmExec, Status: Not Installed",
"ServiceName: IntuneManagementExtension, DisplayName: Microsoft Intune Management Extension, Status: Running, CanPauseAndContinue: False, CanShutdown: True, CanStop: True, ServiceType: Win32OwnProcess",
"ServiceName: Nexthink Service, DisplayName: Nexthink Collector Service, Status: Running, CanPauseAndContinue: False, CanShutdown: True, CanStop: True, ServiceType: Win32OwnProcess",
"ServiceName: Nanoheal Client, Status: Not Installed"
# get all possible property names from the data
$template = @{}
$data -split "," |
ForEach-Object {
[array]$NameValue = $_ -split ":"
$template[$NameValue[0].Trim()] = ""
}
$data |
ForEach-Object {
$props = $template.Clone() # get a set of property names without values
$_ -split "," |
ForEach-Object{
[array]$NameValue = $_ -split ":"
$props.($NameValue[0].Trim()) = $NameValue[1].Trim()
}
[PSCustomObject]$props
}