Powershell Select-Object and Alter Property Names when modifying values -


i have cmdlet get-aduser piping select object , in select running function on accountexpires property convert property value date value.

my question when object output column heading no longer friendly , inherits function used return new value. how form statement friendly name output? hoping not have assemble own psobject.

get-aduser "some.account" -properties accountexpires | select enabled, name, $({[datetime]$d =$_.accountexpires; convertto-date($d)}) 

i resulting table header of...

enabled       true       [datetime]$d =$_.accountexpires; convertto-date($d) -------       -----      ---------------------------------------------------- 

use expression hashtable of @{e={scriptblock};l="label"}.

select enabled, name, @{e={$({[datetime]$d =$_.accountexpires; convertto-date($d)})};l="accountexpires"}

see http://technet.microsoft.com/en-us/library/ee692794.aspx more information on creating custom selected objects.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -