Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
#This script was written a while back using quest's #AD commandlets those can be
# downloaded from here:
#[URL unfurl="true"]http://www.quest.com/powershell/activeroles-server.aspx[/URL]
#This script will find any AD account in an OU
#with less than 15 days on its password
#and send an email to the user
Add-PSSnapin Quest.ActiveRoles.ADManagement
$tod = get-date
$cutoff = 16
#Remove the -ou parameter from the command
#below to get all users in AD
Get-QADUser -ou 'OU=USERS, DC=domain,DC=local' -enabled -size 0 | where {($_.PasswordNeverExpires -eq $False)} | Foreach-Object {
$timeleft = ($_.passwordexpires - $tod).Days
$Firstname=$_.givenname
$lastname=$_.lastname
$logonname=$_.SamAccountName
if ($timeleft -lt $cutoff) {
if ($timeleft -lt 1) {$timeleft=0}
$body = @"
Dear $firstname $lastname ($logonname),
*** YOU PUT YOUR OWN TEXT HERE ***
Thank you,
Service Desk
My Company
Ph: 123456789
servicedesk@mycompany.com
[URL unfurl="true"]http://mycompany.com[/URL]
"@
$User=$_.SamAccountName
$emailrecipientsTo = $_.PrimarySMTPAddress
$emailrecipientsCC = "servicedesk@mycompany.com"
Send-MailMessage –From servicedesk@mycompany.com –To $emailrecipientsTo –CC $emailrecipientsCC –Subject "ICT ADVISORY: Your Password will expire within the next $timeleft days" –Body $body -Attachment "C:\Scripts\KB_Article_HowToChangeAPassword.pdf", "C:\Scripts\KB_Article_ChoosingAGoodPassword.pdf" –SmtpServer webmail.mycompany.com
}
}