Error authenticating to AD during deployment; can't seem to query AD
New to K2000;
I have been attempting to build a pre-install HTA to gather info from techs as they deploy various models.
I am converting something that I had previously working with SCCM. However when I attempt to query AD to check that a user exists,
or to bind to an OU to check for a computer object, I get an error, "domain not found, or is not responding" when running via K2000 deployment -
in mid-level or post install tasks.
However, if I test the script form a PC, I get no errors.
I also just decided to just use the provided join domain PowerShell script and .bat file; filled in the required info and that is not working either.
We do have LDAP setup and working for authentication to the K2000 itself; but am I missing some other step that is preventing me from connecting to AD
during a deployment?
Here is part of the code I am using:
CONST ADS_SECURE_AUTHENTICATION = &H0001
CONST ADS_SERVER_BIND = &H0200
CONST ADS_SCOPE_SUBTREE = 2
CONST strSCCMStageOU = "OU=MyOSD,OU=Ops,DC=Fabricam,DC=com"
DIM OSDUserName, OSDAddAdmin, OSDDestOU, OSDCompName
DIM strADSPath, strComputerDN, strAccount, strPwrd
DIM objRootDSE, strDomain, objConnection, objCommand, objRecordSet, strDN
.
.
.
.
' Get domain components
Set objRootDSE = GetObject("LDAP://RootDSE")
strDomain = objRootDSE.Get("DefaultNamingContext")
' Set ADO connection
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
' Set ADO command
Set objCommand = CreateObject("ADODB.Command")
Set objCommand.ActiveConnection = objConnection
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.CommandText = "SELECT distinguishedName FROM 'LDAP://" & strDomain & "' WHERE objectCategory='user' AND samAccountName = '" & OSDUserName & "'"
' Set recordset to hold the query result
Set objRecordSet = objCommand.Execute
I get the error at the following line:
Set objRootDSE = GetObject("LDAP://RootDSE")
Thanks for any help or ideas.
jboehlke
5 Comments
[ + ] Show comments
Answers (0)
Please log in to answer
Be the first to answer this question
No such file or directory (http://ipxe.org/2d0c613b) Could not boot: No such file or directory (http://ipxe.org/2d0c613b). I saw that there is an issue with non-windows KBE not working in 4.1, but this is windows and should still work, correct? - jboehlke 7 years ago
Set objRootDSE = GetObject("LDAP://RootDSE").
Is there something else I need to add to the KBE? - jboehlke 7 years ago