Link to home
Start Free TrialLog in
Avatar of AhmedAliShaik
AhmedAliShaikFlag for India

asked on

Report of Users accounts in Domain Controller created in Last 5 days.

Hi All,

As per requirement i have to pull a report of users accounts who has been created in last 5 days. All Domain controller are running in 2008 server.

Please share me powershell command to meet my requirement.
SOLUTION
Avatar of Mike Kline
Mike Kline
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AhmedAliShaik

ASKER

I have tried the below command

$date=(Get-Date).adddays(-5)
Get-ADUser -Filter {whencreated -gt $date} -properties * | ft name,whencreated

I am getting the output in the below format:
name whencreated
a        date time

Can i get the output in the below format:

Name whencreated  noofdays
A       date time         2

In the no. of days i want the substraction & know how many days back the account is created . In the output it shouls be (1 to 5)
Mike thanks for your response.

We are not allowed to run any tool except Microsoft in our production.

Please suggest me with the powershell or any microsoft cmdlet.

Thanks .
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Thinkpad,

Good to know the easy step too. As per our requirement if we have a script we can automate and run a batch file, trigger an email to customer.

I have used the Quest command given by Sarang & powershell given by others aswell which are working fine.

I completely agree with your method wen we need few thinks instantly & when we are not sure about the code.

Thanks a lot.
Thanks All.