I have several VBScripts that I am wanting to run that use the CreateObject("ADODB.Connection") method, but I am always getting this error:
ActiveX Component can't create object: 'ADODB.Connection'
I have tried several ADO, WSH and VBScript plugins, but nothing seems to work.
As long as as I don't use an CreateObject("ADODB. uname it) the scripts will work, unfortunately I need to be able to use these critical ADODB objects.
Can someone direct me to a plugin that should work for these CreateObject calls?
Here is just one script that I am using:
Option Explicit
WScript.Echo "Computer Account in AD: " & _
isComputerAccountExists("COMPUTERNAME")
' explicit hostname set
Function isComputerAccountExists(host)
Dim conn, cmd , rs
Set conn = CreateObject("ADODB.Connection")
Set cmd = CreateObject("ADODB.Command")
conn.provider = "adsdsoobject"
conn.open "active directory provider", "DOMAIN\USERNAME", "password"
cmd.activeconnection = conn
cmd.commandtext = "<LDAP://DOMAINCONTROLLER/dc=domain,dc=com>;" & _
"(&(objectcategory=computer)(objectclass=computer)(cn=" & host & "));cn;subtree"
Set rs = cmd.Execute
If rs.recordcount = 0 Then
isComputerAccountExists = False
Else
isComputerAccountExists = True
End If
Set rs = Nothing
Set cmd = Nothing
Set conn = Nothing
End Function
