Title: `ConvertTo-Json` neglects to serialize ETS properties when passed output from CDXML cmdlets (CIM instances) that isn't `[psobject]` wrapped by argument · Issue #24554 · PowerShell/PowerShell · GitHub
Open Graph Title: `ConvertTo-Json` neglects to serialize ETS properties when passed output from CDXML cmdlets (CIM instances) that isn't `[psobject]` wrapped by argument · Issue #24554 · PowerShell/PowerShell
X Title: `ConvertTo-Json` neglects to serialize ETS properties when passed output from CDXML cmdlets (CIM instances) that isn't `[psobject]` wrapped by argument · Issue #24554 · PowerShell/PowerShell
Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerShell 5.1 and PowerShell. Steps to reprodu...
Open Graph Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...
X Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/24554
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`ConvertTo-Json` neglects to serialize ETS properties when passed output from CDXML cmdlets (CIM instances) that isn't `[psobject]` wrapped by argument","articleBody":"### Prerequisites\r\n\r\n- [X] Write a descriptive title.\r\n- [X] Make sure you are able to repro it on the [latest released version](https://github.com/PowerShell/PowerShell/releases)\r\n- [X] Search the existing issues.\r\n- [X] Refer to the [FAQ](https://github.com/PowerShell/PowerShell/blob/master/docs/FAQ.md).\r\n- [X] Refer to [Differences between Windows PowerShell 5.1 and PowerShell](https://learn.microsoft.com/powershell/scripting/whats-new/differences-from-windows-powershell).\r\n\r\n### Steps to reproduce\r\n\r\nNote:\r\n\r\n* This is yet another manifestation of https://github.com/PowerShell/PowerShell/issues/5579\r\n\r\n* Note that the problem only arises for CDXML cmdlets that do not themselves wrap their output objects in `[psobject]`, such as `Get-PhysicalDisk`, `Get-VirtualDisk`, and `Get-Volume`; others, such as `Get-Disk`, _do_ perform this wrapping.\r\n\r\n```powershell\r\n# Note: Since objects passing through the pipeline are automatically [psobject]-wrapped, the following\r\n# pipeline alternative works correctly: \r\n# Get-PhysicalDisk | ConvertTo-Json 3\u003e$null | ConvertFrom-Json | Format-List\r\nConvertTo-Json (Get-PhysicalDisk) 3\u003e$null | ConvertFrom-Json | Format-List\r\n```\r\n\r\n### Expected behavior\r\n\r\n```none\r\nCimClass : @{CimSuperClassName=MSFT_StorageFaultDomain; CimSuperClass=; CimClassProperties=System.Object[]; CimClassQualifiers=System.Object[];\r\n CimClassMethods=System.Object[]; CimSystemProperties=}\r\nCimInstanceProperties : {@{Name=ObjectId; Value={1}\\\\MKW11\\root/Microsoft/Windows/Storage/Providers_v2\\SPACES_PhysicalDisk.ObjectId=\"{47519af7-9162-11ee-9dc0-806e6f6e6963\r\n }:PD:{f2881886-c54b-46f7-c1ac-8eb641e316de}\"; CimType=14; Flags=35688452; IsValueModified=False}, @{Name=PassThroughClass; Value=; CimType=14;\r\n Flags=572522500; IsValueModified=False}, @{Name=PassThroughIds; Value=; CimType=14; Flags=572522500; IsValueModified=False},\r\n @{Name=PassThroughNamespace; Value=; CimType=14; Flags=572522500; IsValueModified=False}…}\r\nCimSystemProperties : @{Namespace=root/microsoft/windows/storage; ServerName=MKW11; ClassName=MSFT_PhysicalDisk; Path=}\r\nClassName : MSFT_PhysicalDisk\r\nUsage : Auto-Select\r\nOperationalStatus : OK\r\n# ... remaining properties omitted for brevity.\r\n```\r\n\r\n\r\n### Actual behavior\r\n\r\n```none\r\nCimClass : @{CimSuperClassName=MSFT_StorageFaultDomain; CimSuperClass=; CimClassProperties=System.Object[]; CimClassQualifiers=System.Object[];\r\n CimClassMethods=System.Object[]; CimSystemProperties=}\r\nCimInstanceProperties : {@{Name=ObjectId; Value={1}\\\\MKW11\\root/Microsoft/Windows/Storage/Providers_v2\\SPACES_PhysicalDisk.ObjectId=\"{47519af7-9162-11ee-9dc0-806e6f6e6963}:PD:{f2881\r\n 886-c54b-46f7-c1ac-8eb641e316de}\"; CimType=14; Flags=35688452; IsValueModified=False}, @{Name=PassThroughClass; Value=; CimType=14; Flags=572522500;\r\n IsValueModified=False}, @{Name=PassThroughIds; Value=; CimType=14; Flags=572522500; IsValueModified=False}, @{Name=PassThroughNamespace; Value=; CimType=14;\r\n Flags=572522500; IsValueModified=False}…}\r\nCimSystemProperties : @{Namespace=root/microsoft/windows/storage; ServerName=MKW11; ClassName=MSFT_PhysicalDisk; Path=}\r\n```\r\n\r\nThat is, only the type-native properties were serialized, not also the ETS (adapted) ones.\r\n\r\n### Error details\r\n\r\n_No response_\r\n\r\n### Environment data\r\n\r\n```powershell\r\nPowerShell 7.5.0-preview.5 on Windows (also affects Windows PowerShell)\r\n```\r\n\r\n\r\n### Visuals\r\n\r\n_No response_","author":{"url":"https://github.com/mklement0","@type":"Person","name":"mklement0"},"datePublished":"2024-11-06T22:27:23.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/24554/PowerShell/issues/24554"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:bdf49cc8-da2c-0176-5f4c-41b62986876f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E314:2C555C:28F1BF:35E928:6A5B831B |
| html-safe-nonce | 7e865015696d6f06fecb1289e5e8fbd4bd013841e7719cb13dba2fbf1fd19d8e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMzE0OjJDNTU1QzoyOEYxQkY6MzVFOTI4OjZBNUI4MzFCIiwidmlzaXRvcl9pZCI6IjUxNTA3MjE0MjgyMjUyMjk1OTUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | f762d2d53f9d5aa9d15d784f75a037e299ffe684ab36bc1188f8fa139c5bb6d9 |
| hovercard-subject-tag | issue:2639374228 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/24554/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d44446716372ca6eb49d93e7c5468a601656ac4a6078cad093e091b35ce3d7fb/PowerShell/PowerShell/issues/24554 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d44446716372ca6eb49d93e7c5468a601656ac4a6078cad093e091b35ce3d7fb/PowerShell/PowerShell/issues/24554 |
| og:image:alt | Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mklement0 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9c975978430e9ad293956f2bbdaf153b1bd84a99 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width