I am trying to make a variable equal the output of query but so i can pipe to another command but its not working as i hoped. here is what i have.
$office=get-aduser "samaccountname" -properties * | select office
I already tried using sub-expressions $folder= get-aduser "samaccountname" -properties * | select '$(office)' and @{n='office';e={$_.office -replace '^office='$1'}} neither of which remove the @{office=} My goal is to get $office=office but instead i get $office=@{office=}
How do you remove the @{} from the output?