Compare commits

..

No commits in common. "1c7fcdacdf457a0be77e8b2ed341f81e71397cd8" and "779d2ad2dd6e3436452e7b27215ef523917b36fa" have entirely different histories.

View File

@ -19,9 +19,7 @@ $Users = Get-ADUser -SearchBase "$UsersOU" -Filter * -Properties * `
| select DisplayName,userPrincipalName,lastLogon,distinguishedName | % { $_.lastLogon = [DateTime]::FromFileTime($_.lastLogon); $_ }
# Disable the accounts
foreach ($User in $Users) {
Disable-ADAccount -Identity $User.distinguishedName
}
$Users | Disable-ADAccount
# Email a report
if (($Users.distinguishedName).Count -gt 0) {
@ -31,8 +29,7 @@ if (($Users.distinguishedName).Count -gt 0) {
<ul>
$($Users | % { "<li>$($_.DisplayName) &lt;$($_.userPrincipalName)&gt;, not logged in since $($_.lastLogon)</li>" })
</ul><br/>
<p>This email was sent automatically. Please do not reply.</p><br/>
<p><pre>$($UsersOU) $(Get-Date)</pre></p>
<p>This email was sent automatically. Please do not reply.</p>
"@
Send-MailMessage -SmtpServer $SmtpServer -Port $SmtpPort -UseSsl -From $SmtpFrom -To $SmtpTo `