August 16, 2017 at 11:02 am
How can I specify a list of values for an advanced function?
For example, I want to write a function with a parameter called $ReportingPeriod. I only want to allow 5 selections to be allowed.
More to the point, I'd like them to be selectable in a drop-down in the call. Something similar to what you see when you type
add-content -encoding
when you hit the space after "-encoding", a list of possible selections is displayed
August 16, 2017 at 11:45 am
Don't know why this was SO hard to find...
FYI: I understand there is an Enum function? command? in PoSh V5.
Add-Type -TypeDefinition @"
// very simple enum type
public enum ReportingPeriods
{
All,
Yesterday,
CurrentWeek,
PreviousWeek,
MonthToDate,
LastMonth,
YearToDate
}
"@
[ReportingPeriods]::
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy