Page 1 of 1 1
Topic Options
#169204 - 2006-10-11 02:23 PM Exchange Server Name
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
Does anyone have a UDF to pull the Exchange Server name from Active Directory?
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#169205 - 2006-10-11 02:52 PM Re: Exchange Server Name
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
hmmmm... never thought of that.

Lemme see

Top
#169206 - 2006-10-11 03:05 PM Re: Exchange Server Name
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
are you trying to get the exchange server for a given user acct or all exchange servers on the network?
Top
#169207 - 2006-10-11 03:09 PM Re: Exchange Server Name
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
all exchange servers on a given site
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#169208 - 2006-10-11 03:16 PM Re: Exchange Server Name
masken Offline
MM club member
*****

Registered: 2000-11-27
Posts: 1222
Loc: Gothenburg, Sweden
hmm... the Message Tracknig Center does this in the ESM (ESM > Tools > Mesage Tracking Center > Server...) by what seems to be a normal LPAD query. You can't see what it queries for though...
Top
#169209 - 2006-10-11 05:57 PM Re: Exchange Server Name
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Give this a go...

Code:

; == Return the Name of all Exchange Servers ====================
$aAttributes = "Name" ;, "AdsPath"
$sADsPath = "LDAP://"+GetObject("LDAP://rootDSE").Get("configurationNamingContext")
$strFilter = "(&(objectClass=msExchExchangeServer)(Name=*))"

$aResults = fnLDAPQuery($aAttributes,$sADsPath,$strFilter,"Name")
@ERROR " | " @SERROR ?

For $c = 0 to Ubound($aResults)
For $r = 0 to UBound($aResults,2)
$aResults[$c,$r] ?
Next
Next

Get $


Top
#169210 - 2006-10-11 06:26 PM Re: Exchange Server Name
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
I'm have a nametranslate issue...

Code:

$Userldap = TranslateName(1, @domain, 3, @ldomain+'\'+@userid, 1)
$UserProperties = GetObject("LDAP://"+$UserLDAP[0])

$DNMailServer = $UserProperties.Get("msExchHomeServerName")
? $DNMailServer
$Mailserver = TranslateName(1, @domain, 1, $DNMailServer , 3)

? "HomeServer is" + $MailServer[0]



$dnMailServer is returned as: /O=FLA GOV/OU=Domain/cn=Configuration/cn=Servers/cn=MAILServer

So I'm having trouble specifing the correct source translate type...

Top
#169211 - 2006-10-11 07:22 PM Re: Exchange Server Name
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Chris' code worked just fine for me Rad.
Top
#169212 - 2006-10-11 07:39 PM Re: Exchange Server Name
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
Chris, your code as usual works flawlessly. Thank you.
Is there a way to look at a specific site? Or maybe you have added that ability and I am just missing it.
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#169213 - 2006-10-11 07:39 PM Re: Exchange Server Name
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
yes... Chris' code lists all servers. My code returns the server configured for the acct.

I've kludged the problem by doing a substr() to pull the servername
$DNMailServer = $UserProperties.msExchHomeServerName
$MailServer = substr($DNMailServer,instrrev($DNMailServer,'=')+1)

Top
#169214 - 2006-10-11 07:44 PM Re: Exchange Server Name
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Hmm. You can probably narrow the ADsPath or widen the query filter to restrict the results by site.
Top
#169215 - 2006-10-11 07:49 PM Re: Exchange Server Name
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
I have never understood the filter thing could you elaborate on how the filter should be modified?
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#169216 - 2006-10-11 08:12 PM Re: Exchange Server Name
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Well, maybe you can filter it with the legacyExchangeDN property. Then you could adjust the filter like so...

Code:

; == Return the Name of all Exchange Servers ====================
$aAttributes = "Name", "legacyExchangeDN" ;, "distinguishedName"
$sADsPath = "LDAP://"+GetObject("LDAP://rootDSE").Get("configurationNamingContext")
$strFilter = "(&(objectClass=msExchExchangeServer)(legacyExchangeDN=*OH*))"

$aResults = fnLDAPQuery($aAttributes,$sADsPath,$strFilter,"Name")
@ERROR " | " @SERROR ?

For $c = 0 to Ubound($aResults)
For $r = 0 to UBound($aResults,2)
$aResults[$c,$r] ?
Next
Next


Top
#169217 - 2006-10-11 08:13 PM Re: Exchange Server Name
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
For filter search tips, see...

http://www.rlmueller.net/ADOSearchTips.htm

Top
#169218 - 2006-10-11 08:33 PM Re: Exchange Server Name
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
Sweet! thanks for the help guys.
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
Page 1 of 1 1


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.163 seconds in which 0.113 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org