Using SMLets Beta 3 Post #8–Getting the GUID of an Enumeration

Let’s say you want to get the GUID of an enumeration.  You could query the database EnumType table for it by following instructions in this blog post or you could use SMLets.

Here is how you do it using SMLets:

Hopefully you already know the non-GUID ID (also referred to as Name) of the enumeration.  If you do then you can get the enumeration like this:

Get-SCSMEnumeration –Name System.WorkItem.TroubleTicket.UrgencyEnum.Medium

image

Let’s say you don’t know the name though and you only know part of the name – you could do this:

Get-SCSMEnumeration –Name Medium

image

That can help you find the name.

Another option is to get all the Enumerations and then filter through them looking for a particular display name:

Get-SCSMEnumeration | ?{$_.DisplayName –eq “Medium”}

image

Now all you need to do is pipe the output of one of these commands to the Format-Table cmdlet:

Get-SCSMEnumeration –Name System.WorkItem.TroubleTicket.UrgencyEnum.Medium | Format-Table Name, ID

image

This same general approach would work for other types of MP elements like views, tasks, console tasks, rules, etc.