I just upgraded to the latest edition of 2013.2 10xxx...since then I am getting database errors on sending out selfservice emails...its complaining about sql but we dont have sql...its all internal and listed by groups in the console
Exception calling "Open" with "0" argument(s): "A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)"
thoughts? the powershell that is provided is
Import-Module Adaxes
$DatabaseHost = "localhost"; #TODO modify
$DatabaseName = "HRDatabase"; #TODO modify, please note that you can specify an MS SQL database only
$DatabaseTableName = "Users"; #TODO modify
$DatabaseIDField = "UserName" #TODO modify
$ActiveDirectoryIDField = "samAccountName"; #TODO modify
# TODO: modify the DatabaseUsername and DatabasePassword parameters if your don't want to use
# the credentials of the Adaxes default service administrator
$DatabaseUsername = $NULL;
$DatabasePassword = $NULL;
$Question1 = "What is your Social Security number?"; #TODO modify
$Question1AnswerFieldName = "UserSocialNumber"; #TODO modify
$Question2 = "What is your employee number?"; #TODO modify
$Question2AnswerFieldName = "UserEmployeeNumber"; #TODO modify
# Read UserID from Active Directory
$userId = $Context.TargetObject.Get($ActiveDirectoryIDField);
# Find the record for the user in the database
$connectionString = "Data Source=$DatabaseHost; Initial Catalog=$DatabaseName;"
if ($DatabaseUsername -eq $NULL)
{
$connectionString = $connectionString + "Integrated Security=SSPI;";
}
else
{
$connectionString = $connectionString + "User ID=$DatabaseUsername;Password=$DatabasePassword;";
}
$connection = New-Object "System.Data.SqlClient.SqlConnection" $connectionString
$connection.Open();
$command = $connection.CreateCommand();
$command.CommandText = "SELECT " + $Question1AnswerFieldName + "," + $Question2AnswerFieldName + " FROM " + $DatabaseTableName + " WHERE " + $DatabaseIDField + "=@UserID"; $command.Parameters.Add("@UserID", $userId) | out-null; $reader = $command.ExecuteReader(); if ($reader.Read()) { $answer1 = $reader\[$Question1AnswerFieldName\]; $answer2 = $reader\[$Question2AnswerFieldName\]; $domainName = $Context.GetObjectDomain($Context.TargetObject.Get("distinguishedName")); Get-AdmUser -Filter "$ActiveDirectoryIDField -eq '$userId'" -Server $DomainName -AdaxesService localhost |
New-AdmPasswordSelfServiceEnrollment -QuestionsAndAnswers @{$question1=$answer1;$question2=$answer2} -Server $domainName -AdaxesService localhost
}
else
{
$Context.LogMessage("The user '" + $userId +"' is not found in the database.", "Error");
}
$reader.Close();
$command.Dispose();
$connection.Close();