Exchange2010 : Add-DatabaseavailabilityGroupServer fails with error Cluster API CreateCluster() failed with 0x57

On Specific CNO Computer Objects we might fail to create cluster. Occasionally you might run into issues adding Mailbox Servers to the Database Availability Group.

The operation Fails on All Mailbox Servers. Open Cluster API function validates all the Sid's, custom security groups on CNO Objects ACL List. 

Some of the Custom Security groups might not have appropriate permissions to open cluster. when Mailbox Server is added to DAG, Create cluster () , try to find CNO .

If CNO is found, create CNO ---> Enable CNO --->Set Self with appropriate permissions, ( Full Control)

"NT Authority \System" finds valid accounts ( ACL on CNO) object to enumerate network name resource. If custom security groups do not have appropriate permissions on enumerate  

 Network name , Add-DatabaseavailabilityGroupServer fails with Error : 

WriteError! Exception = Microsoft.Exchange.Cluster.Replay.DagTaskOperationFailedException: A server-side database availability group administrative operation failed. Error: The operation failed. CreateCluster errors may result from incorrectly configured static addresses. Error: An error occurred while attempting a cluster operation. Error: Cluster API '"CreateCluster() failed with 0x57. Error: The parameter is incorrect"' failed. ---> Microsoft.Exchange.Cluster.Replay.AmClusterApiException: An Active Manager operation failed. Error An error occurred while attempting a cluster operation. Error: Cluster API '"CreateCluster() failed with 0x57. Error: The parameter is incorrect"' failed.. ---> System.ComponentModel.Win32Exception: The parameter is incorrect
  

 --- End of inner exception stack trace ---
   at Microsoft.Exchange.Cluster.ClusApi.AmCluster.CreateExchangeCluster(String clusterName, AmServerName firstNodeName, String[] ipAddress, UInt32[] ipPrefixLength, IClusterSetupProgress setupProgress, IntPtr context, Exception& failureException, Boolean throwExceptionOnFailure)
   at Microsoft.Exchange.Cluster.Replay.DagHelper.CreateDagCluster(String clusterName, AmServerName firstNodeName, String[] ipAddresses, UInt32[] netmasks, String& verboseLog)
   --- End of inner exception stack trace (Microsoft.Exchange.Cluster.Replay.AmClusterApiException) ---
   at Microsoft.Exchange.Cluster.Replay.DagHelper.ThrowDagTaskOperationWrapper(Exception exception)
   at Microsoft.Exchange.Cluster.Replay.DagHelper.CreateDagCluster(String clusterName, AmServerName firstNodeName, String[] ipAddresses, UInt32[] netmasks, String& verboseLog)
   at Microsoft.Exchange.Cluster.ReplayService.ReplayRpcServer.<>c__DisplayClass2e.<RpcsCreateCluster>b__2d()
   at Microsoft.Exchange.Data.Storage.Cluster.HaRpcExceptionWrapperBase`2.RunRpcServerOperation(String databaseName, RpcServerOperation rpcOperation)
   --- End of stack trace on server (MailboxServer.Contoso.com) ---
   at Microsoft.Exchange.Data.Storage.Cluster.HaRpcExceptionWrapperBase`2.ClientRethrowIfFailed(String databaseName, String serverName, RpcErrorExceptionInfo errorInfo)
   at Microsoft.Exchange.Cluster.Replay.ReplayRpcClientWrapper.RunRpcOperationDbName(AmServerName serverName, String databaseName, Int32 timeoutMs, IHaRpcExceptionWrapper rpcExceptionWrapperInstance, InternalRpcOperation rpcOperation)
   at Microsoft.Exchange.Cluster.Replay.ReplayRpcClientWrapper.RunRpcOperation(AmServerName serverName, Nullable`1 dbGuid, Int32 timeoutMs, IHaRpcExceptionWrapper rpcExceptionWrapperInstance, InternalRpcOperation rpcOperation)
   at Microsoft.Exchange.Cluster.Replay.ReplayRpcClientWrapper.RunCreateCluster(AmServerName rpcServerName, String clusterName, AmServerName firstNode, String[] ipaddrs, UInt32[] netmasks, String& verboseLog)
   at Microsoft.Exchange.Management.SystemConfigurationTasks.AddDatabaseAvailabilityGroupServer.FormCluster()

To fix the Error.

-----------------------------

A - Create a CNO Object as Described here. [ prestage] 

https://technet.microsoft.com/en-us/library/ff367878.aspx 

B - Disable permission inheritance on CNO object

C - Remove Custom Security groups that do not have appropriate permissions to enumerate Network name

D - Create DNS Host Record and Grant CNO$:\FULL CONTRL

E - Change Network Card Priority accordingly. [ Run Netstat -rn | more --> to see Network card Priority ]