Hi,

I have a vbscript to validate the user in AD and I am having trouble running
it in the custom Action. Can someone point out mistakes in implementing the
custom action.
I am not a vbscript expert here so please pardon my ignorance.

log
----

Action 11:42:48: CheckUserExists.
Action start 11:42:48: CheckUserExists.
MSI (c) (E8:94) [11:42:48:993]: Cloaking enabled.
MSI (c) (E8:94) [11:42:48:993]: Attempting to enable all disabled privileges
before calling Install on Server
MSI (c) (E8:94) [11:42:48:993]: Connected to service for CA interface.
Action ended 11:42:49: CheckUserExists. Return value 3.
DEBUG: Error 2896:  Executing action CheckUserExists failed.
The installer has encountered an unexpected error installing this package.
This may indicate a problem with this package. The error code is 2896. The
arguments are: CheckUserExists, ,
Action ended 11:42:49: WelcomeDlg. Return value 3.

Code
--------

<CustomAction Id="CheckUserExists" BinaryKey="CheckUserExistsKey"
VBScriptCall="CheckUserExists" Execute="immediate"></CustomAction>
<Binary Id="CheckUserExistsKey" SourceFile="scripts\ADUserSearch.vbs"
></Binary>

vbscript
----------

Function CheckUserExists
Set shell = WScript.CreateObject("WScript.Shell")
strUserName = Session.Property("IAMUSERNAME")
dtStart = TimeValue(Now())
' Determine DNS domain name.
Set objRootDSE = GetObject("<a href="ldap://RootDSE/"; target="_top"
rel="nofollow" link="external">LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
Set objCommand = CreateObject("ADODB.Command")
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
objCommand.ActiveConnection = objConnection
objCommand.CommandText = _
 "<LDAP://" & strDNSDomain & ">;(&(objectCategory=User)" & _
 "(samAccountName=" & strUserName & "));samAccountName;subtree"

Set objRecordSet = objCommand.Execute
If objRecordset.RecordCount = 0 Then
 'WScript.StdOut.WriteLine "sAMAccountName: " & strUserName & " does not
exist."
        Session.Property("USEREXISTS") = 1
Else
 'WScript.StdOut.WriteLine strUserName & " exists."
        CheckUserExists = msiDoActionStatusSuccess
End If
objConnection.Close
End

-- 
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Check-if-user-exists-in-UI-tp5829564p5838218.html
Sent from the wix-users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to