Import-Module ActiveDirectory #Computers Account OU Search-ADAccount -AccountInactive -SearchBase "OU=ComputerAccounts,DC=(yourdomain,DC=MSU,DC=EDU" -TimeSpan 180.00:00:00 -ComputersOnly | Disable-ADAccount Search-ADAccount -AccountInactive -SearchBase "OU=ComputerAccounts,DC=ISP,DC=MSU,DC=EDU" -TimeSpan 90.00:00:00 -ComputersOnly | Select name, lastlogondate | ft -AutoSize > c:\scripts\Inactive_Computers.txt Search-ADAccount -AccountDisabled -SearchBase "OU=ComputerAccounts,DC=ISP,DC=MSU,DC=EDU" -SearchScope OneLevel -ComputersOnly | Select name, lastlogondate | ft -AutoSize > c:\scripts\Disabled_Computers.txt | Move-ADObject -TargetPath "OU=DisabledAccounts,DC=(yourdomain),DC=MSU,DC=EDU" Send-MailMessage -From [log in to unmask] -Subject "Daily Inactive Computers 90days" -To [log in to unmask] -Attachments c:\scripts\Inactive_Computers.txt -body (get-content c:\scripts\Inactive_Computers.txt | out-string) -SmtpServer smpt.yourdomain.msu.edu Send-MailMessage -From [log in to unmask] -Subject "Daily Disabled Computers" -To [log in to unmask] -Attachments c:\scripts\Disabled_Computers.txt -body (get-content c:\scripts\Disabled_Computers.txt | out-string) -SmtpServer smpt.yourdomain.edu