How do i list and automate user accounts to be expired within 10 days?
Posted on 2011-02-27
I need some help in providing me with a Visual Basic script or Power Shell for listing and automating user accounts to be expired within 10 days in Active Directory.
The Listing part:
I want the script to generate a report in excel (XLS) format that includes the following columns:
Exchange Custom Attribute 1
Actually, i am using a value in the custom attr 1 field, this value is the employee staff number. (I call it also SAP ID because the value is populated by HR SAP app.)
The automation part:
I want the script to send this report (that is generated in the above step) to specific recipients. So, i assume that you will involve Exchange communication in the code.
The purpose and the goal from this request is to generate a weekly report about those accounts to be expired and send them to myself, my colleague and my boss automatically using a Windows sheduled task.
Ooooops! i almost forget ...
It is recommended to run this script against an OU of my choice not against the entire directory since there are specific user accounts located in certain OU that i need to run the script against them.
By the way, i am using Exchange 2k7.
Hope i clarified my point enough and Appreciate your fast and valuable response.