116480
Goto Top

In Gruppenrichtlinie Interactive Logon: Prompt user to Change Password before Expiration 30 Days eingestellt. Es kommt keine Meldung , das man Passwort wechseln muss

Hallo,

in der Gruppenrichtlinie Computer Configuration \ Policies\ Windows Settings \ Security Settings \ Local Policies / Security Options \ Interactive Logon \ wurde bei
Interactive Logon: Prompt user to Change Password before Expiration 30 Days eingestellt . Trotzdem erscheint keine Meldung, das man Passowrt wechseln muss, und Passwort lauft einfach ab.
Weiss jemand, was man noch einstellen muss ? Es kommt eben rechts unten , nur ein kleines Icon deswegen, das niemand sieht.


Gruss
Ralf

Content-Key: 275427

Url: https://administrator.de/contentid/275427

Printed on: May 7, 2024 at 18:05 o'clock

Member: clSchak
clSchak Jun 23, 2015 at 18:29:17 (UTC)
Goto Top
Hi

seit Ihr jetzt erst auf Windows 7 (oder höher) umgestiegen? Das ist dort normal. Wir haben das mittlerweile so gelöst, dass der Benutzer 15 Tage vorher, täglich, eine Mail bekommt mit dem Hinweis (es sind nicht immer alle Kollegen permanent in der Firma).
Member: ImTraining
ImTraining Jun 24, 2015 updated at 13:42:16 (UTC)
Goto Top
Mitglied: 116480
116480 Jun 24, 2015 at 14:05:10 (UTC)
Goto Top
Hallo,

das Problem ist, eben das der user rechts unten nur eine kleine Notification hat, das Passwortwechsel kommt. Wie habt ihr das mit dem Mail , das dieses kommt gelöst ?

Gruss
Ralf
Member: clSchak
Solution clSchak Jun 24, 2015, updated at Jun 25, 2015 at 08:30:22 (UTC)
Goto Top
Einfaches VB Script (habe ich so im Netz gefunden), das wird täglich per Taskplaner am Mailserver um 05:00 Uhr getriggert und die Benutzer erhalten eine Mail das deren PW abläuft.


'  
' exch-pwd-expires.vbs  
'  
' Michael B. Smith  
' March 21, 2005  
'  
' This program scans all users in the Users container and all organizational units  
' beneath the HOSTING_OU organizational unit, for users whose passwords have either  
' already expired or will expire within DAYS_FOR_EMAIL days.  
'  
' An email is sent, using CDO, via the SMTP server specified as SMTP_SERVER to the  
' user to tell them to change their password. You should change strFrom to match  
' the email address of the administrator responsible for password changes.  
'  
' You will, at a minimum, need to change the SMTP_SERVER, the HOSTING_OU, and the  
' STRFROM constants. If you run this on an Exchange server, then SMTP_SERVER can   
' be "127.0.0.1" - and it may be either an ip address or a resolvable name.  
'  
' If you don't have an OU containing sub-OU's to scan, then set HOSTING_OU to the  
' empty string ("").  
'  

 Option Explicit

 ' Per environment constants - you should change these!  
 Const HOSTING_OU  = "organisationseinheit"  
 Const SMTP_SERVER  = "mailserver.fqdn"  
 Const STRFROM   = "absendermailadresse"  
 Const DAYS_FOR_EMAIL  = 15

 ' System Constants - do not change  
 Const ONE_HUNDRED_NANOSECOND    = .000000100   ' .000000100 is equal to 10^-7  
 Const SECONDS_IN_DAY            = 86400
 Const ADS_UF_DONT_EXPIRE_PASSWD = &h10000
 Const E_ADS_PROPERTY_NOT_FOUND  = &h8000500D

 ' Change to "True" for extensive debugging output  
 Const bDebug   = true

 Dim objRoot
 Dim numDays, iResult
 Dim strDomainDN
 Dim objContainer, objSub

 Set objRoot = GetObject ("LDAP://RootDSE")  
 strDomainDN = objRoot.Get ("defaultNamingContext")  
 Set objRoot = Nothing

 numdays = GetMaximumPasswordAge (strDomainDN)
 dp "Maximum Password Age: " & numDays  

 If numDays > 0 Then

  Set objContainer = GetObject ("LDAP://CN=Users," & strDomainDN)  
  Call ProcessFolder (objContainer, numDays)
  Set objContainer = Nothing

  If Len (HOSTING_OU) > 0 Then
   Set objContainer = GetObject ("LDAP://OU=" & HOSTING_OU & "," & strDomainDN)  

   For each objSub in objContainer
    Call ProcessFolder (objSub, numDays)
   Next

   Set objContainer = Nothing
  End If

  '========================================  
  ' Add the number of days to the last time  
  ' the password was set.  
  '========================================  
  'whenPasswordExpires = DateAdd ("d", numDays, oUser.PasswordLastChanged)  

  'WScript.Echo "Password Last Changed: " & oUser.PasswordLastChanged  
  'WScript.Echo "Password Expires On: " & whenPasswordExpires  
 End If

 WScript.Echo "Done"  

