mrbeatnik Posted May 27, 2010 Posted May 27, 2010 (edited) Hi folks.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") = trueADConn.Open "ADs Provider"query = "<LDAP://" & DOMAIN & ">;(&(objectclass=user)(sAMAccountName=" & username & "));distinguishedName;subtree"Set ADrs = ADConn.Execute(cstr(query))IF NOT ADrs.EOF ThenWScript.Echo ADrs("distinguishedName")End IfSo 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 May 27, 2010 by mrbeatnik
arwidmark Posted May 27, 2010 Posted May 27, 2010 Since it's WinPE you need to specify a domain controller to connect to. You also need to add the ADSI components as well. I have written ADSI plugins for WinPE 3.0 (x86 and x64) that you can download from this linkADSI Plugin for Windows PE 3.0 (x86 and x64) http://www.deployvista.com/Home/tabid/36/EntryID/127/language/sv-SE/Default.aspxThere is a sample script in the Plugin that will show you a working connection.
mrbeatnik Posted May 27, 2010 Author Posted May 27, 2010 Since it's WinPE you need to specify a domain controller to connect to. You also need to add the ADSI components as well. I have written ADSI plugins for WinPE 3.0 (x86 and x64) that you can download from this linkADSI Plugin for Windows PE 3.0 (x86 and x64) http://www.deployvista.com/Home/tabid/36/EntryID/127/language/sv-SE/Default.aspxThere is a sample script in the Plugin that will show you a working connection. Perfect.I was just missing the DLLs.Of course I would just assume the MDAC package would supply them...Thanks for reference. The INF file was really handy for the registration of the files.Thanks again!
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now