we recently moved some scripts from a 32 bit Windows 2008 server to a new Windows 2008 server R2 64 bit machine. Now we have some trouble with a few VB Scripts. Let's take this one for example:
Set objcon = CreateObject("ADODB.Connection") Set objrs = CreateObject("ADODB.Recordset") Set objcom = CreateObject("ADODB.command") Set objrootdse = GetObject("LDAP://RootDse") strDN = "GC://" & objrootdse.Get("rootDomainNamingContext") objcon.Provider = "ADsDSOObject" objcon.Open "ADS Provider" Set objcom.ActiveConnection = objcon objcom.Properties("Page Size") = 10000 objcom.CommandText = "<" & strDN & ">;" & strFilter & ";adspath;subtree" Set objrs = objcom.Execute if objrs.eof and objrs.bof then //<-- fails here ...
When I run this script it fails with the exception: "The search filter cannot be recognized" although it runs fine on a 32 bit machine. The new server only has web role and file services role installed. There always seems to be some trouble when the ADsDSOObject provider is involved. The LDAP search filter is ok btw.
Edit: I also tried running the SysWow64 Versions of cmd.exe and cscript.exe with the same result.
Edit 2: Tried some more stuff. Turns out the method is right, it fails when it encounters a filter like "(&(name=)(objectClass=computer))" this is invalid since name cannot be empty in the LDAP string. Funny thing is, the other server seemed to ignore this error and just moved on.