by jhaighsy at 2012-10-30 06:04:02
Hi, I’ve created a script which pulls User details from AD and puts them in a csv file. I want to auto run this script every month so to do this I have created a task schedule to run a batch file of the powershell script.by iHunger at 2012-10-30 06:16:28
The problem I have is that the csv file is being overwritten each time the script runs. I want it so that a new csv file is created each time and named differently.
I’m new to all of this so not sure where to go with it.
My script is:
Add-PSSnapin Quest.ActiveRoles.ADManagement
Get-QADUser -SizeLimit 0 | Select-Object lastname,firstname,email | Export-Csv c:\PSexport\Allusers.csv -NoTypeInformation
Any ideas?
$today = Get-Date -Format ymmdd
Add-PSSnapin Quest.ActiveRoles.ADManagement
Get-QADUser -SizeLimit 0 | Select-Object lastname,firstname,email | Export-Csv c:\PSexport\Allusers$today.csv -NoTypeInformationby jhaighsy at 2012-10-30 06:23:10Thanks very much for that! Works a treat