vms.psm1
function GetSecondTuesday([int]$month, [int]$year) { # Calculate the first day of the month $firstDay = Get-Date -Year $year -Month $month -Day 1 # Calculate the day of the week for the first day of the month $firstDayOfWeek = $firstDay.DayOfWeek # Calculate the number of days until the first Tuesday of the month $daysUntilTuesday = [int][System.DayOfWeek]::Tuesday - $firstDayOfWeek if ($daysUntilTuesday -lt 0) {$daysUntilTuesday += 7} # Add 7 days to get the second Tuesday of the month $secondTuesday = $firstDay.AddDays($daysUntilTuesday + 7) # Return the day of the month for the second Tuesday return $secondTuesday } Export-ModuleMember -Function GetSecondTuesday |