Public/Get-LastCreated.ps1
Function Get-LastCreated { <# .Synopsis List accounts created specific number of days ago .Description List ActiveDirectory accounts that where created a specified number of days ago, needs activedirectory module to work .Parameter Last Lists accounts created x days ago, default is 30 days .Example Get-LastCreated -Last 30 Lists accounts created 30 days ago .Example Get-LastCreated -Last 30 | ft Name,LastCreated -Autosize Lists accounts created 30 days ago in a table showing only the name and creationdate of the accounts .Inputs System.Integer .LINK about_functions_advanced .LINK about_CommonParameters #> [CmdletBinding( SupportsPaging = $true )] [OutputType('System.Object[]')] Param ( [Parameter( ValueFromPipeline = $True )] [int]$Last = 30 ) Begin { } Process { Try { Get-ADUser -Filter * | Where-Object { $_.LastCreated -gt (Get-Date).adddays(-$Last) } } Catch { Write-Warning $_.Exception.Message $Error[0] } } End { } } Set-Alias -Name Show-LastCreated -Value Get-LastCreated -Description "Get When Created Dates" -Option ReadOnly -PassThru -ErrorAction SilentlyContinue |