powershell v3.0 - Display regular property and expanded property at the same time -


i need display 2 properties: 1 called displayname , second hostname (under mastercoreinfo property).

the script working, i'm trying combine in same result , 1 line command. far bad.

powershell -command "get-replicatedservers -core localhost:8006 | select displayname | format-list"  outputs: displayname : server2 displayname : server3  powershell -command "get-replicatedservers -core localhost:8006 | select -expand mastercoreinfo | select hostname | format-list"  outputs: hostname : remote3 hostname : remote4 

all i'm trying combine 2 results, hostname , displayname in same list corresponding each server. please help.

although documentation doesn't state it, appears -property , -expandproperty parameters select-object mutually exclusive, -expandproperty taking precedence.

you'll need either change output of get-replicatedservers, or process 2 properties separately, compiling them custom psobject contains data want. this, pipe output of get-replicatedservers foreach-object block , work on them there.


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -