powershell - ExpandProperty not showing other properties with Select-Object? -


i having trouble -expand parameter of select-object cmdlet. understand file can select-object output expanded properties and other properties, doesn't seem working in case.

following example file, following works:

ps> get-process | select-object name -expand modules | fl name              : chrome modulename        : chrome.exe filename          : c:\program files (x86)\google\chrome\application\chrome.exe baseaddress       : 10682368 modulememorysize  : 868352 entrypointaddress : 10980160 fileversioninfo   : file:             c:\program files (x86)\google\chrome\application\chrome.exe                 internalname:     chrome_exe                 originalfilename: chrome.exe                 fileversion:      28.0.1500.72 ... 

trying same want doesn't work though:

ps> get-wmiobject win32_computersystem | select -property __class,__superclass,__dynasty -expand __derivation | fl cim_unitarycomputersystem cim_computersystem cim_system cim_logicalelement cim_managedsystemelement 

as can see contents of expanded property shown; else skipped.

here's output without expanding property:

ps> get-wmiobject win32_computersystem | select -property __class,__superclass,__dynasty,__derivation | fl   __class      : win32_computersystem __superclass : cim_unitarycomputersystem __dynasty    : cim_managedsystemelement __derivation : {cim_unitarycomputersystem, cim_computersystem, cim_system, cim_logicalelement...} 

any suggestions on doing wrong or why isn't working?

thanks, rakhesh

it's design. need custom properties. try this:

get-wmiobject win32_computersystem |  select __class,__superclass,__dynasty,@{n="__derivation";e={($_ | select -expa __derivation) -join ',' }}| fl * 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -