Created
May 9, 2018 15:44
-
-
Save HerbM/00cb281bc7c992e3ad722edfa5ee0895 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 Get-Property { | |
[CmdletBinding()]param( | |
[Parameter(ValueFromPipeline)][psobject]$object, | |
[switch]$AsHash | |
) | |
Process { | |
If ($AsHash) { | |
$Property = [ordered]@{} | |
$Object.psobject.get_properties() | ForEach-Object { | |
$Property += @{ $_.Name = $_.Value } | |
} | |
$Property | |
} else { | |
$Object.psobject.get_properties() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment