How to refer an object value with the same notation of the another object?

Just for illustration…

$obj1 = [PSCustomObject]@{
    Prop1 = '<string>'
    Prop2 = [PSCustomObject]@{
        Sub1 = '<string>'
        Sub2 = '<string>'
    }
    Prop3 = '<int>'
    Prop4 = [PSCustomObject]@{
        Sub1 = '<int>'
        Sub2 = '<string>'
    }
}

$obj1

Prop1 : <string>
Prop2 : @{Sub1=<string>; Sub2=<string>}
Prop3 : <int>
Prop4 : @{Sub1=<int>; Sub2=<string>}


$obj2 = [PSCustomObject]@{
    Prop1 = 'Value1'
    Prop2 = [PSCustomObject]@{
        Sub1 = 'SubValue1'
        Sub2 = 'SubValue2'
        Sub3 = 'SubValue3'
        Sub4 = 'SubValue4'
        Sub5 = 'SubValue5'
    }
    Prop3 = '111'
    Prop4 = [PSCustomObject]@{
        Sub1 = '222'
        Sub2 = 'SubValue2'
        Sub3 = 'SubValue3'
        Sub4 = '444'
    }
    Prop5 = 'Value5'
}

$obj2

Prop1 : Value1
Prop2 : @{Sub1=SubValue1; Sub2=SubValue2; Sub3=SubValue3; Sub4=SubValue4; Sub5=SubValue5}
Prop3 : 111
Prop4 : @{Sub1=222; Sub2=SubValue2; Sub3=SubValue3; Sub4=444}
Prop5 : Value5

Any idea, how can I get the values from $obj2 to an extent where the properties are available only in $obj1??

Thank you,

Kiran.

It worked for me like this…

$Global:ARMObject = New-Object -TypeName pscustomobject
Function Convert-ARMObject
{
    param
    (
        [pscustomobject] $RefObject, # Referance Template
        [pscustomobject] $WorkObject  # Working Template
    )

    $Properties = $WorkObject | Get-Member -MemberType *Properties

    foreach ($Property in $Properties)
    {
        if ($RefObject.$($Property.Name))
        {
            if ($WorkObject.$($Property.Name).GetType().Name -eq 'pscustomobject')
            {
                Convert-ARMObject -RefObject $RefObject.$($Property.Name) -WorkObject $WorkObject.$($Property.Name)
            }
            else
            {
                $Global:ARMObject | Add-Member -MemberType NoteProperty -Name $RefObject.$($Property.Name) -Value $WorkObject.$($Property.Name)
            }
        }
    }
}

Convert-ARMObject -RefObject $RefObj -WorkObject $SAObj

Thanks, @kvprasoon!