Forum Discussion

SBVRaja's avatar
SBVRaja
Tin Contributor
Aug 04, 2021

Alternative to invoke-expression

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

  • SBVRaja's avatar
    SBVRaja
    Tin Contributor
    If the expression is a script cmdlet & $variable format might have worked. But in this case, it is not working.