I am trying to query AD from Windows PE 3 (based on Windows 7).
My script works in Win 7 and XP, but I am aware there are issues with PE so need to modify the script.
I am aware that HTA cannot query with ADO, so I am just running a stand alone script.
I have added the Winpe-MDAC component to winpe (I also have HTA,WMI,WSH components as well).
I have also disabled the firewall, just in case...
Here is what I have (names changed to protect the innocent).
username = "myname" DOMAIN = "myDCNAME/DC=subdomain,DC=domain,DC=com" Set ADConn = CreateObject("ADODB.Connection") ADConn.Provider = "ADSDSOObject" ADConn.Properties("User ID") = "mydomain\myadreadableuser" ADConn.Properties("Password") = "mypass" AdConn.Properties("Encrypt Password") = true ADConn.Open "ADs Provider" query = "<LDAP://" & DOMAIN & ">;(&(objectclass=user)(sAMAccountName=" & username & "));distinguishedName;subtree" Set ADrs = ADConn.Execute(cstr(query)) IF NOT ADrs.EOF Then WScript.Echo ADrs("distinguishedName") End If
So I get the error 80040E37 on the execution of the code.
Any suggestions why this wont work?
How can I check that I have all needed components?
[EDIT REASON : Added Solved to title!]
Edited by mrbeatnik, 27 May 2010 - 08:51 AM.