0 votes

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();

by (490 points)

1 Answer

0 votes
by (18.0k points)

Hello,

The script enrolls users for password self-service taking information from database HRDatabase located on the computer where your Adaxes service is running. Please make sure the database is up and running and available for your Adaxes service.

0

not to sound stupid but where do I verify that? I saw that the softerra and adaxes services are running...this box doesnt have SQL...previous 2013.2 didnt have sql either

0

Hello,

The script that you provided in your initial post is the script from the built-in Self-Password Reset Enroller Scheduled Task. It is a sample Task that shows how to pull data from an MS SQL database and use it to automatically enroll users for Password Self-Service. The script tries to connect to an MS SQL datbase called HRDatabase located on the computer where your Adaxes service is running and use the information from the database to enroll users. Naturally, if you don't have such an MS SQL database, it gives an error.

Maybe, you could describe what you wanted to achieve when enabling the Task so that we could help you?

0

It was enabled and set to run...but I also see another item inside the self service area that does the same thing, so is it safe to say I can disable this "sample" job?

0

Hello,

The option under Password Self-Service does not do exactly the same thing. The sample Scheduled Task automatically enrolls users using an external database. That is, it pulls data from the specified database and uses the data as answers to the security questions that you've defined in your Password Self-Service Policy to enroll users for Password Self-Service automatically.

The option under Password Self-Service can be used simply to notify users. That is, users will receive automatic notifications that they need to enroll. However, users will need to enroll themselves.

Anyway, if you don't need the sample Scheduled Task, you can safely disable it.

0

ahhh ok...yeah we are letting the users enroll themselves so the powershell script isnt needed! thanks!!!

Related questions

0 votes
0 answers

Hello, I have a nice branded HTML email I'd like to use for the Self Service Invite and Self Service Password reset Emails. Is it possible to use HTML in the test fields under ... text so I'm guessing I can't but figured I'd ask rather than assume! Thanks!

asked Nov 19, 2015 by drew.tittle (810 points)
0 votes
0 answers

Whether I try to run a script or manually run the commands to enroll users, users remain unenrolled. Example of a basic script: Import-Module ... ` -QuestionsAndAnswers @{$question1=$answer1;$question2=$answer2} -AdaxesService localhost Adaxes version 2021

asked Mar 27, 2023 by gwadmin (80 points)
0 votes
1 answer

Hi, Somehow I cannot enroll users anymore since the upgrade, I get this message: "You cannot enroll for Password Self-Service because the policy effective for your account requires ... disenroll I get this message: Anyone got any idea of what is going wrong?

asked Jul 11, 2018 by droezel (110 points)
0 votes
1 answer

Hello, Similarly to how you can have a mobile number field on the Password Self Service enrollment page, is there any way you can have an alternate field such as ... a custom attribute after enrollment through regular self service. Possible or no? Thank you.

asked Nov 27, 2017 by Kevin (100 points)
0 votes
1 answer

Is there a way to set the time that the automatic self-service enrollment invitation email is sent? (the one sent if the box is checked on the policy) Additionally, is ... email to be HTML format? They appear to only allow plain text when editing the policy.

asked Jun 29, 2017 by HDClown (220 points)
3,549 questions
3,240 answers
8,232 comments
547,814 users