Select syntax for Powershell hash table and array

I have an array that also has a hash table in it.  Below is one item from the array -

name           : user@domain.com
settings       : @{attachControlPanel=ON; autoAotf=OFF; blockBulkEmails=OFF; filter=; language=ENGLISH; outboundNote=; outlookFormatting=ON; securityEnforcement=REJECT_QUAR; securityStatus=OFF;
                 securityType=FILTER; spoofingPrevention=OFF; vaporizeSendersOnBL=VAPORIZE; spamShredderScore=100}
services       : {}

Open in new window


I'm trying to get only the following fields -

name
securitystatus from settings hash table
services

I can get the name, full settings, and services by the following code -

$output | select name, settings, services

Open in new window


And I can get just the securitystatus by this code -

$output | select -expandproperty settings | select securitystatus

Open in new window


What I don't know how to do is to merge them together.  Thanks,
LVL 9
diperspAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

footechCommented:
Give this a shot.
$output | select name, @{n="securitystatus";e={$_.settings | select -expand securitystatus}}, services

Open in new window


I'm a little confused by your first output - it doesn't look like how a hashtable would appear.  You might try running the following and posting back
$output | gm

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
diperspAuthor Commented:
Well, that did it!

Here's the output you asked for.  This is all new to me, so. . .  Is it not a hash table?

Name           MemberType   Definition
----           ----------   ----------
Equals         Method       bool Equals(System.Object obj)
GetHashCode    Method       int GetHashCode()
GetType        Method       type GetType()
ToString       Method       string ToString()
name           NoteProperty System.String name=user@domain.com
services       NoteProperty System.Object[] services=System.Object[]
settings       NoteProperty Selected.System.Management.Automation.PSCustomObject settings=@{attachControlPanel=ON; autoAotf=OFF; blockBulkEmails=OFF; filter=; language=ENGLISH; outboundNote=; outl...
footechCommented:
No, it's not.  The "settings" property is another object, which itself has properties.
To see it in another light.
$output.settings | gm

Open in new window


If it actually was a hashtable, the syntax used to get securitystatus above would be different.
diperspAuthor Commented:
Worked perfect first shot.  Thanks for the education as well!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.