/build/static/layout/Breadcrumb_cap_w.png

Script to retrive exchange server name

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

Answers (2)

Posted by: Garrett 19 years ago
Orange Belt
0
This link has a bunch of good info.

Scripting Exchange Using VBScript and ADSI
Posted by: Byoung4now 19 years ago
Senior Yellow Belt
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
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