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.


 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>