forked from mikefrobbins/PowerShell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Get-MSPSUGMeetingDate.ps1
59 lines (58 loc) · 1.67 KB
/
Get-MSPSUGMeetingDate.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#Requires -Version 3.0
function Get-MSPSUGMeetingDate {
<#
.SYNOPSIS
Returns the meeting dates for the Mississippi PowerShell User Group.
.DESCRIPTION
Get-MSPSUGMeetingDate is a function that returns the dates when
the Mississippi PowerShell User Group meetings are held.
.PARAMETER Month
The month to return the meeting dates for. The default is all months.
.PARAMETER Year
The year to return the meeting dates for. The default is the current year.
.EXAMPLE
Get-MSPSUGMeetingDate
.EXAMPLE
Get-MSPSUGMeetingDate -Year 2014, 2015
.EXAMPLE
Get-MSPSUGMeetingDate -Year (2013..2020)
.EXAMPLE
Get-MSPSUGMeetingDate -Month July, September
.EXAMPLE
Get-MSPSUGMeetingDate -Month (7..10) -Year 2014, 2015
.EXAMPLE
2014, 2015 | Get-MSPSUGMeetingDate
.EXAMPLE
2013..2020 | Get-MSPSUGMeetingDate -Month July, September
.INPUTS
Integer
.OUTPUTS
PSCustomObject
.NOTES
Written by Mike F Robbins
Blog: http://mikefrobbins.com
Twitter: @mikefrobbins
#>
[CmdletBinding()]
param (
[ValidateNotNullOrEmpty()]
[string[]]$Month = (1..12),
[Parameter(ValueFromPipeline)]
[ValidateRange(2013,9999)]
[Int[]]$Year = (Get-Date).Year
)
PROCESS {
foreach ($y in $Year) {
foreach ($m in $Month) {
[datetime]$meetingDate = "$m 1, $y"
while ($meetingDate.DayOfWeek -ne 'Tuesday') {
$meetingDate = $meetingDate.AddDays(1)
}
[PSCustomObject]@{
'Year' = $y
'MeetingDate' = $($meetingDate.AddDays(7).AddHours(20).AddMinutes(30))
}
}
}
}
}