Apr 302011
 

Hi all,

Just a follow up post to the last post regarding modifying users in AD via Javascript.
You need a Domain Name in the following code snippet –


objUserDN.Init(1,"DOMAIN NAME HERE");
objUserDN.Set(3,"DOMAIN NAME HERE\\"+strUsername);

Now what if you wanted to use the script for multiple domains without having to modify the code to change the domain name ?
You can use ActiveX with a Windows Script Host function to get the domain name as well !
To get it, you can simply use the following code snippet :


wshell=new ActiveXObject("wscript.network");
var strDomain = wshell.userdomain;

With that code, strDomain will now contain the NetBIOS Domain name which is used here.

Share

  2 Responses to “How to Find the Domain Name on a Computer Using Javascript”

  1. It doesn’t work on chrome and if security is high on IE than it will not work on IE too.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

This site uses Akismet to reduce spam. Learn how your comment data is processed.