Exporting AD entries to csv file
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.
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:
Get-QADUser -SizeLimit 0 | Select-Object lastname,firstname,email | Export-Csv c:\PSexport\Allusers.csv -NoTypeInformation
by iHunger at 2012-10-30 06:16:28
$today = Get-Date -Format ymmdd
Get-QADUser -SizeLimit 0 | Select-Object lastname,firstname,email | Export-Csv c:\PSexport\Allusers$today.csv -NoTypeInformation
by jhaighsy at 2012-10-30 06:23:10
Thanks very much for that! Works a treat 🙂
You must be logged in to reply to this topic.