Arianule
Arianule

Reputation: 9043

Running Console Application using service account details

I have a small Console application where I create a .dat file as a report on a daily basis pointing a task scheduler to the executable.

It runs fine on my machine(and creates the file) but on the client;s the server something seems to be blocking the creating of the file....no errors occur, and I was told to use specified service account details in order for the exe to run successfully (userName, password).

How would I add the service Account details to my code or does it happen in the App config file?

static void Start()
    {
        ConvertDataToText();
    }


 static void ConvertDataToText()
{
     //my code
}

Upvotes: 1

Views: 2524

Answers (1)

Rainer Schaack
Rainer Schaack

Reputation: 1618

Often (at least in big enterprise environments) the scheduled tasks have to run under a "technical user" domain account, which needs "logon as batch" privileges. The user name and password will be entered by the administrator, so in your code you do not usually care about these details. Important: setting checkbox "Run whether user is logged on or not".

Often the "logon as batch" privilege is not set (which can be set via a domain group policy), which prevents the technical user to "login" and so the task cannot be started.

All these error can be seen in the Windows event logs.

I was told to use specified service account details in order for the exe to run successfully (userName, password).

If I understand correctly (sorry if not), this just means the above: these have to be entered during creation of the scheduled task.

Upvotes: 2

Related Questions