עבור לתוכן

תוכנה ששולחת הודעה במייל כשהסיסמא עומדת לפוג ב AD

Featured Replies

פורסם

היי

אני מחפש תוכנה או סרביס חינמי שרץ וכשהסיסמא של המשתמש עומדת לפוג אז הוא מקבל מייל עם הודעה שיש לו עוד 5 ימים לשנות את הסיסמה,

כרגע אני משתמש ב "ADSelfService Plus Console" אבל הוא רק ל 50 משתמשים והתוקף שלו עומד לפוג.

תודה לכל העוזרים,

בברכה

גיא ש.

פורסם

יש מוצרי מדף רבים, אבל אתה עכול לכתוב סקריפט PS פשוט שירוץ כל יממה כמשימה מתוזמנת ויעשה את זה.

פורסם
  • מחבר

מצאתי סקריפט וערכתי אותו כדי שיתאים לצרכים שלי,

אבל לא הצלחתי לגרום לו לרוץ בצורה תקינה, אודה לך אם תוכל לעזור לי בכל צורה,

בברכה

גיא ש.

פורסם

מה לא מצליח?

תשים לב שאתה חייב לקרוא לו דרך powershell.exe במשימה.

פורסם
  • מחבר

הנה ה SCRIPT

במקומות שיש XXX זה מידע רגיש לכן צנזרתי.

"##################################################################################################################

# Version 1.3 April 2015

# Robert Pearman (WSSMB MVP)

# TitleRequired.com

# Script to Automated Email Reminders when Users Passwords due to Expire.

#

# Requires: Windows PowerShell Module for Active Directory

#

# For assistance and ideas, visit the TechNet Gallery Q&A Page. http://gallery.technet.microsoft.com/Password-Expiry-Email-177c3e27/view/Discussions#content

#

##################################################################################################################

# Please Configure the following variables....

$smtpServer="XXX"

$expireindays = 5

$from = "Computer Support <ComputerSupport@XXXl>"

$logging = "Enabled" # Set to Disabled to Disable Logging

$logFile = "<log file path>" # ie. c:\mylog.csv

$testing = "Enabled" # Set to Disabled to Email Users

$testRecipient = "guys@XXX.co.il"

$date = Get-Date -format ddMMyyyy

#

###################################################################################################################

# Check Logging Settings

if (($logging) -eq "Enabled")

{

# Test Log File Path

$logfilePath = (Test-Path $logFile)

if (($logFilePath) -ne "True")

{

# Create CSV File and Headers

New-Item $logfile -ItemType File

Add-Content $logfile "Date,Name,EmailAddress,DaystoExpire,ExpiresOn"

}

} # End Logging Check

# Get Users From AD who are Enabled, Passwords Expire and are Not Currently Expired

Import-Module ActiveDirectory

$users = get-aduser -filter * -properties Name, PasswordNeverExpires, PasswordExpired, PasswordLastSet, EmailAddress |where {$_.Enabled -eq "True"} | where { $_.PasswordNeverExpires -eq $false } | where { $_.passwordexpired -eq $false }

$DefaultmaxPasswordAge = (Get-ADDefaultDomainPasswordPolicy).MaxPasswordAge

# Process Each User for Password Expiry

foreach ($user in $users)

{

$Name = $user.Name

$emailaddress = $user.emailaddress

$passwordSetDate = $user.PasswordLastSet

$PasswordPol = (Get-AduserResultantPasswordPolicy $user)

# Check for Fine Grained Password

if (($PasswordPol) -ne $null)

{

$maxPasswordAge = ($PasswordPol).MaxPasswordAge

}

else

{

# No FGP set to Domain Default

$maxPasswordAge = $DefaultmaxPasswordAge

}

$expireson = $passwordsetdate + $maxPasswordAge

$today = (get-date)

$daystoexpire = (New-TimeSpan -Start $today -End $Expireson).Days

# Set Greeting based on Number of Days to Expiry.

# Check Number of Days to Expiry

$messageDays = $daystoexpire

if (($messageDays) -ge "1")

{

$messageDays = "in " + "$daystoexpire" + " days."

}

else

{

$messageDays = "today."

}

# Email Subject Set Here

$subject="Your password will expire $messageDays"

# Email Body Set Here, Note You can use HTML, including Images.

$body ="

Dear $name,

<p> Your Password will expire $messageDays.<br>

To change your password on a PC press CTRL ALT Delete and chose Change Password <br>

<p>Thanks, <br>

</P>"

# If Testing Is Enabled - Email Administrator

if (($testing) -eq "Enabled")

{

$emailaddress = $testRecipient

} # End Testing

# If a user has no email address listed

if (($emailaddress) -eq $null)

{

$emailaddress = $testRecipient

}# End No Valid Email

# Send Email Message

if (($daystoexpire -ge "0") -and ($daystoexpire -lt $expireindays))

{

# If Logging is Enabled Log Details

if (($logging) -eq "Enabled")

{

Add-Content $logfile "$date,$Name,$emailaddress,$daystoExpire,$expireson"

}

# Send Email Message

Send-Mailmessage -smtpServer $smtpServer -from $from -to $emailaddress -subject $subject -body $body -bodyasHTML -priority High

} # End Send Message

} # End User Processing

# End"

פורסם

תשתמש בבקשה בתג של קוד (#) כדי להציג קוד בפורום בצורה קריאה.

מה השאלה?

פורסם

[h=1]Netwrix Password Expiration Notifier[/h]

פורסם
  • מחבר

מצטער על אי השימוש ב # לציון קוד,

הבעיה שאני לא מצליח לגרום ל סקריפט לעבוד.

פורסם

איפה הוא נופל? תבדוק כל רכיב שלו בנפרד.

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים