Dump enumerations

by Apr 26, 2011

You can create a simple helper function called Get-Enum  to list all the values in an enumeration:

function Get-Enum($name){
    [Enum]::GetValues($name) | Select-Object @{n="Name"={$_}},@{n="Value"={$_.value__}} |
    format-table -autosize
}

 

This will allow you to easily list all the values in any enumeration:

Get-Enum IO.FileAttributes

 

 

Twitter This Tip!
ReTweet this Tip!