# encoding: ascii
# api: powershell
# title: Get-MonthAccountCreated 
# description: function Get-MonthAccountCreated 
# version: 0.1
# type: function
# author: sepeck
# license: CC0
# function: Get-MonthAccountCreated
# x-poshcode-id: 3976
# x-archived: 2013-03-02T02:13:49
# x-published: 2013-02-20T17:25:00
#
# This gets accounts created during a given month and year
#
function Get-MonthAccountCreated {
    <#
    .SYNOPSIS
    Gets Account created in given month.
    .DESCRIPTION
    Gets Account created in given month.
    
    .EXAMPLE 
    Get-MonthAccountCreated -Month 2 -Year 2012
    .EXAMPLE
    Get-MonthAccountCreated -Month 10 -Year 2012
        
    .PARAMETER Month
    Month as number.
    .PARAMETER YEAR
    Year
    #>
    [cmdletBinding()]
    param(
        [Parameter(mandatory=$True)]
        [ValidateRange(1,12)]
        [int]$Month,
        [Parameter(mandatory=$True)]
        [ValidateRange(1990,2020)]
        [int]$Year
    )
 
    BEGIN {}
    PROCESS {
        $mbx = Get-Mailbox -ResultSize Unlimited
        $result = $mbx | Where-Object { ($_.WhenCreated).Month -eq $month -and ($_.WhenCreated).year -eq $year } | Select-Object Name, WhenCreated 
        $result
        }
    
    END{}
}
