
Windows Server 2003 または 2008 および Active Directory で、ユーザーのパスワードがその日に期限切れになるときに、特定の時間 (たとえば午前 4 時) に期限切れになるようにポリシーで指定する方法はありますか。
問題は、有効期限が就業時間中、たとえば午前 9 時に切れるため発生します。ユーザーがネットワークで Windows にすでにログインしていて、別のアプリケーションを使用している場合、認証のためにそれらのアプリケーションが誤動作し始めます。Windows が新しいパスワードを要求するには、ユーザーはログアウトして再度ログインする必要があります。
したがって、早朝にログインするときに新しいパスワードを要求されれば、就業時間中に再度ログアウトする必要がなくなります。
AD 管理者の 1 人が「一日を始める前に、パスワードの有効期限が切れていないか確認してもらいましょう」と言いましたが、実際に誰がそんなことをするでしょうか?
また、これらのタイプのポリシーを確認するための AD へのアクセス権がありません。それで、これは可能ですか?
答え1
私の知る限り、これは不可能です。
現在のパスワードの有効期限が N 日後に切れることを通知し、パスワードを変更するオプションを提供するリマインダー通知が複数回表示されます。ユーザーがこのリマインダーを無視することを選択した場合、残念ながら自ら墓穴を掘ることになります。
答え2
私たちも同様の問題を抱えています。
私が考えられる唯一の方法は、毎晩 Active Directory を調べて、翌日に期限が切れるアカウントを特定するスクリプトを実行することです。期限が切れるアカウントがあれば、パスワードを変更するようにフラグを立てます。コードは次のようになります。このスクリプトを実行したことがないので、少し調整する必要があるかもしれません。
Const SEC_IN_DAY = 86400
Const ADS_UF_DONT_EXPIRE_PASSWD = &h10000
Const ADS_SCOPE_SUBTREE = 1000
dim strname
dim strdist
dim dtmvalue
on error resume next
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.CommandText = "SELECT distinguishedName, profilepath, name from 'LDAP://dc=Example,dc=com' where objectCategory = 'User'"
Set objuserRecordSet = objCommand.Execute
objUSerRecordSet.MoveFirst
Do Until objuserRecordSet.EOF
strdist = objuserRecordSet.Fields("distinguishedName").Value
strname = objuserRecordSet.Fields("name").Value
Set objUserLDAP = GetObject _
("LDAP://" & strdist)
intCurrentValue = objUserLDAP.Get("userAccountControl")
dtmValue = objUserLDAP.PasswordLastChanged
If intCurrentValue and ADS_UF_DONT_EXPIRE_PASSWD Then
x = "The password does not expire."
Else
Set objDomainNT = GetObject("WinNT://escc.gov.uk")
intMaxPwdAge = objDomainNT.Get("MaxPasswordAge")
If intMaxPwdAge < 0 Then
x = "Password does not expire"
Else
intMaxPwdAge=intMaxPwdAge/86400
strold = ((dtmValue + intMaxPwdAge)-now)
if strold < 2 and strold > 0 then
objUserLDAP.pwdLastSet = 0
objUserLDAP.SetInfo
end if
end if
End If
dtmValue= ""
objuserrecordset.movenext
Loop