Can't delete Compan...
 
Notifications

Can't delete Company  

   RSS

0

I receive this error message in CP: There is no such object on the server.
In the AD the OU is deleted. But still visible in CP. The same issue when trying delete the domains in the same company.

In the Log file i see a problem with the DataReader

Log:

2019-10-14 09:43:20,301 [DEBUG] CloudPanel.CPStaticHelpers - Checking if company is enabled for Exchange
2019-10-14 09:43:20,302 [DEBUG] CloudPanel.CPStaticHelpers - Checking if company is enabled for spam filtering
2019-10-14 09:43:20,354 [DEBUG] CloudPanel.ActiveDirectory.ADUsers - Retrieving the PrincipalContext...
2019-10-14 09:43:20,824 [DEBUG] CloudPanel.Modules.CompaniesModule - Retrieving companies from database
2019-10-14 09:43:20,836 [DEBUG] CloudPanel.Modules.CompaniesModule - Found a total of 10 companies
2019-10-14 09:43:22,617 [DEBUG] CloudPanel.ActiveDirectory.ADUsers - Attempting to retrieve user photo for Administrator@internal.mailprofi.ch
2019-10-14 09:43:34,632 [DEBUG] CloudPanel.Modules.CompaniesModule - Preparing to delete company RII
2019-10-14 09:43:34,635 [DEBUG] CloudPanel.Modules.CompaniesModule - Initializing Active Directory class...
2019-10-14 09:43:34,635 [INFO] CloudPanel.Modules.CompaniesModule - Deleting company from Active Directory. Path OU=RII,OU=COM,OU=hosting,DC=internal,DC=mailprofi,DC=ch
2019-10-14 09:43:34,635 [DEBUG] CloudPanel.ActiveDirectory.ADOrganizationalUnits - Preparing to delete OU=RII,OU=COM,OU=hosting,DC=internal,DC=mailprofi,DC=ch.
2019-10-14 09:43:34,635 [DEBUG] CloudPanel.ActiveDirectory.ADOrganizationalUnits - Retrieving the DirectoryEntry... Path: OU=RII,OU=COM,OU=hosting,DC=internal,DC=mailprofi,DC=ch
2019-10-14 09:43:34,635 [DEBUG] CloudPanel.ActiveDirectory.ADOrganizationalUnits - Directory entry retrieved path is LDAP://hex-dc/OU=RII,OU=COM,OU=hosting,DC=internal,DC=mailprofi,DC=ch
2019-10-14 09:43:34,639 [DEBUG] CloudPanel.Modules.CompaniesModule - Clearing users from database for RII
2019-10-14 09:43:34,641 [DEBUG] CloudPanel.Modules.CompaniesModule - Clearing Exchange contacts for RII
2019-10-14 09:43:34,643 [DEBUG] CloudPanel.Modules.CompaniesModule - Clearing Exchange distribution groups for RII
2019-10-14 09:43:34,645 [DEBUG] CloudPanel.Modules.CompaniesModule - Clearing Domains for RII
2019-10-14 09:43:34,648 [ERROR] CloudPanel.Modules.CompaniesModule - Error deleting company: System.Data.Entity.Core.EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details. ---> System.InvalidOperationException: There is already an open DataReader associated with this Command which must be closed first.
at System.Data.SqlClient.SqlInternalConnectionTds.ValidateConnectionForExecute(SqlCommand command)
at System.Data.SqlClient.SqlCommand.ValidateCommand(String method, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)
at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
--- End of inner exception stack trace ---
at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
at System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlan.Execute[TResultType](ObjectContext context, ObjectParameterCollection parameterValues)
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
at System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__5()
at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)
at System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
at System.Data.Entity.Core.Objects.ObjectQuery`1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__0()
at System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()
at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
at CloudPanel.Modules.CompaniesModule.<.ctor>b__1_6(Object _)
2019-10-14 09:43:37,902 [DEBUG] CloudPanel.Modules.CompaniesModule - Preparing to delete company RII
2019-10-14 09:43:37,903 [DEBUG] CloudPanel.Modules.CompaniesModule - Initializing Active Directory class...
2019-10-14 09:43:37,903 [INFO] CloudPanel.Modules.CompaniesModule - Deleting company from Active Directory. Path OU=RII,OU=COM,OU=hosting,DC=internal,DC=mailprofi,DC=ch
2019-10-14 09:43:37,903 [DEBUG] CloudPanel.ActiveDirectory.ADOrganizationalUnits - Preparing to delete OU=RII,OU=COM,OU=hosting,DC=internal,DC=mailprofi,DC=ch.
2019-10-14 09:43:37,904 [DEBUG] CloudPanel.ActiveDirectory.ADOrganizationalUnits - Retrieving the DirectoryEntry... Path: OU=RII,OU=COM,OU=hosting,DC=internal,DC=mailprofi,DC=ch
2019-10-14 09:43:37,904 [DEBUG] CloudPanel.ActiveDirectory.ADOrganizationalUnits - Directory entry retrieved path is LDAP://hex-dc/OU=RII,OU=COM,OU=hosting,DC=internal,DC=mailprofi,DC=ch
2019-10-14 09:43:37,904 [ERROR] CloudPanel.ActiveDirectory.ADOrganizationalUnits - Error deleting organizational unit OU=RII,OU=COM,OU=hosting,DC=internal,DC=mailprofi,DC=ch. Exception: System.DirectoryServices.DirectoryServicesCOMException (0x80072030): There is no such object on the server.

at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_AdsObject()
at System.DirectoryServices.DirectoryEntry.DeleteTree()
at CloudPanel.ActiveDirectory.ADOrganizationalUnits.Delete(String distinguishedName, Boolean safeDelete)
2019-10-14 09:43:37,905 [ERROR] CloudPanel.Modules.CompaniesModule - Error deleting company: System.DirectoryServices.DirectoryServicesCOMException (0x80072030): There is no such object on the server.

at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_AdsObject()
at System.DirectoryServices.DirectoryEntry.DeleteTree()
at CloudPanel.ActiveDirectory.ADOrganizationalUnits.Delete(String distinguishedName, Boolean safeDelete)
at CloudPanel.Modules.CompaniesModule.<.ctor>b__1_6(Object _)

@comelfex First I would make sure you are on the latest version but also if you deleted it on the backend then it may have to be removed with SQL management studio.

@comelfex

We have just released a new version if you could please upgrade. Thank you.

Do you mean version 3.2.0319 from last year with „just released“? Or do I miss a version ? Thanks!

3 Answers
0

Hello,

I am having the exact same issue.  Installed Cloudpanel on server 2019 with SQLExpress 2017. Connecting to a fresh 2019 AD/Exchange setup

User I used during installation was xxx\administrator whom I gave sysadmin rights to the SQL master DB prior to install.

Adds company fine, remove fails.  Deletes the AD entry but does not remove the company from local SQL server.

2020-01-13 15:23:13,554 [DEBUG] CloudPanel.Modules.CompaniesModule - Preparing to delete company LHA
2020-01-13 15:23:13,586 [DEBUG] CloudPanel.Modules.CompaniesModule - Initializing Active Directory class...
2020-01-13 15:23:13,586 [INFO] CloudPanel.Modules.CompaniesModule - Deleting company from Active Directory. Path OU=LHA,OU=Hosting,DC=xxx,DC=xx,DC=net,DC=au.
2020-01-13 15:23:13,587 [DEBUG] CloudPanel.ActiveDirectory.ADOrganizationalUnits - Preparing to delete OU=LHA,OU=Hosting,DC=xxx,DC=xxx,DC=net,DC=au.
2020-01-13 15:23:13,587 [DEBUG] CloudPanel.ActiveDirectory.ADOrganizationalUnits - Retrieving the DirectoryEntry... Path: OU=LHA,OU=Hosting,DC=xxx,DC=xxx,DC=net,DC=au
2020-01-13 15:23:13,587 [DEBUG] CloudPanel.ActiveDirectory.ADOrganizationalUnits - Directory entry retrieved path is LDAP://AD1.xxx.xxx.net.au/OU=LHA,OU=Hosting,DC=xxx,DC=xxx,DC=net,DC=au
2020-01-13 15:23:13,594 [DEBUG] CloudPanel.Modules.CompaniesModule - Clearing users from database for LHA
2020-01-13 15:23:13,597 [DEBUG] CloudPanel.Modules.CompaniesModule - Clearing Exchange contacts for LHA
2020-01-13 15:23:13,602 [DEBUG] CloudPanel.Modules.CompaniesModule - Clearing Exchange distribution groups for LHA
2020-01-13 15:23:13,606 [DEBUG] CloudPanel.Modules.CompaniesModule - Clearing Domains for LHA
2020-01-13 15:23:13,650 [ERROR] CloudPanel.Modules.CompaniesModule - Error deleting company: System.Data.Entity.Core.EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details. ---> System.InvalidOperationException: There is already an open DataReader associated with this Command which must be closed first.
at System.Data.SqlClient.SqlInternalConnectionTds.ValidateConnectionForExecute(SqlCommand command)
at System.Data.SqlClient.SqlCommand.ValidateCommand(String method, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)
at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
--- End of inner exception stack trace ---
at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
at System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlan.Execute[TResultType](ObjectContext context, ObjectParameterCollection parameterValues)
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
at System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__5()
at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)
at System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
at System.Data.Entity.Core.Objects.ObjectQuery`1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__0()
at System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()
at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
at CloudPanel.Modules.CompaniesModule.<.ctor>b__1_6(Object _)

Any ideas?

Edit: I can reproduce this error every time regardless of the company name I add and remove on a fresh install.  I can remove the company using SQL management studio.  I have reinstalled the latest Cloudpanel version 4 times now same issue.

This post was modified 2 months ago by lhavas

@lhavas

It does look like a bug and we are working to fix the issue.

Thanks, looks to be working okay on the new version.

0

Just chiming in here as well.

Same here with Exchange 2016 and latest version.  Does delete company/users from OU in AD but still appears in CP and had to still remove the master user account even though it was gone from AD.

Just making sure I hadn't missed the update that fixes it.

@oliveitky

We have just released a new version if you could please upgrade. Thank you.

0

New version worked for me. Thank you.

Share: