Login | |
|
 |
Win PE 2.0 getting an ADORecordSet Error - 4/30/2008 7:25:58 AM
|
|
 |
|
| |
BryanP
Posts: 2
Score: 0
Joined: 4/30/2008
Status: offline
|
I run an AD Query from Vista, XP I get the correct out put when I run the same script from WinPE 2.0 I am getting an error on the Line for Set adorecordset = adocommand.execute here is the full script which I pulled from another post on the forums. Dim objRootDSE, strDNSDomain, adoCommand, adoConnection Dim strBase, strFilter, strAttributes, strQuery, adoRecordset Dim strDN, strUser, strPassword, objNS, strServer Const ADS_SECURE_AUTHENTICATION = &H1 Const ADS_SERVER_BIND = &H200 ' Specify a server (Domain Controller). strServer = "ADC" ' Specify or prompt for credentials. strUser = "Domain\adminname" strPassword = "BLABLA" ' Determine DNS domain name. Use server binding and alternate ' credentials. The value of strDNSDomain can also be hard coded. 'Set objNS = GetObject("LDAP:") 'Set objRootDSE = objNS.OpenDSObject("LDAP://" & strServer & "/RootDSE", _ 'strUser, strPassword, _ 'ADS_SERVER_BIND Or ADS_SECURE_AUTHENTICATION) 'strDNSDomain = objRootDSE.Get("defaultNamingContext") strDNSDomain = "DC=Domain,DC=Rootdomain,DC=com" ' Use ADO to search Active Directory. ' Use alternate credentials. Set adoCommand = CreateObject("ADODB.Command") Set adoConnection = CreateObject("ADODB.Connection") adoConnection.Provider = "ADsDSOObject" adoConnection.Properties("User ID") = strUser adoConnection.Properties("Password") = strPassword adoConnection.Properties("Encrypt Password") = True adoConnection.Properties("ADSI Flag") = ADS_SERVER_BIND _ Or ADS_SECURE_AUTHENTICATION adoConnection.Open "Active Directory Provider" adoCommand.ActiveConnection = adoConnection ' Search entire domain. Use server binding. strBase = "<LDAP://" & strServer & "/" & strDNSDomain & ">" ' Search for all users. strFilter = "(&(objectCategory=Computer)(Name=compname))" ' Comma delimited list of attribute values to retrieve. strAttributes = "distinguishedName" ' Construct the LDAP query. strQuery = strBase & ";" & strFilter & ";" _ & strAttributes & ";subtree" ' Run the query. adoCommand.CommandText = strQuery adoCommand.Properties("Page Size") = 100 adoCommand.Properties("Timeout") = 30 adoCommand.Properties("Cache Results") = False Set adoRecordset = adoCommand.Execute ' Enumerate the resulting recordset. Do Until adoRecordset.EOF ' Retrieve values. strDN = adoRecordset.Fields("distinguishedName").Value Wscript.Echo strDN adoRecordset.MoveNext Loop ' Clean up. adoRecordset.Close adoConnection.Close Has anyone ran into this issue befor and know a way around it.
|
|
| |
|
|
|
 |
RE: Win PE 2.0 getting an ADORecordSet Error - 5/1/2008 12:29:17 AM
|
|
 |
|
| |
mbouchard
Posts: 1804
Score: 12
Joined: 5/15/2003
From: USA
Status: online
|
Have you enabled support for ADDOB in PE? This is not something that is normally enabled by default.
_____________________________
Mike For useful Scripting links see the Read Me First stickey! Always remember Search is your friend.
|
|
| |
|
|
|
 |
RE: Win PE 2.0 getting an ADORecordSet Error - 5/1/2008 1:04:13 AM
|
|
 |
|
| |
mbouchard
Posts: 1804
Score: 12
Joined: 5/15/2003
From: USA
Status: online
|
There isn't a MS supported way but you can go to the WinPE forum here http://www.msfn.org/board/forums.html and find instructions on how to do it.
_____________________________
Mike For useful Scripting links see the Read Me First stickey! Always remember Search is your friend.
|
|
| |
|
|
|
|
|