Re: Last Password Changed..

From: chinn (chinn_at_discussions.microsoft.com)
Date: 01/16/05


Date: Sun, 16 Jan 2005 13:13:08 -0800

Hey ..
That works great.Is there a way i can put some comments in my
inputfile so that they show up in the output.

"Corné Bogaarts" wrote:

> Haven't been able to test it, but this should probably work:
>
> '********************************************************************
> '* Version Date Name
> Comment
> '* v.0.9 23 dec '04 Corné Bogaarts Should work,
> not tested
> '*
> '********************************************************************
>
> Option Explicit
> On Error Resume Next
>
> Dim strLdapPath, dtmValue, i, strNextLine, strUserName
>
> Dim objDictionary, objFSO, objTextFile, objLogFile, objRootDSE,
> Dim objADConnection, objItem, objUser
>
> Const ForReading = 1
> Const OverWrite = True
>
> Set objDictionary = CreateObject("Scripting.Dictionary")
> Set objFSO = CreateObject("Scripting.FileSystemObject")
> Set objTextFile = objFSO.OpenTextFile ("C:\ldappaths.txt", ForReading)
> Set objLogFile = objFSO.CreateTextFile ("C:\LastPasswordReset" & _
> Date & ".txt", OverWrite)
> Set objRootDSE = GetObject("LDAP://rootDSE")
> Set objADConnection = CreateObject("ADODB.Connection")
> objADConnection.Open "Provider=ADsDSOObject;"
>
> i = 0
> Do Until objTextFile.AtEndOfStream
> strNextLine = objTextFile.Readline
> objDictionary.Add i, strNextLine
> i = i + 1
> Loop
>
> For Each objItem in objDictionary
> strLdapPath = objDictionary.Item(objItem)
>
> Set objUser = GetObject (strLdapPath)
> strUserName = objUser.Get("displayName")
> dtmValue = objUser.PasswordLastChanged
>
> WScript.Echo "Password for " & strUserName & _
> "last changed on " & dtmValue & "."
> objLogFile.Writeline ("Password for " & strUserName & _
> "last changed on " & dtmValue & ".")
> Next
>
> ===================================
>
> Copy and paste it in a texteditor, save it as PassworReset.vbs and run
> it with "cscript passwordreset.vbs".
>
>
> Hope this helps,
>
> Corné
>
> On Tue, 21 Dec 2004 06:51:01 -0800, "chinn"
> <chinn@discussions.microsoft.com> wrote:
>
> >I got the below script form scripting site on Microsoft.I want to modify this
> >such that i
> >have ldap paths in one file for the users i want to see when the password was
> >changed last.Is that possible if so can anybody help me with that.
> >
> >I will put all my ldappaths in C:\ldappaths.txt and the script will read the
> >paths
> >from the file and loop untill it finishes to read all the paths in the file
> >and
> >writes the output to the file .
> >
> >My Output File should be like this..
> >
> >Password Last Changed for this user on ....
> >Password Last Changed for this user on ....
> >Password Last Changed for this user on ....
> >
> >
> >
> >Set objUser = GetObject _
> > ("LDAP://CN=myerken,OU=management,DC=Fabrikam,DC=com")
> >
> >dtmValue = objUser.PasswordLastChanged
> >WScript.Echo "Password last changed: " & dtmValue
> >
> >
> >Thanks
>
> --- --- --- --- --- --- ---
> Most answers can be found in the Schedule+ FAQ: http://www.xs4all.nl/~bogaarts/schdmenu.htm.
> Please reply to the newsgroup. For reasons of Spam, I won't be including my E-mail address anymore.
>



Relevant Pages

  • Re: Last Password Changed..
    ... Dim strLdapPath, dtmValue, i, strNextLine, strUserName ... Dim objDictionary, objFSO, objTextFile, objLogFile, objRootDSE, ...
    (microsoft.public.windows.server.scripting)
  • Seek method in File System object
    ... Dim AppStr As String ... Dim strNextLine As String ... Set objTextFile = objFSO.OpenTextFile(Form1.Text1.Text, ForReading) ...
    (comp.lang.basic.visual.misc)
  • Re: Help with script to add user and groups from text file
    ... no its not that mate, it creates the first user okay, and sets the users ... 'WScript.Echo strNextLine' ... >> folder default folder under domain contains SalesGroup ... >> Dim objUser ...
    (microsoft.public.scripting.vbscript)
  • Re: Help with script to add user and groups from text file
    ... i still get error line43, no such object on server, even though the Users CN ... folder default folder under domain contains SalesGroup ... Dim objUser ... Dim strNextLine ...
    (microsoft.public.scripting.vbscript)