mikedotm
asked on
Need a script that will identify users with first initial last name email address
Does anyone have, or know of a script or something that can search through AD and identify users that
have an email address of first initial last name @domain.com. I have tried csvde but the best I can do with that is export out proxy addresses which takes too much information. We are trying to phase out email addresses that are first initial last name and go with firstname.lastname for everyone. Many still have
the legacy first initial lastname email address.
have an email address of first initial last name @domain.com. I have tried csvde but the best I can do with that is export out proxy addresses which takes too much information. We are trying to phase out email addresses that are first initial last name and go with firstname.lastname for everyone. Many still have
the legacy first initial lastname email address.
ASKER
This looks interesting. How would I run it? Do I need to specify a search base when I run it?
Name it as FindUsers.vbs and just double-click on it - it should work based upon your criteria...
ASKER
Did you test this? I got a number of errors. Some I was able to fix but because I don't understand VB,
I was not able to continue.
I was not able to continue.
Can you post the error(s) as well as the line # it occurred on.
I did test it, but I had to copy it by hand onto my home PC, from my work PC, so I sometimes mistype something...
I did test it, but I had to copy it by hand onto my home PC, from my work PC, so I sometimes mistype something...
ASKER
This is what I get when I run it.
C:\>cscript findusers.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
C:\findusers.vbs(23, 5) Microsoft VBScript runtime error: Object not a collection
C:\>
Thanks much!!
C:\>cscript findusers.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
C:\findusers.vbs(23, 5) Microsoft VBScript runtime error: Object not a collection
C:\>
Thanks much!!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Happy to help - thanx for the grade! :^)
Dim objRoot:Set objRoot=GetObject("LDAP://
Dim objDomain:Set objDomain=GetObject("LDAP:
EnumOUs(objDomain.ADsPath)
Sub EnumOUs(adspath)
Dim objOUs, OU
Set objOUs=GetObject(adspath)
objOUs.Fileter=Array("Orga
Call EnumUsers(objOUs.ADsPath)
For Each OU in objOUs
Call EnumOUs(OU.ADsPath)
Next
End Sub
Sub EnumUsers(adspath)
Dim objUsers, User
Set objUsers=GetObject(adspath
objUsers.Filter=Array("Use
For Each User in objUsers
strFI=Left(User.givenName,
strLN=User.sn
For Each addr in User.proxyAddresses
If mid(addr,instr(addr,":")+1
wscript.echo User.givenName & " " & User.sn & " has the email address that you're looking for!"
End If
Next
Next
End Sub