![]() |
Suggestion, Password expires |
Post Reply
|
| Author | |
chris2012
Newbie
Joined: 24 November 2012 Status: Offline Points: 3 |
Post Options
Thanks(0)
Quote Reply
Topic: Suggestion, Password expiresPosted: 24 November 2012 at 9:30am |
|
hi all,
we love BGInfo because our User don't find the hostname without BGINFO and we need the hostname to remote desktop. Now we show the Hostname on Desktop and it is easy on telephon to tell it the service desk. We run bginfo daily at logon. We have a suggestion: If It was posible, it would be helpful for many people to see the password expires time. Example: if you go into the holiday and your password expired you can't sync mails with handy. But if you see that you password will expired on the next 10 days you will change it manually. thanks.
|
|
![]() |
|
Reiniger
Newbie
Joined: 05 December 2012 Status: Offline Points: 7 |
Post Options
Thanks(0)
Quote Reply
Posted: 05 December 2012 at 5:04pm |
|
You have to change this a bit.
Now it is standalone and it opens a requester with the infos. Gruß, Chris
|
|
![]() |
|
WindowsStar
Senior Member
Joined: 30 June 2010 Status: Offline Points: 497 |
Post Options
Thanks(0)
Quote Reply
Posted: 05 December 2012 at 11:05pm |
|
Here is another:
|
|
![]() |
|
chris2012
Newbie
Joined: 24 November 2012 Status: Offline Points: 3 |
Post Options
Thanks(0)
Quote Reply
Posted: 06 December 2012 at 9:06am |
|
how can I connect BG-INFO and your code?I have found also a little bit smaler version
On Error Resume Next Const ADS_UF_DONT_EXPIRE_PASSWD = &h10000 Const E_ADS_PROPERTY_NOT_FOUND = &h8000500D Const ONE_HUNDRED_NANOSECOND = .000000100 Const SECONDS_IN_DAY = 86400 Const NO_EXPIRE = 99999 '************************************************************** '* Function to get number of days left before password change * '************************************************************** Function PasswordDaysLeft() 'Default to zero days left...an error can occur if the user 'is forced to change their password. This will cover that PasswordDaysLeft = 0 Set objADSystemInfo = CreateObject("ADSystemInfo") Set objUser = GetObject("LDAP://" & objADSystemInfo.UserName) intUserAccountControl = objUser.Get("userAccountControl") If intUserAccountControl And ADS_UF_DONT_EXPIRE_PASSWD Then PasswordDaysLeft = NO_EXPIRE Exit Function Else dtmValue = objUser.PasswordLastChanged If Err.Number = E_ADS_PROPERTY_NOT_FOUND Then PasswordDaysLeft = NO_EXPIRE Exit Function Else intTimeInterval = Int(Now - dtmValue) End If Set objDomain = GetObject("LDAP://" & objADSystemInfo.DomainDNSName) Set objMaxPwdAge = objDomain.Get("maxPwdAge") If objMaxPwdAge.LowPart = 0 Then PasswordDaysLeft = NO_EXPIRE Exit Function Else dblMaxPwdNano = Abs(objMaxPwdAge.HighPart * 2^32 + objMaxPwdAge.LowPart) dblMaxPwdSecs = dblMaxPwdNano * ONE_HUNDRED_NANOSECOND dblMaxPwdDays = Int(dblMaxPwdSecs / SECONDS_IN_DAY) If intTimeInterval >= dblMaxPwdDays Then PasswordDaysLeft = 0 Else PasswordDaysLeft = Int((dtmValue + dblMaxPwdDays) - Now) End If End If End If End Function '************************************************************** '* Main Application Loop * '************************************************************** if PasswordDaysLeft() <= 7 then
MsgBox("Passwort expires in " & PasswordDaysLeft() & " days") end if |
|
![]() |
|
Reiniger
Newbie
Joined: 05 December 2012 Status: Offline Points: 7 |
Post Options
Thanks(0)
Quote Reply
Posted: 06 December 2012 at 12:31pm |
|
for 'my' script:
(I did not check the other scripts!) to get it run with BGInfo you have to: - replace wscript.echo with echo in the Script (6 Times) - create a bginfo config with a "Custom Field": Click Cutom..., click New..., name the Identifier: "CustomField Password", mark VBScript file, Browse to the VBSScript, Ok, Ok Chenge the BGInfo Text: Password Information: <CustomField Password> Thats it! Chris |
|
![]() |
|
Reiniger
Newbie
Joined: 05 December 2012 Status: Offline Points: 7 |
Post Options
Thanks(0)
Quote Reply
Posted: 06 December 2012 at 12:47pm |
|
bginfo text:
Password will expire in <CustomField Password> Chris Const SEC_IN_DAY = 86400 Const ADS_UF_DONT_EXPIRE_PASSWD = &h10000 Set objUserLDAP = GetObject _ ("LDAP://CN=testbenutzer,OU=Technik,OU=Koeln,DC=something,DC=com") intCurrentValue = objUserLDAP.Get("userAccountControl") If intCurrentValue and ADS_UF_DONT_EXPIRE_PASSWD Then Echo "The password does not expire." Else dtmValue = objUserLDAP.PasswordLastChanged rem Echo VbCrLf & "Last changed.: " & _ rem DateValue(dtmValue) & " " & TimeValue(dtmValue) & VbCrLf & _ rem "Last set....: " & int(now - dtmValue) & " days" intTimeInterval = int(now - dtmValue) Set objDomainNT = GetObject("WinNT://COMAG") intMaxPwdAge = objDomainNT.Get("MaxPasswordAge") If intMaxPwdAge < 0 Then Echo "The Maximum Password Age is set to 0 in the " & _ "domain. Therefore, the password does not expire." Else intMaxPwdAge = (intMaxPwdAge/SEC_IN_DAY) rem Echo VbCrLf & "The maximum password age is " & intMaxPwdAge & " days" If intTimeInterval >= intMaxPwdAge Then Echo "The password has expired." Else rem Echo VbCrLf & "Password will expire in : " & int((dtmValue + intMaxPwdAge) - now) & " days." Echo int((dtmValue + intMaxPwdAge) - now) & " days" End If End If End If Edited by Reiniger - 06 December 2012 at 12:48pm |
|
![]() |
|
WindowsStar
Senior Member
Joined: 30 June 2010 Status: Offline Points: 497 |
Post Options
Thanks(0)
Quote Reply
Posted: 06 December 2012 at 11:27pm |
|
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |