Hi
I have this script:
Add-PSSnapin Quest.ActiveRoles.ADManagement
Get-QADUser -SizeLimit 0 -CreatedAfter (Get-Date 12/12/2013) -CreatedBefore (Get-Date 13/12/2013) -IncludedProperties Name,WhenCreated,DisplayName,EMail,EmployeeID,StreetAddress,WebPage,SamAccountName,ParentContainer,Title |
Select-Object Name,WhenCreated,DisplayName,EMail,EmployeeID,StreetAddress,WebPage,SamAccountName,ParentContainer,Title,@{Name = "Creator Username"; Expression = { $_.Security.Owner }},@{Name = "Creator DisplayName"; Expression
= { (Get-QADUser $_.Security.Owner).DisplayName }} |
Export-CSV D:\Tools\Reportes_Power_Shell\Reportes_de_Power_Shell_y_AD_Info\Reporte_Diario_Completo.csv
I need to automate the dates from a day before, instead of me doing it manually I want the script automatically to put the date before, for example if today is December 13th I want the script to make a report from the day before, so it would be December 12th. The idea is to automatically run it with Windows Task Scheduler when i'm out of the office so when I get back it's done. So I suppose that the script also has to gather the time in hour and minutes, after midnight it would be another day. I don't know if I made myself clear, if I need a report from December 12th, the script has to wait after December 12th at 23 hour, 59 minutes and 59 seconds, and after a second make the report so it can gather the information of the entire day.
Thanks!