I am having problems with TypeNames and TypeData. I'm pulling some CSV information in from a dos command, and trying to manipulate the resulting object to better suit my needs - namely by changing some property names and hiding some properties in the default view.
$obj=openfiles/sserver01 /query/FOCSV|ConvertFrom-Csv
$obj|Select-Object @{Name="Computername";Expression={"SERVER01"}},ID,@{Name="Username";Expression={$_."Accessed By"}},@{Name="Path";Expression={$_."Open File (Path\executable)"}}
$obj.pstypenames.Insert(0,'Computer.OpenFiles')
Update-TypeData-TypeNameComputer.OpenFiles-DefaultDisplayPropertySetID,Username,Path-Force
However, this doesn't work - $obj still gives me all the properties by default. Further, if I enter "$obj | get-member", it tells me that me that my TypeName is "TypeName: System.Management.Automation.PSCustomObject" - yet if I enter "$obj.PSTypeNames", "Computer.OpenFiles" shows up at the top of the list as expected.
What am I doing wrong here?
Thanks,
Eric