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