This blog is by design...

Thursday, September 01, 2005

Search your domain for a particular smtp email address, or 'proxyAddresses'

'********************************************
'script to search a domain for a particular SMTP address. searches
'users, groups and public folders. might not search against default
'users container, i don't use it and didn't test against it.
'Just modify the strAddress line to contain the address you're searching for
'thanks to EE's Chris-Dent for his OURecurse subroutine
'written by EE's kristinaw, 05/20/05

strAddress = lcase("SMTP:kris@norfolk.gov")
strFound = FALSE

Set objRootDSE = GetObject("LDAP://rootDSE")
Set objDomainRoot = GetObject("LDAP://"& _
objRootDSE.Get("defaultNamingContext"))

wscript.Echo "Searching for address "& strAddress

For Each objItem in objDomainRoot
If strFound = FALSE Then
'wscript.Echo objitem.Name
If objItem.Class="organizationalUnit" Then
'wscript.Echo objItem.ADSPath
OURecurse objItem.ADSPath
End If

If objItem.Class="user" Then
'wscript.Echo objItem.name
ProcessUsers objItem
End If

If objItem.Class="group" Then
ProcessUsers objItem
End If

'The below portion of code searches public folders
If objItem.cn ="Microsoft Exchange System Objects" then
'wscript.Echo objItem.Name
OURecurse objItem.ADSPath
End If
End If
Next

wscript.Echo "All Done"

Set objRootDSE = Nothing
Set objDomainRoot = Nothing


'**********************************************
Sub ProcessUsers(objUsers)
On Error Resume Next

'wscript.Echo objUsers.Name
set objProxy = GetObject("LDAP://"& objUsers.distinguishedName)
For Each proxyAddresses in objProxy.GetEx("proxyAddresses")
If lcase(proxyAddresses) = strAddress then
If objProxy.Class="publicFolder" then

wscript.Echo "Proxy address "& _
strAddress &" is assigned to a Public Folder named '"& _
objProxy.displayName &"', "&"in Public Folder Path "& _
objProxy.folderPathname

Else

wscript.Echo "Proxy address "& _
strAddress &" is assigned to the user or group "& _
"with a samAccountName of '"& objProxy.saMAccountName & _
"' and a display name of "& objProxy.displayName

End If
strFound = TRUE
End If
Next

set objProxy = Nothing

End Sub


'**********************************************
Sub OURecurse(objFirst)

' This OU is responsible for going through the AD Structure

Dim objOrgUnit, objItem

Set objOrgUnit = GetObject(objFirst)
For Each objItem in objOrgUnit
If objItem.Class="user" Then
'wscript.Echo objItem.Name
ProcessUsers objItem
End If

If objItem.Class="group" Then
ProcessUsers objItem
End If

If objItem.Class="publicFolder" Then
ProcessUsers objitem
End If

If objItem.Class="organizationalUnit" Then
'wscript.Echo objItem.Name
OURecurse objItem.ADSPath
End If
Next

Set objOrgUnit = Nothing
Set objFirst = Nothing

End Sub


'********************************************

