Skip to content

Instantly share code, notes, and snippets.

@RichieBzzzt
Created July 21, 2017 10:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RichieBzzzt/0200330502ebc8f1a0b90fc0520a5c67 to your computer and use it in GitHub Desktop.
Save RichieBzzzt/0200330502ebc8f1a0b90fc0520a5c67 to your computer and use it in GitHub Desktop.
Function Get-FrequencyIntervalValue {
[CmdletBinding()]
param
(
[string[]]
[ValidateNotNullorEmpty()]
$Freq
)
[int]$Value = 0
if (($Freq -contains "Sunday") -eq $True) {$Value = $Value + 1}
if (($Freq -contains "Monday") -eq $True) {$Value = $Value + 2}
if (($Freq -contains "Tuesday") -eq $True) {$Value = $Value + 4}
if (($Freq -contains "Wednesday") -eq $True) {$Value = $Value + 8}
if (($Freq -contains "Thursday") -eq $True) {$Value = $Value + 16}
if (($Freq -contains "Friday") -eq $True) {$Value = $Value + 32}
if (($Freq -contains "Saturday") -eq $True) {$Value = $Value + 64}
if (($Freq -contains "WeekEnds") -eq $True) {$Value = $Value + 65}
if (($Freq -contains "WeekDays") -eq $True) {$Value = $Value + 62}
if (($Freq -contains "EveryDay") -eq $True) {$Value = $Value + 127}
Return $Value
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment