Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Admin being notified of Users' PW changes

Status
Not open for further replies.

csudougie

MIS
Dec 15, 2006
37
Hello,
I am an Admin and we ask our users to notify us of network password changes so we can keep our database updated. However, users usually forget to inform us when they change their passwords and if we need to access their account while they are away, we have to reset their password.

Are there scripts available that email admins when a user changes their network password?? Any help.
 
Well you could script it but the whole idea is that no one else knows the users password (for their protection), if you need access to their work then log on to the server as an admin or reset their password.
 
Well, we do keep track of the passwords, and its known company wide that IT is able to know their passwords. However, sometimes its as simple as logging on to their machine to fix a problem with outlook or something or to change a setting and if they're not there, it slows us down. Logging on to the server is not always the solution. And we want to PREVENT resetting of passwords. If you know of a script, it would be helpful.
 
Here is a VB Script that Markdmac posted in another thread that will allow you to reset passwords, i should think that someone in the VB forum forum329 could advise on how you might get the input emailed to an account or written to a location.

Code:
'==========================================================================
'
' NAME: ResetPasswordFromList.vbs
'
' AUTHOR: Mark D. MacLachlan , The Spider's Parlor
' URL: [URL unfurl="true"]http://www.thespidersparlor.com[/URL]
' DATE  : 3/4/2005
'
' COMMENT: reads a list of users and resets the passwords.
'
'==========================================================================
On Error Resume Next
Dim objuser, newpass, UserLDAP, lngFlag
Const ADS_UF_DONT_EXPIRE_PASSWD = &H10000

'open the file system object
Set oFSO = CreateObject("Scripting.FileSystemObject")
set WSHShell = wscript.createObject("wscript.shell")
'open the data file
Set oTextStream = oFSO.OpenTextFile("ulist.txt")
'make an array from the data file
UserList = Split(oTextStream.ReadAll, vbNewLine)
'close the data file
oTextStream.Close
For Each oUser In UserList

    Set objuser = "LDAP://" & SearchDistinguishedName(oUser)
    
    newpass = "NewPasswordHere"
    'Require User to change password at next logon? Y Or N
    changenextlogin = "Y"
     
    objUser.SetPassword newpass
    
    If changenextlogin <> "N" Then
        objUser.Put "PwdLastSet", 0
    End If
    
    objUser.SetInfo
    
    lngFlag = objUser.Get("userAccountControl")
    If (lngFlag And ADS_UF_DONT_EXPIRE_PASSWD) <> 0 Then
    lngFlag = lngFlag Xor ADS_UF_DONT_EXPIRE_PASSWD
    objUser.Put "userAccountControl", lngFlag
    objUser.SetInfo
    End If
Next


Public Function SearchDistinguishedName(ByVal vSAN)
    ' Function:     SearchDistinguishedName
    ' Description:  Searches the DistinguishedName for a given SamAccountName
    ' Parameters:   ByVal vSAN - The SamAccountName to search
    ' Returns:      The DistinguishedName Name
    ' Thanks to Tek-Tips user Kob3 for this function.
    Dim oRootDSE, oConnection, oCommand, oRecordSet

    Set oRootDSE = GetObject("LDAP://rootDSE")
    Set oConnection = CreateObject("ADODB.Connection")
    oConnection.Open "Provider=ADsDSOObject;"
    Set oCommand = CreateObject("ADODB.Command")
    oCommand.ActiveConnection = oConnection
    oCommand.CommandText = "<LDAP://" & oRootDSE.get("defaultNamingContext") & _
        ">;(&(objectCategory=User)(samAccountName=" & vSAN & "));distinguishedName;subtree"
    Set oRecordSet = oCommand.Execute

    On Error Resume Next
    SearchDistinguishedName = oRecordSet.Fields("DistinguishedName")
    On Error GoTo 0
    oConnection.Close
    Set oRecordSet = Nothing
    Set oCommand = Nothing
    Set oConnection = Nothing
    Set oRootDSE = Nothing
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top