PoshCode Archive  Artifact [ac27c9b421]

Artifact ac27c9b4217397a3c39ca9eaed6225f2baaa9941f9824fca500dc81cb7820a18:

  • File Get-MonthAccountCreated.ps1 — part of check-in [24b7c5d2d8] at 2018-06-10 13:33:47 on branch trunk — function Get-MonthAccountCreated (user: sepeck size: 1282)

# 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{}
}