-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
Resolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility modulecmdlets in the Microsoft.PowerShell.Utility module
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 reproduce
I am attempting to add a NoteProperty to a reference type property of an object, then convert that entire object to JSON using the ConvertTo-Json cmdlet. While this works fine when adding a NoteProperty to a top level object, if you do this to an object that's a property of the top-level object, the NoteProperty is not handled by the cmdlet:
`$foo = Get-ADUser "someUser"
$foo.SID | Add-Member -MemberType NoteProperty -Name "bar" -Value "barValue" -Force
$foo | ConvertTo-Json`
Expected behavior
Cmdlet should output:
{
...
"SID": {
"BinaryLength": 28,
"AccountDomainSid": {
"BinaryLength": 24,
"AccountDomainSid": [redacted],
"Value": [redacted]
},
"Value": [redacted],
"bar": "barValue"
},
...
}Actual behavior
Output does not include additional property:
{
...
"SID": {
"BinaryLength": 28,
"AccountDomainSid": {
"BinaryLength": 24,
"AccountDomainSid": [redacted],
"Value": [redacted]
},
"Value": [redacted]
},
...
}Error details
No response
Environment data
Name Value
---- -----
PSVersion 7.3.2
PSEdition Core
GitCommitId 7.3.2
OS Microsoft Windows 10.0.19044
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0Visuals
No response
Metadata
Metadata
Assignees
Labels
Resolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility modulecmdlets in the Microsoft.PowerShell.Utility module