none
90 day inactive user report

    Question

  • I have script which reports 90 day inactive users. However, I want this report to be sent via email. Is there any way this can be achieved. Need help.
    Wednesday, September 18, 2013 11:24 PM

Answers

  • Hi,

    $to=to@mailbox.com

    $from=from@mailbox.com

    $smtpserver=smtpservername

    $body =get-aduser -SearchBase "OU=User_Accounts,DC=DEVLAB,DC=LOCAL" -filter * -Properties lastlogondate, passwordlastset | Where-Object {($_.lastlogondate -le $90days -or $_.lastlogondate -notlike "*")-AND ($_.passwordlastset -le $90days) -AND ($_.Enabled -eq $True)} | Select-Object name, lastlogondate, passwordlastset

    Send-MailMessage -To $to -From $from -SmtpServer $smtpserver -Subject "90 day inactive user report" -body $body

    Please change those parameter based on your environment.

    Hope this helps.

    Regards,

    Yan Li


    Cataleya Li
    TechNet Community Support

    Friday, September 20, 2013 3:27 AM
    Moderator

All replies

  • Is there any smtp which we can script and send it via email. This is urgent. Experts please help.
    Wednesday, September 18, 2013 11:58 PM
  • here you go, use powershell 2.0 method

    http://exchangeserverpro.com/powershell-how-to-send-email/


    Kottees :My Blog Please mark it as an answer if it really helps you.

    • Proposed as answer by Phil U Thursday, September 19, 2013 12:18 AM
    Thursday, September 19, 2013 12:17 AM
  • I am really looking for script which will report inactive users from last 90 days, and notified it via email. I looked, but don't have all together. Can anyone please direct me. will be much appreciated.
    Friday, September 20, 2013 12:29 AM
  • check this one

    http://www.amandhally.net/2012/08/21/powershell-active-directory-active-directory-reports-in-excel/


    Kottees :My Blog Please mark it as an answer if it really helps you.

    Friday, September 20, 2013 12:35 AM
  • Hi,

    $to=to@mailbox.com

    $from=from@mailbox.com

    $smtpserver=smtpservername

    $body =get-aduser -SearchBase "OU=User_Accounts,DC=DEVLAB,DC=LOCAL" -filter * -Properties lastlogondate, passwordlastset | Where-Object {($_.lastlogondate -le $90days -or $_.lastlogondate -notlike "*")-AND ($_.passwordlastset -le $90days) -AND ($_.Enabled -eq $True)} | Select-Object name, lastlogondate, passwordlastset

    Send-MailMessage -To $to -From $from -SmtpServer $smtpserver -Subject "90 day inactive user report" -body $body

    Please change those parameter based on your environment.

    Hope this helps.

    Regards,

    Yan Li


    Cataleya Li
    TechNet Community Support

    Friday, September 20, 2013 3:27 AM
    Moderator
  • Hi Yan Li,

    Can you help me to write the following script in VB or powershel: I woud like to find in my domain all the AD users accounts that have not been logged into for more than 90 days and export the report to a .csv file name format shoul be (unusedacc90days_dd-mm-yyyy.csv) and this report to be sent via email.

    below is my OU details. (domain=mydomain.com)
    OU=Others
    OU=Dept1
    OU=Dept2
    OU=Sales

    Many thanks in advance for your help.


    • Edited by Billvel Saturday, November 29, 2014 3:15 PM
    Saturday, November 29, 2014 3:14 PM
  • Thanks,

    regards

    Saturday, November 29, 2014 4:58 PM