If OLE DB Provider for Microsoft Directory Services (ADsDSOObject)
does not work in a reload script, the first troubleshooting step should be to verify whether the same query works outside of QlikView or Qlik Sense. This test can be done as follows:1.
Create a text file with the following content:Const ADS_SCOPE_SUBTREE = 2
Set objStdOut = WScript.StdOut
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.CommandText = "Select name, distinguishedName from 'LDAP://DC=domain,DC=local' where objectCategory='person'"
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Timeout") = 30
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute
Do Until objRecordSet.EOF
wScript.echo "Name: " & objRecordSet.Fields("name").Value
wScript.echo "Distinguished name: " & objRecordSet.Fields("distinguishedName").Value
- Change the LDAP address after from corresponding to your domain name. For example address for domain named "Domain.Local" is LDAP://DC=domain,DC=local (red highlighted in the example)
- Modify the query as needed: select more or fewer fields, adjust the WHERE clause, etc.
- For each query field, add a wScript.echo command in the loop at the end of the script to write filed values to console (blue highlighted in the example).
Save the test file with extension .vbs
. For example test.vbs3.
Open command line, navigate to vbs file path. Execute the following command: C:\Windows\system32\cscript.exe test.vbs
Make sure to open Windows command line under the same user running QlikView Desktop or Qlik Sense services
. This should print results of the query to command line console, similar to the following:
If the same query doesn't work in this VBScript either, then the issue lies at the OLE DB provider ADsDSOObject rather than QlikView or Qlik Sense
Reference to the VBScript used: https://docs.microsoft.com/en-us/windows/desktop/ADSI/getting-started-with-scripting-for-adsiEnvironments:
- QlikView all versions
- Qlik Sense all versions