Passing enum values to a function in PowerShell
To avoid the error put the enum value in parenthesis:
PS > IsItFriday ([System.DayOfWeek]::Monday)
no
PS > IsItFriday ([System.DayOfWeek]::Friday)
yes
It's a little bit unexpected - you need to wrap it in parenthesis so that the value is evaluated:
> IsItFriday ([System.DayOfWeek]::Monday)
also it is possible to pass only strings like this:
> IsItFriday Monday
no
> IsItFriday Friday
yes
PowerShell will convert it to the enum type. Handy, isn't it :)