Function GetMaximumPasswordAge (ByVal strDomainDN)
 Dim objDomain, objMaxPwdAge
 Dim dblMaxPwdNano, dblMaxPwdSecs, dblMaxPwdDays

 Set objDomain = GetObject("LDAP://" & strDomainDN)  
 Set objMaxPWdAge = objDomain.maxPwdAge

 If objMaxPwdAge.LowPart = 0 And objMaxPwdAge.Highpart = 0 Then
  ' Maximum password age is set to 0 in the domain  
  ' Therefore, passwords do not expire  
  GetMaximumPasswordAge = 0
 Else
  dblMaxPwdNano = Abs (objMaxPwdAge.HighPart * 2^32 + objMaxPwdAge.LowPart)
  dblMaxPwdSecs = dblMaxPwdNano * ONE_HUNDRED_NANOSECOND
  dblMaxPwdDays = Int (dblMaxPwdSecs / SECONDS_IN_DAY)
  GetMaximumPasswordAge = dblMaxPwdDays
 End If
End Function

Function UserIsExpired (objUser, iMaxAge, iDaysForEmail, iRes)
 Dim intUserAccountControl, dtmValue, intTimeInterval
 Dim strName

 On Error Resume Next
 Err.Clear

 strName = Mid (objUser.Name, 4)
 intUserAccountControl = objUser.Get ("userAccountControl")  

 If intUserAccountControl And ADS_UF_DONT_EXPIRE_PASSWD Then
  dp "The password for " & strName & " does not expire."  
  UserIsExpired = False
 Else
  iRes = 0
  dtmValue = objUser.PasswordLastChanged
  If Err.Number = E_ADS_PROPERTY_NOT_FOUND Then
   UserIsExpired = True
   dp "The password for " & strName & " has never been set."  
  Else
   intTimeInterval = Int (Now - dtmValue)
   dp "The password for " & strName & " was last set on " & _  
    DateValue(dtmValue) & " at " & TimeValue(dtmValue) & _  
    " (" & intTimeInterval & " days ago)"  

   If intTimeInterval >= iMaxAge Then
    dp "The password for " & strName & " has expired."  
    UserIsExpired = True
   Else
    iRes = Int ((dtmValue + iMaxAge) - Now)
    dp "The password for " & strName & " will expire on " & _  
     DateValue(dtmValue + iMaxAge) & " (" & _  
     iRes & " days from today)."  

    If iRes <= iDaysForEmail Then
     dp strName & " needs an email for password change"  
     UserIsExpired = True
    Else
     dp strName & " does not need an email for password change"  
     UserIsExpired = False
    End If
   End If

  End If
 End If
End Function

Sub ProcessFolder (objContainer, iMaxPwdAge)
 Dim objUser, iResult

 objContainer.Filter = Array ("User")  

 Wscript.Echo "Checking company = " & Mid (objContainer.Name, 4)  

 For each objUser in objContainer
  If Right (objUser.Name, 1) <> "$" Then  
   If IsEmpty (objUser.Mail) or IsNull  (objUser.Mail) Then
    dp Mid (objUser.Name, 4) & " has no mailbox"  
   Else
    If UserIsExpired (objUser, iMaxPwdAge, DAYS_FOR_EMAIL, iResult) Then
     wscript.Echo "...sending an email for " & objUser.Mail  
     Call SendEmail (objUser, iResult)
    Else
     dp "...don't send an email"  
    End If
   End If
  End If
 Next
