$path='cn=username,ou=mybase_ou,dc=computer,dc=com'; eval { $objUser = Win32::OLE->GetObject("LDAP://" . $path); }; if ($@) { # the call died, do something or another. }