Forked from RamblingCookieMonster/Get-EnumValues.ps1
Last active
August 29, 2015 14:24
-
-
Save modulexcite/face148166ddb0f70fc6 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-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