# Getting DisplayName out of Active Directory using JScript



## cjoyce1980 (Nov 30, 2007)

Does anyone know how to get DisplayName out of Active Directory using JScript

Would like to intergrate this is into a html page, so the user currently in session would have there DisplayName on show.


----------



## Solaris17 (Nov 30, 2007)

http://techrepublic.com.com/5208-11184-0.html?forumID=57&threadID=187339&messageID=1919069?


----------



## Namslas90 (Nov 30, 2007)

Try here;

http://www.microsoft.com/technet/scriptcenter/scripts/jscript/default.mspx?mfr=true


----------



## cjoyce1980 (Nov 30, 2007)

thanks guys but i hit both of those sources early and i'm still having no luck, i guess i'll still have to keep googling!


----------



## Kreij (Nov 30, 2007)

This Link seems to be more complete than the others.

It is in VBS, but the port to JScript should not be to hard.

Hope it helps


----------



## cjoyce1980 (Nov 30, 2007)

its a little above and beyond what i need to do, but it's still not returning me the display.  I'm getting the FQ user name (i.e. cn=user, ou=users, dn=domain, dn=com)


----------



## Kreij (Nov 30, 2007)

Why don't you paste your code here so we can take a look at it.
We love to help people with code problems (or at least I do).


----------



## cjoyce1980 (Nov 30, 2007)

Kreij said:


> Why don't you paste your code here so we can take a look at it.
> We love to help people with code problems (or at least I do).



i wish i could give you my code, but i left work about 2 hours ago and silly me the code is on my pc's HDD and i can't remote wake it up


----------



## Kreij (Nov 30, 2007)

Lol ... I've been in that situation before.

Oh well, it's the weekend and you should be planning on doing something entertaining, not worrying about code that will certainly wait until Monday.


----------



## cjoyce1980 (Nov 30, 2007)

i know but i've not been able to switch off yet, never mind i'll annoy you guys on monday then


----------



## cjoyce1980 (Dec 3, 2007)

Right, here is my code currently.

What i'm trying to do it is to make a small javascript within a html signature, so that my exhange email clients (outlook) all have the same disclaimer apart from there AD display name and email address.

so the output should look something like this:

Joe Brown
joe@mydomain.com

I can do the email address part (which is simply the users name and the domain name), but i'm not able to get the displayname out of AD.


```
<HTML>
	<HEAD>
		<script language=javascript>
		<!--
		var wshshell = new ActiveXObject("wscript.shell");
		var username = wshshell.ExpandEnvironmentStrings("%username%");
		var hostname = "domainame";
		var linktext = username + "@" + hostname;
		document.write(displayname + "<br>")
		document.write("<a href=" + "mail" + "to:" + username + "@" + hostname + ">" + linktext + "</a>") 
		-->
		</script>
	</HEAD>
</HTML>
```


----------

