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.
It doesn’t work on chrome and if security is high on IE than it will not work on IE too.
Yes, because of the ActiveX control used.