Well, I’m back in the warmth of Phoenix. We had a lot of great questions from our PowerShell class in Toronto last week. While we were discussion .NET, a question popped up about finding the index number of a value of an enumeration. Sure, no problem. Function Get-EnumIndex { Param ( [ parameter (Mandatory= $true )] $Enum , [ parameter (Mandatory= $true )] [ String ] $Value ) [ enum ]::GetValues( $Enum )| foreach { [ PSCustomObject ]@{ValueName = $_ ; IntValue = [ int ] $_ } } | Where ValueName -eq $Value <# .SYNOPSIS Searches and enumeration for the index number of the provided value. .DESCRIPTION Searches and enumeration for the index number of the provided value. .PARAMETER Enum The enu...
Welcome to the blogsite of MCTExpert. I am a Microsoft Certified Trainer. Here you will find the real questions that are asked to me by my students.