powershell - Adding New Column to Select-Object -ExpandProperty -


i'm working azure ad , i'm getting list of services , status specific license i'm having trouble trying desired output.

the basic command i'm using this:

((get-msoluser -userprincipalname $upn).licenses).where{ $_.accountskuid -like $skuid } | select-object -expandproperty servicestatus 

that produces output similar this

serviceplan           provisioningstatus -----------           ------------------ teams1                disabled projectworkmanagement disabled sway                  disabled intune_o365           pendingactivation yammer_enterprise     disabled rms_s_enterprise      disabled officesubscription    success mcostandard           disabled sharepointwac         success sharepointenterprise  success exchange_s_enterprise success 

this fine when 1 user passed function code in when more users passed in rather , printing distinct set of output each user prints items again (minus heading) in 1 giant list.

ideally i'm looking add column output, i'm not having success it. i've tried using calculated properties such as:

 ((get-msoluser -userprincipalname $upn).licenses).where{ $_.accountskuid -like $skuid } | select-object @{n='name';e={$upn}},@{n='serviceplan';e={$_.servicestatus.serviceplan.servicename}},@{n='provisioningstatus';e={$_.servicestatus.provisioningstatus}} 

this kind of worked rather nice table added column had upn rolled name, serviceplan , provisioning object values noteproperties , when it's displayed looks this

name             serviceplan                                           provisioningstatus ----             -----------                                           ------------------ user1@domain.com {teams1, projectworkmanagement, sway, intune_o365...} {disabled, disabled, disabled, pendingactivation...} user2@domain.com {teams1, projectworkmanagement, sway, intune_o365...} {pendingprovisioning, disabled, disabled, pendingactivation...} 

that useful i'm kind of lost @ point of how possibly information this

name  serviceplan           provisioningstatus ----  -----------           ------------------ user1 teams1                disabled user1 projectworkmanagement disabled user1 sway                  disabled user1 ........................................  user2 teams1                disabled user2 projectworkmanagement disabled user2 sway                  disabled user2 ........................................ 

or alternatively like

user1 serviceplan           provisioningstatus -----------           ------------------ teams1                disabled projectworkmanagement disabled sway                  disabled ........................................  user2 serviceplan           provisioningstatus -----------           ------------------ teams1                disabled projectworkmanagement disabled sway                  disabled ........................................ 

thanks reading long question , responses.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -