How to Connect Multiple Domains from HTA Scripting via LDAP

Hi All,

I'm currently working to create one single HTA script to manage User Accounts on Multiple domain, based on the User selection. Here is my sample script,

strUser = txt.value
If strUser = vbNullString then
MsgBox "Please Enter the User Name to Proceed", 16, "Check User details"
End If
If rbtn1.Checked Then
strDomain = "Domain1"
End If
If rbtn2.Checked Then
strDomain = "Domain2"
End If
If rbtn3.Checked Then
strDomain = "Domain3"
End If
If rbtn4.Checked Then
strDomain = "Domain4"
End If
Set objUser = GetObject("WinNT://"& strDomain &"/" & strUser & "")
If Err.Number <> 0 Then
MsgBox (strUser) & " isn't a valid user name!", 48,"User Details"
Wscript.Quit
End If
Err.Clear
If objUser.IsAccountLocked=0 Then
strLocsta = "Not Locked"
else
strLocsta = "Locked"
End if

Here i have used buttons for selecting the domain, based on the button selection the respective domains will be selected.

Here is my trouble. Say im using this script on the Server which is part of Domain1 and from the same machine i could able to access Domain2 for which 389 Port were enabled using dsa.msc.

But when i use this script i could only able to get informations of the users on Domain1, if i select Domain2 im getting Network Path not found. 

I'm looking for an option, where i can specify the domain controllers to get authenticate and retrieve users or is there anyway to overcome this problem.

Objective is that i need to get connected to the both domain controllers and get the users information. Kindly help me with some examples or syntax.

Regards,

September 10th, 2015 1:16am

You are not going to be able to do what you want using this method.]

I recommend that you start by learning how to script AD using PowerShell.

Here are many scripts that will help you to learn how to write AD scripts.

https://gallery.technet.microsoft.com/scriptcenter/site/search?f%5B0%5D.Type=RootCategory&f%5B0%5D.Value=activedirectory&f%5B0%5D.Text=Active%20Directory

Free Windows Admin Tool Kit Click here and download it now
September 10th, 2015 1:26am

Thanks jrv
September 10th, 2015 1:34am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics