The handle is invalid would seem to apply to a COM operation. I would recommend that you starting debugging this by adding @error<>0 If statments to you code where you instantiate COM objects.

Example:
Code:

$Cmd = CreateObject("ADODB.Command")
if @error<>0
'CreateObject("ADODB.Command"): ' + @serror ?
endif

$Cmd.ActiveConnection = $Con

$Domain = GetObject("LDAP://" + $sDomain)
if @error<>0
'GetObject("LDAP://' + $sDomain + '"): ' + @serror
endif



By doing this you will know what particular line of code failed and why.
_________________________
Home page: http://www.kixhelp.com/hb/