Alternative to invoke-expression

%3CLINGO-SUB%20id%3D%22lingo-sub-2612561%22%20slang%3D%22en-US%22%3EAlternative%20to%20invoke-expression%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2612561%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20looking%20for%20alternate%20way%20to%20extract%20the%20value%20of%20the%20below%20powershell%20object%20without%20using%20invoke-expression%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Einvoke-expression%20%22%60%24abc.properties.%24subprop%22%3C%2FP%3E%3CP%3Eor%3C%2FP%3E%3CP%3Einvoke-expression%20%22%60%24abc.%24subprop1%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhere%3C%2FP%3E%3CP%3E%24abc%20is%20a%20powershell%20object%20in%20JSON%20format%3C%2FP%3E%3CP%3E%24subprop%20is%20having%20one%20of%20the%20Noteproperties%20of%20'%24abc.properties'%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2612561%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EPowerShell%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPowerShell%20CMDLETS%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPowerShell%20Commands%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Epowershell%20script%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Epowershell%20script%20resource%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2612580%22%20slang%3D%22en-US%22%3ERe%3A%20Alternative%20to%20invoke-expression%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2612580%22%20slang%3D%22en-US%22%3EIf%20the%20expression%20is%20a%20script%20cmdlet%20%26amp%3B%20%24variable%20format%20might%20have%20worked.%20But%20in%20this%20case%2C%20it%20is%20not%20working.%3C%2FLINGO-BODY%3E
Occasional Contributor

I am looking for alternate way to extract the value of the below powershell object without using invoke-expression

 

invoke-expression "`$abc.properties.$subprop"

or

invoke-expression "`$abc.$subprop1"

 

Where

$abc is a powershell object in JSON format

$subprop is having one of the Noteproperties of '$abc.properties'

 

1 Reply
If the expression is a script cmdlet & $variable format might have worked. But in this case, it is not working.