Powershell - Pull users created after a certain date

HI EE

Can someone help me modify the search below so it pulls only accounts created after a certain date ? the search below pulls all accounts that end with "a" which is what I need but ideally I just need the ones created August 1st - 30th , 2013 . Instead of pulling all of them and then resorting .

Get-ADUser -Filter {SamAccountName -like "*a"} -properties office,whencreated | Select Samaccountname,whenCreated,office | Export-CSV Accounts.csv
LVL 2
MilesLoganAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

arrorynCommented:
This is very rambly, but in the ramble is some very good date constraint information...

http://blogs.technet.com/b/heyscriptingguy/archive/2011/12/23/use-powershell-to-audit-active-directory-user-account-creation.aspx
0
SubsunCommented:
Try..
Get-ADUser -Filter {SamAccountName -like "*a"} -properties office,whencreated | ? { $_.whenCreated -ge (get-date "August 1, 2013")}|Select Samaccountname,whenCreated,office | Export-CSV Accounts.csv

Open in new window

With Quest tools..
Get-QADUser -CreatedAfter "August 1, 2013"

Open in new window

0
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

MilesLoganAuthor Commented:
Hi SubSun .. your code works perfect .. but can you explain to me how the line below only pulls between Aug 1 - Aug 30 ?

 ? { $_.whenCreated -ge (get-date "August 1, 2013")}
0
SubsunCommented:
Above code report only users created after August 1, 2013. For your requirement try..
 ? { $_.whenCreated -ge (get-date "August 1, 2013") -and  $_.whenCreated -le (get-date "August 30, 2013")} 

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MilesLoganAuthor Commented:
what does -ge and -le mean ?
0
SubsunCommented:
Those are comparison operators..
-ge > Greater-than or equal to.
-le  > Less-than or equal to.


Ref: http://technet.microsoft.com/en-us/library/hh847759.aspx
0
MilesLoganAuthor Commented:
Always such great help !! thank you Subsun !
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.