Sorry all for the very silly question. Dont beat me up in here too badly all PS Experts PLEASE!!!
I am trying to find a good explanation of the -ExpandProperty parameter but as yet have yet to find one online. Can someone in here please explain the above-mentioned???
Basically, it takes whatever object(s) or value(s) that are in the targeted property and gives you that back, effectively removing one “layer” of the object.
If you use it in combination with the usual -Property parameter, then the properties specified by -Property from the original object are added to the object(s)/value(s) before they are given back.
(edit: all those responses while I was typing mine!)
i’ll rookie attempt to illustrate this with an example as I know it. the experts can beat me up, too.
say I do:
$thing = get-item c:\users | select name
$thing is now an object, with a property called “name”, that has a value of “users.”
<p style=“padding-left: 40px;”>Name
users</p>
if I want to use the string ‘users’ out of this later, I have to use “the value of the ‘name’ property of the $thing object,” aka $thing.name
but if instead I do:
$thing = get-item c:\users | select -expandproperty name
$thing is just the string “users” with no column headings, and I don’t have to call a property later, I can just use $thing.