Add sub-property of property to PSObject in PowerShell
<p>I'm using PowerShell to get JSON content that is returned back as a PSObject so that when I want to call a property's value in the object, I can get the value by calling the variable like:</p>

<pre><code>$endpoint.authorization
</code></pre>

<p>But I would like to add a new property inside of the existing authorization property to end up looking like:</p>

<pre><code>$endpoint.authorization.parameters.username
</code></pre>

<p>I have figured out that I can pipe the variable with the Select and Add-Member cmdlets but it doesn't look like it does anything when I call the original variable again. Here's what my code looks like: </p>

<pre><code>$endpoint | Select -Property "authorization" | Add-Member -NotePropertyName "parameters.username" -NotePropertyValue "test" 
</code></pre>

<p>And nothing seems to change in the endpoint variable when I check it after that line of code. There must be something simple that I'm missing, but any ideas on how I can add a new property as a sub-property of an existing one? </p>