End Sub

Sub SendEmail (objUser, iResult)
 Dim objMail

 Set objMail = CreateObject ("CDO.Message")  

 objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing")      = 2  
 objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver")     = SMTP_SERVER  
 objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25  
 objMail.Configuration.Fields.Update

 objMail.From     = STRFROM
 objMail.To       = objUser.Mail

 objMail.Subject  = "Password needs to be set for " & Mid (objUser.Name, 4)  
 objMail.Textbody = "The active directory password for user " & objUser.userPrincipalName & _  
    " (" & objUser.sAMAccountName & ")" & vbCRLF & _  
    "will expire in " & iResult & " days. " & vbCRLF & _  
    "Please change it as soon as possible." & vbCRLF & vbCRLF & _  
    "Thank you," & vbCRLF & _  
    "IT Department"  

 objMail.Send

 Set objMail = Nothing
End Sub

Sub dp (str)
 If bDebug Then
  WScript.Echo str
 End If
End Sub
Mitglied: 116480
116480 Jun 25, 2015 at 08:30:17 (UTC)
Goto Top
Cool face-smile

Danke . Werde es demnächst so implementieren.

Gruss
Ralf
Mitglied: 116480
116480 Jul 15, 2015 at 08:07:00 (UTC)
Goto Top
Kann man das Script so anpassen , das es zwar täglich per Taskplaner ausgeführt wird. Aber nur 1 Email kommt für die USer , mit 21 Tagen vor Ablauf.

Gruss
Ralf
Member: clSchak
clSchak Jul 15, 2015 at 12:39:39 (UTC)
Goto Top
mit Sicherheit kann man das. aber ich kann dir jetzt nicht sagen wie.

Ich würde das eher 15 Tage vorher einstellen und dann täglich eine Mail, mit nur einer Mail hat das den gleichen Effekt wie mit der kleinen Meldung unten Rechts.

Gruß
@clSchak
Mitglied: 116480
116480 Aug 10, 2015 at 14:37:05 (UTC)
Goto Top
Hallo,

ich möchte nun das Script einsetzten, da Powershell

http://deadaffebeef.com/blog/benutzer-per-email-uber-ablauf-des-windows ...

Ich möchte es erst mit 3 Usern testen ! Weiss wer was ich editieren muss, das es nicht die gesamte Domäne nimmt , sondern nur 3 User.
Ist ja vermutlich dieser Part :

Import-Module ActiveDirectory
Get-ADUser -filter * -properties PasswordLastSet,EmailAddress,GivenName,Surname -SearchBase “OU=Benutzer,DC=domain,DC=de” -SearchScope Subtree |foreach


Gruss
Ralf
Mitglied: 114757
114757 Aug 10, 2015 updated at 19:18:44 (UTC)
Goto Top
Ich möchte es erst mit 3 Usern testen ! Weiss wer was ich editieren muss, das es nicht die gesamte Domäne nimmt , sondern nur 3 User.
$users = @('user1','user2','user2')  
$users | %{ Get-ADUser $_ -properties PasswordLastSet,EmailAddress,GivenName,Surname} | foreach { ........
Gruß jodel32
Mitglied: 116480
116480 Aug 11, 2015 at 09:09:56 (UTC)
Goto Top
Cool. Merci !

Gruss
Ralf
Mitglied: 116480
116480 Aug 11, 2015 at 09:24:13 (UTC)
Goto Top
Hoi ,

bei mir sieht es nun so aus

Import-Module ActiveDirectory
$users = @('rthomas')
$users | %{ Get-ADUser $_ -properties PasswordLastSet,EmailAddress,GivenName,Surname} | foreach
{
$PasswordSetDate=$_.PasswordLastSet
$maxPasswordAgeTimeSpan = $null
$maxPasswordAgeTimeSpan = (Get-ADDefaultDomainPasswordPolicy).MaxPasswordAge

Es kommt nun aber beim ausführen:
S D:\Support> D:\Support\Password_Reminder_Test.ps1
cmdlet ForEach-Object at command pipeline position 2
Supply values for the following parameters:
Process:

Eine Idee ?

Gruss
Ralf