hartwellcorp
asked on
Schedule a weekly report of expiring accounts in Active Directory?
We have accounts which are set to expire on a certain date. We would like to receive a report every week of accounts with expiration dates. i imagine creating a script which picks up a txt file and emails it to me is fairly easy and i can put that into a scheduled task. what i need help with is creating a script which creates the txt file. Ideally the script would query AD for any accounts with "account expires" set to a specific date and list only those accounts in the file. Note that I am not referring to password expiration here but account expiration.
ASKER
Thank you for find that for me. I'll check it out.
ASKER
so that does save exactly what i want to a txt file. you mention "email it via script". do you have an example of how one does that?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I am trying that now. is there a way i can instead send the contents of the txt file in the body of the message? that way we dont even have to open an attachment?
ASKER
maybe this tool wont work. the format of the output is a mess. unless you know a way around this?
DN,cn,displayName,sAMAccou ntName,acc ountExpire s,expireDa ys,mail
"cn=marks,ou=visitors,ou=h artwelluse rs,dc=hart wellcorp,d c=com","ma rks","Mark Stuvetraa","marks","2012/0 3/11-00:00 :00","67", ""
"cn=epitech,ou=visitors,ou =hartwellu sers,dc=ha rtwellcorp ,dc=com"," epitech"," Epicor Tech Support VPN account","epitech","2012/0 2/01-00:00 :00","28", ""
"cn=jimh,ou=visitors,ou=ha rtwelluser s,dc=hartw ellcorp,dc =com","jim h","Jim Howell","jimh","2011/08/31 -23:00:00" ,"-124",""
"cn=jeffz,ou=visitors,ou=h artwelluse rs,dc=hart wellcorp,d c=com","je ffz","Jeff Zonick","jeffz","2010/07/3 1-23:00:00 ","-520"," "
"cn=michaels,ou=visitors,o u=hartwell users,dc=h artwellcor p,dc=com", "michaels" ,"Michael Serrato","michaels","2011/ 01/01-00:0 0:00","-36 7",""
"cn=shorwitz,ou=visitors,o u=hartwell users,dc=h artwellcor p,dc=com", "shorwitz" ,"Steve Horwitz","shorwitz","2012/ 01/13-00:0 0:00","9", ""
"cn=dhaynes,ou=visitors,ou =hartwellu sers,dc=ha rtwellcorp ,dc=com"," dhaynes"," David Haynes","dhaynes","2012/01 /12-00:00: 00","8",""
"cn=rodb,ou=visitors,ou=ha rtwelluser s,dc=hartw ellcorp,dc =com","rod b","Rod Biagtan","rodb","2012/02/0 2-00:00:00 ","29","ro db@Hartwel lcorp.com"
"cn=susanj,ou=visitors,ou= hartwellus ers,dc=har twellcorp, dc=com","s usanj","Su san Joslyn","susanj","2012/01/ 11-00:00:0 0","7","su sanj@Hartw ellcorp.co m"
"cn=dtl,ou=visitors,ou=har twellusers ,dc=hartwe llcorp,dc= com","dtl" ,"DTL Consultant","dtl","2012/02 /02-00:00: 00","29"," "
DN,cn,displayName,sAMAccou
"cn=marks,ou=visitors,ou=h
"cn=epitech,ou=visitors,ou
"cn=jimh,ou=visitors,ou=ha
"cn=jeffz,ou=visitors,ou=h
"cn=michaels,ou=visitors,o
"cn=shorwitz,ou=visitors,o
"cn=dhaynes,ou=visitors,ou
"cn=rodb,ou=visitors,ou=ha
"cn=susanj,ou=visitors,ou=
"cn=dtl,ou=visitors,ou=har
ASKER
by the way, all of your suggestions so far have worked. i now have a task scheduled that runs fine and it refreshes the output file and then sends it to me in an email. I just really need to clean up the output as it is quite difficult to read. thanks!!
ASKER
Thank you!
http://www.joeware.net/freetools/tools/findexpacc/index.htm
Also you can batch it and export the result to a text file and email it via script.