26 Comments:

  • Kris,
    I have been looking for a script that would locate an email address in my Exchange Server as I wanted to add the email address to an existing user and I kept getting an error saying that it already existed, which really confused me.

    Thanks to your script I have discovered a Public Folder that has the email address and was stopping me from adding it to the user.

    Brilliant piece of work that saved me hours of trying to find it by more traditional methods.

    Siv
    (Graham Sivill)
    Martley, Near Worcester, UK.

    By Blogger Siv, at 7:41 PM  

  • I know this is an old post but I have to say, YOU ROCK!! Thank you. Awesome scripts.

    By Blogger Kevin Dondrea, at 8:18 PM  

  • Laying perfectly may not be a very important thing to your rear. Slouching can seem to be instead soothing, but it is significant to avoid this since it performs your muscle mass more challenging than it can when you do not slouch. [url=http://www.ss12w12ws.info]Hou4445r[/url]

    By Anonymous Anonymous, at 5:33 PM  

  • Excellent post. I certainly appreciate this website. Stick with it!


    my web page: diet plan to lose weight

    By Anonymous Anonymous, at 4:29 AM  

  • Hi mates, how is the whole thing, and what you wish for to say
    concerning this article, in my view its genuinely remarkable in favor of me.


    My weblog; Jackpot 6000 free

    By Anonymous Anonymous, at 9:15 PM  

  • Undeniably believe that which you stated. Your favorite reason seemed to be on the internet the simplest thing to be aware
    of. I say to you, I definitely get irked while people
    think about worries that they just don't know about. You managed to hit the nail upon the top and defined out the whole thing without having side-effects , people could take a signal. Will probably be back to get more. Thanks

    My weblog: acai ultra lean diet

    By Anonymous Anonymous, at 3:00 AM  

  • Do you mind if I quote a few of your posts as
    long as I provide credit and sources back to your site?
    My website is in the very same niche as yours and my visitors would definitely benefit from
    a lot of the information you provide here. Please let me know if this alright with you.
    Thanks a lot!

    my web page :: power pump muscle builder

    By Anonymous Anonymous, at 8:22 AM  

  • I always used to read piece of writing in news papers but now as I am a user
    of net thus from now I am using net for articles, thanks to web.


    My homepage: garcinia cambogia review

    By Anonymous Anonymous, at 2:48 PM  

  • I think this is among the such a lot vital info for me.
    And i am glad reading your article. However want to remark on few general issues, The site taste is wonderful, the articles is
    in reality excellent : D. Just right activity, cheers

    Here is my web-site ... 1285 muscle review

    By Anonymous Anonymous, at 1:46 AM  

  • My partner and I stumbled over here by a different
    website and thought I may as well check things out.
    I like what I see so now i am following you.
    Look forward to finding out about your web
    page for a second time.

    my web site :: Best Wrinkle Creams

    By Anonymous Anonymous, at 10:45 AM  

  • Hi there very nice web site!! Guy .. Excellent .
    . Wonderful .. I'll bookmark your web site and take the feeds additionally? I am satisfied to search out numerous useful information right here within the post, we need develop extra techniques in this regard, thank you for sharing. . . . . .

    Also visit my webpage - Buy Anatomy X5

    By Anonymous Anonymous, at 7:33 PM  

  • Your style is so unique in comparison to other folks I've read stuff from. I appreciate you for posting when you have the opportunity, Guess I will just bookmark this page.

    my web page: Hard knight reviews

    By Anonymous Anonymous, at 8:02 PM  

  • Unquestionably believe that which you said. Your
    favorite reason appeared to be on the internet the easiest thing to be aware of.

    I say to you, I certainly get irked while people think about worries that they
    just do not know about. You managed to hit the nail upon the top as well as defined out the whole thing without having
    side effect , people could take a signal. Will likely be back to get more.
    Thanks

    My blog ... garcinia cambogia review

    By Anonymous Anonymous, at 9:46 PM  

  • Thank you a bunch for sharing this with all of us you actually know what
    you're speaking about! Bookmarked. Please also consult with my website =). We could have a link trade arrangement between us

    my blog post; Garcinia Cambogia Diet

    By Anonymous Anonymous, at 11:39 PM  

  • What's up, yeah this article is truly nice and I have learned lot of things from it on the topic of blogging. thanks.

    Also visit my web site - Buy Raspberry Ketone

    By Anonymous Anonymous, at 7:43 AM  

  • Please let me know if you're looking for a author for your weblog. You have some really great posts and I feel I would be a good asset. If you ever want to take some of the load off, I'd love to write
    some articles for your blog in exchange for a link back to mine.
    Please blast me an e-mail if interested. Thank you!


    my web blog :: Revitalize

    By Anonymous Anonymous, at 9:23 PM  

  • I don't leave a lot of remarks, but i did a few searching and wound up here "Search your domain for a particular smtp email address, or 'proxyAddresses'". And I do have a couple of questions for you if it's allright.
    Is it only me or does it look like a few of these
    comments appear like written by brain dead people? :-P And,
    if you are posting at other sites, I'd like to keep up with anything new you have to post. Would you list of the complete urls of your social sites like your Facebook page, twitter feed, or linkedin profile?

    Here is my web site: jackpot 6000 gratis slot - http://rupgermany.bplaced.net/wiki/index.php?title=Benutzer:MurielSan -

    By Anonymous Anonymous, at 10:02 PM  

  • Simply want to say your article is as surprising.

    The clearness in your publish is simply nice and i could think you are a professional on this subject.
    Well together with your permission allow me to
    clutch your feed to stay updated with approaching post.
    Thanks 1,000,000 and please continue the enjoyable work.


    my blog post :: Paving Contractor Minnesota

    By Anonymous Anonymous, at 6:33 AM  

  • Wonderful website you have here but I was curious if
    you knew of any forums that cover the same topics talked
    about in this article? I'd really love to be a part of online community where I can get responses from other experienced people that share the same interest. If you have any suggestions, please let me know. Thanks!

    My homepage; Green tone pro review\ Green tone pro reviews

    By Anonymous Anonymous, at 10:53 PM  

  • Ӏ'm extremely impressed with your writing skills and also with the layout on your blog. Is this a paid theme or did you modify it yourself? Either way keep up the excellent quality writing, it's rare tο sеe а great blog lіke this onе these days.


    Ϻy homepagе: nummerupplysningen.se

    By Anonymous Anonymous, at 9:05 PM  

  • Hmm it appears like yоur ѕitе ate mу first comment (іt was extremelу long) so I gueѕs
    I'll just sum it up what I wrote and say, I'm thοroughly enjoying yοur blog.
    I tοo am an aspiring blog writer but I'm still new to everything. Do you have any tips and hints for newbie blog writers? I'd gеnuinely appгeciate it.


    Alsо ѵisit my web site :: rhinoplasty surgery

    By Anonymous Anonymous, at 3:26 AM  

  • By Blogger ahmedshah, at 6:50 AM  

  • By Blogger ahmedshah, at 6:50 AM  

  • Its main element is the draw out of the results peel of Garcinia cambogia extract.
    Try eating fewer processed fruits like potato chips,
    bacon, frozen dinners, and processed fillets that are high in sodium.

    By Anonymous Anonymous, at 9:26 PM  

  • What's up, after reading this remarkable post i am also happy to share my knowledge here with mates.


    Here is my weblog :: motorcycle accident lawyer

    By Anonymous Anonymous, at 6:56 PM  

  • By Anonymous Anonymous, at 5:55 PM  

Post a Comment

<< Home