Something like get-variable for array elements

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
jvierra
Posts: 14691
Joined: Tue May 22, 2007 9:57 am
Answers: 7
Has voted: 2 times
Been upvoted: 5 times

Re: Something like get-variable for array elements

Post by jvierra »

The last post show how to get an object and output the value of a property of the object. That is what "to read the value of an item inside a PSObject" means when speaking about compouters, objects and programming.

jvierra
Posts: 14691
Joined: Tue May 22, 2007 9:57 am
Answers: 7
Has voted: 2 times
Been upvoted: 5 times

Re: Something like get-variable for array elements

Post by jvierra »

I want to use a value stored on a variable to form the name of the object to retrieve.
Objects do not have names. Objects have properties. Properties have values which are other objects.

Part of what is getting in your way is that you do not understand PowerShell or objects. If you take time to read the free book I posted this will become clear.

User avatar
drpiet
Posts: 22
Joined: Fri Jun 09, 2017 6:46 am

Re: Something like get-variable for array elements

Post by drpiet »

Thank you
I guess.

User avatar
Jesssmart
Posts: 2
Joined: Tue Jun 16, 2015 3:10 am

Re: Something like get-variable for array elements

Post by Jesssmart »

It worked out for me!

User avatar
drpiet
Posts: 22
Joined: Fri Jun 09, 2017 6:46 am

Re: Something like get-variable for array elements

Post by drpiet »

I'm glad to read it.
I know isn't something that we might use a lot, but on my specific case, I didn't finish yet replacing things, but it will save me a few hundreds lines of code. :D

Locked