Does anyone have a script or an idea about how to get the exchage server name from Active directory for a user currently logged on?
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
This link has a bunch of good info.

Scripting Exchange Using VBScript and ADSI
Answered 12/13/2005 by: Garrett
Orange Belt

Please log in to comment
0
Try this. It's a little more than you asked for but maybe someone else can use it.

Replace EditHere with samAccount Info. And replace YourCompany with the correct dc= info for your company.



On Error Resume Next
UserNumber = "EditHere"
Set RS = CreateObject("ADODB.Recordset")
RS.open "<LDAP://cn=users,dc=YourCompany,dc=com>;(&(ObjectClass=User)(samAccountName=" & UserNumber & "));adspath;subTree", "provider =ADsDSOObject"
Set User = GetObject(RS.fields("adspath"))

Wscript.echo "Properties For :" & User.FullName&" "
Wscript.echo "CN for : " & User.Name&" "
Wscript.echo "FullName "& User.FullName&" "
Wscript.echo "FirstName "& User.FirstName&" "
Wscript.echo "LastName "& User.LastName&" "
Wscript.echo "EmailAddress "& User.EmailAddress&" "
Wscript.echo "TelephoneMobile "& User.TelephoneMobile&" "
Wscript.echo "TelephoneNumber "& User.TelephoneNumber&" "
Wscript.echo "TelephonePager "& User.TelephonePager&" "
Wscript.echo "FaxNumber "& User.FaxNumber&" "
Wscript.echo "OfficeLocations "& User.OfficeLocations&" "
Wscript.echo "Division "& User.Division&" "
Wscript.echo "Department "& User.Department&" "
Wscript.echo "Description "& User.Description&" "
Wscript.echo "Exchange Server "& User.msExchHomeServerName&" "
Wscript.echo "Manager "& User.Manager&" "
Wscript.echo "Title "& User.Title&" "
Wscript.echo "EmployeeID "& User.EmployeeID&" "
Wscript.echo "HomeDirectory "& User.HomeDirectory&" "
Wscript.echo "LastLogin "& User.LastLogin&" "
Wscript.echo "LastLogoff "& User.LastLogoff&" "
Wscript.echo "LoginScript "& User.LoginScript&" "
Wscript.echo "OtherName "& User.OtherName&" "
Wscript.echo "PasswordLastChanged "& User.PasswordLastChanged&" "
Wscript.echo "Profile "& User.Profile&" "
Wscript.echo "LastFailedLogin "& User.LastFailedLogin&" "
Wscript.echo "AccountDisabled "& User.AccountDisabled&" "
Wscript.echo "IsAccountLocked "& User.IsAccountLocked&" "
Wscript.echo "AccountExpirationDate "& User.AccountExpirationDate&" "
Wscript.echo "BadLoginCount "& User.BadLoginCount&" "
rs.close
Answered 12/13/2005 by: Byoung4now
Senior Yellow Belt

Please log in to comment
Answer this question or Comment on this question for clarity