Last active
February 24, 2016 09:01
-
-
Save Proxx/33755cfe3dec95e72b51 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Select-Properties { | |
Param( | |
[Parameter(ValueFromPipeline)] | |
$InputObject, | |
[Switch] $AsPSObject, | |
[Switch] $ReturnNames | |
) | |
if ($AsPSObject) | |
{ | |
$Properties = $InputObject.PSObject.Properties | Select-Object Name, Value | |
} | |
else | |
{ | |
$Properties = $InputObject | Get-Member -MemberType Properties | |
} | |
$Selection = $Properties | Out-Gridview -PassThru | Select-Object -ExpandProperty Name | |
if ($ReturnNames) { $Selection } | |
else { $InputObject | Select-Object -Property $Selection } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment