Last active
August 29, 2015 14:18
-
-
Save RamblingCookieMonster/3e01f840e4160136523d to your computer and use it in GitHub Desktop.
Get-EnumValues.ps1
This file contains 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-EnumValues { | |
<# | |
.SYNOPSIS | |
Return list of names and values for an enumeration object | |
.DESCRIPTION | |
Return list of names and values for an enumeration object | |
.PARAMETER Type | |
Pass in an actual type, or a string for the type name. | |
.EXAMPLE | |
Get-EnumValues system.dayofweek | |
.EXAMPLE | |
[System.DayOfWeek] | Get-EnumValues | |
.FUNCTIONALITY | |
General Command | |
#> | |
[cmdletbinding()] | |
param( | |
[parameter( Mandatory = $True, | |
ValueFromPipeline = $True, | |
ValueFromPipelineByPropertyName = $True)] | |
[Alias("FullName")] | |
$Type | |
) | |
Process | |
{ | |
[enum]::getvalues($type) | | |
Select @{name="Type"; expression={$Type.ToString()}}, | |
@{name="Name"; expression={$_.ToString()}}, | |
@{name="Value"; expression={$_.value__}} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment