When working in an interactive console, if I define a new object and assign it some property values ββas follows:
$obj = New-Object System.String $obj | Add-Member NoteProperty SomeProperty "Test"
Then, when I enter the name of my variable in an interactive window, Powershell gives me a summary of the object's properties and values:
PS C:\demo> $obj SomeProperty ------------ Test
Basically I want to do just that, but from inside a function in a script. The function creates an object and sets some property values, and I want it to print a summary of the values ββof the objects in the Powershell before returning. I tried using Write-Host inside the function:
Write-Host $obj
But this just infers the type of the object, not the summary:
System.Object
How can I get my function to display a summary of the properties of an object in a Powershell window?
powershell
John Apr 03 '13 at 16:17 2013-04-03 16:17
source share