Skip to content
Menu
The Lonely Administrator
  • PowerShell Tips & Tricks
  • Books & Training
  • Essential PowerShell Learning Resources
  • Privacy Policy
  • About Me
The Lonely Administrator

Discover Enums with Get-TypeMember

Posted on May 26, 2023May 26, 2023

Earlier this Spring, I released a new function called Get-TypeMember. The function is in the PSScriptTools module. I wrote about that release here. This command is an alternative to Get-Member that includes more details. The other day I pushed a new version that makes it easier to identify properties that are enumerations.

get enum properties

The function has a custom format file that highlights the enum properties. This feature will not work in the PowerShell ISE. Once you identify the property name and ResultType, you can drill down to that property.

DayOfWeek enumeration

The fields reveal the enum values. You can have some fun with this.

Get-TypeMember serviceprocess.servicecontroller -MemberType Property | Where IsEnum | Foreach { Get-TypeMember $_.PropertyType -membertype field}
service enums

I already have a few improvements in mind, but I'd love to hear what you think.

Share this:

  • Print (Opens in new window) Print

Like this:

Like Loading…

Related

2 thoughts on “Discover Enums with Get-TypeMember”

  1. ITLuke says:
    May 30, 2023 at 3:39 am

    So useful!
    Many thanks!

  2. Pingback: Enumeration Discovery in Powershell – Curated SQL

Comments are closed.

The PowerShell Practice Primer
Learn PowerShell in a Month of Lunches Fourth edition


Get More PowerShell Books

Other Online Content

github



PluralSightAuthor

Active Directory ADSI Automation Backup Books CIM CLI conferences console Friday Fun FridayFun Function functions Get-WMIObject GitHub hashtable HTML Hyper-V Iron Scripter ISE Measure-Object module modules MrRoboto new-object objects Out-Gridview Pipeline PowerShell PowerShell ISE Profile prompt Registry Regular Expressions remoting SAPIEN ScriptBlock Scripting Techmentor Training VBScript WMI WPF Write-Host xml

©2026 The Lonely Administrator | Powered by SuperbThemes!
%d