Wishing everyone near and far a Happy Thanksgiving.
Be thankful for those who can gather near to you on this wonderful day and give thanks to those who have and are sacrificing for your safety.
Keyboard
Commands
|
Actions
|
SHIFT + COMMAND (⌘) + H
|
Open Finder @ Home Folder
|
SHIFT + COMMAND (⌘) + L
|
Open Finder @ Root Level
|
SHIFT + COMMAND (⌘) + R
|
Open Air Drop
|
SHIFT + COMMAND (⌘) + D
|
Open Desktop
|
COMMAND (⌘) + K
|
Open Connect Server (Network Mapping)
|
SHIFT + COMMAND (⌘) + G
|
Open Go to Folder
|
SHIFT + COMMAND (⌘) + O
|
Open Documents
|
SHIFT + COMMAND (⌘) + 3
|
Screen Capture – Whole Screen
|
SHIFT + COMMAND (⌘) + 4
|
Screen Capture – Targeted with Mouse
|
SHIFT + COMMAND (⌘) +
SPACEBAR
|
Screen Capture – Active Window
|
################################### # Get the max Password age from AD # This Section pulls domains maximum password age from your domain controller(s) ################################### function Get-maxPwdAge{ $root = [ADSI]"LDAP://DOMAIN.COM" #Change DOMAIN.COM to target your domain $filter = "(&(objectcategory=domainDNS)(distinguishedName=DC=DOMAIN,DC=COM))" #Change Distinguished name to target your domain $ds = New-Object system.DirectoryServices.DirectorySearcher($root,$filter) $dc = $ds.findone() [int64]$maxpwdage = [System.Math]::Abs( $dc.properties.item("maxPwdAge")[0]) $maxpwdage/864000000000 #Pulls maxPwdAge from domain for comparison later }
################################### # Function to send HTML email to each user ################################### function send_email ($days_remaining, $email, $name ) { $today = Get-Date $today = $today.ToString("dddd (yyy-MMMM-dd)") $date_expire = [DateTime]::Now.AddDays($days_remaining); $date_expire = $date_expire.ToString("dddd (yyy-MMMM-dd)") $SmtpClient = new-object system.net.mail.smtpClient $mailmessage = New-Object system.net.mail.mailmessage $SmtpClient.Host = "ENTER YOUR MAIL SERVER HERE" $mailmessage.from = "Technology <expiringpassword@donotreply.com>" $mailmessage.To.add($email) $mailmessage.Subject = "$name, Your DOMAIN Password will expire soon." $mailmessage.IsBodyHtml = $true $mailmessage.Body = @" <font face=Calibri (Body)>Dear $name, </font><br /><br /> <font face=Calibri (Body)>Your password will expire in <font color=red><strong>$days_remaining</strong></font> days on <strong>$date_expire</strong>.<br /> To prevent access issues ensure you change your password prior to $date_expire.<br /><br /> Your domain password is required for Computer Login, Infinite Campus, Email Access, Google Services (Drive, gMail), etc.<br /><br /><br /> You will receive this message until password is changed.<br /><br /> To change your password follow below processes:<br /><br /> <ul> <li type=square>Remote User <ul> <li>Must come onsite to change when connected to District network (Desktop or SaberSecure[WiFi]) </ul> </ul> <ul> <li type=square>PC/Windows User <ul> <li>Logon to system and press CTRL-ALT-DEL and choose Change Password. </ul> </ul> <ul> <li type=square>PASSWORD REQUIREMENTS<br /><br /> <ul> <li>must be 8 or more characters long and<br /> <li>cannot be one of last 7 password used<br /> <li>contain a mix of THREE of the following FOUR properties:<br /> <ul> <li type=disc>uppercase letters (A-Z)<br /> <li type=disc>lowercase letters (a-z)<br /> <li type=disc>numbers (0-9)<br /> <li type=disc>symbols (!"£$%^&*) </ul> </ul> </ul> <br /><br /> Once your password has been changed you will need to update on all mobile devices (ex: cellphone / iPad / etc). Failure to update could result in your account becoming locked repeatedly due to failed account access. <br /><br /><br /> If you have any questions, please contact the IT Helpdesk on <br /><br /> Generated on : $today </font> "@ $smtpclient.Send($mailmessage) }
################################### # Search for Non-disabled AD users that have a Password Expiry. ################################### $strFilter = "(&(objectCategory=User)(logonCount>=0)(!(userAccountControl:1.2.840.113556.1.4.803:=2))(!(userAccountControl:1.2.840.113556.1.4.803:=65536)))" $objDomain = New-Object System.DirectoryServices.DirectoryEntry $objSearcher = New-Object System.DirectoryServices.DirectorySearcher $objSearcher.SearchRoot = $objDomain $objSearcher.PageSize = 1000 $objSearcher.Filter = $strFilter $colResults = $objSearcher.FindAll(); # how many days before PW expiry do we start sending reminder emails? $max_alert = 14 # Get the maximum password lifetime $max_pwd_life=Get-maxPwdAge $userlist = @() foreach ($objResult in $colResults) {$objItem = $objResult.Properties; if ( $objItem.mail.gettype.IsInstance -eq $True) { $user_name = $objItem.name $user_email = $objItem.email #Transform the DateTime readable format $user_logon = [datetime]::FromFileTime($objItem.lastlogon[0]) $result = $objItem.pwdlastset $user_pwd_last_set = [datetime]::FromFileTime($result[0]) #calculate the difference in Day from last time a password was set $diff_date = [INT]([DateTime]::Now - $user_pwd_last_set).TotalDays; $Subtracted = $max_pwd_life - $diff_date if (($Subtracted) -le $max_alert) { $selected_user = New-Object psobject # $selected_user | Add-Member NoteProperty -Name "Name" -Value $objItem.name[0] $selected_user | Add-Member NoteProperty -Name "Name" -Value $objItem.Item("displayname") $selected_user | Add-Member NoteProperty -Name "Email" -Value $objItem.mail[0] $selected_user | Add-Member NoteProperty -Name "LastLogon" -Value $user_logon $selected_user | Add-Member NoteProperty -Name "LastPwdSet" -Value $user_pwd_last_set $selected_user | Add-Member NoteProperty -Name "RemainingDays" -Value ($Subtracted) $userlist+=$selected_user } } }
################################### # Send email to each user ################################### foreach ($userItem in $userlist ) { if ($userItem.RemainingDays -ge 0) { #Remove Comment (#) below to perform normal process / email user #send_email $userItem.RemainingDays $userItem.Email $userItem.Name #Update and remove comment below for testing / troubleshooting. Allows for mailing a single user all expiring user alerts # send_email $userItem.RemainingDays ENTER_ADMIN_EMAIL_HERE $userItem.Name } } # END
|
Other IT Blogs |