Page 1 of 2

invalid windows credentials

Posted: Mon Jul 13, 2020 10:43 pm
by rbaroniunas
I am using the scheduler wizard to insert a task, when i get up to step 5 and it automatically locates the user account, it has my domain and username but it fails when i enter the password with invalid credentials.

Why is this happening

How can i check what is being selected by the wizard ?

Re: invalid windows credentials

Posted: Tue Jul 14, 2020 5:41 am
by isiticov
Hello,
Can you try to use double-slash in user name after the domain name?
For example:
DOMAIN\\UserName instead of DOMAIN\\UserName.
Please let me know if this helped.

Re: invalid windows credentials

Posted: Tue Jul 14, 2020 2:35 pm
by rbaroniunas
No, that doesn't work. Apparently is it looking only at the Windows 10 Pro Administrator account and no other account is allowed to be used.

Tried

\\Doman\username
\\Domain\\username
Domain\\username
Domain\username
\\username

None work

Re: invalid windows credentials

Posted: Tue Jul 14, 2020 3:54 pm
by rbaroniunas
How does the wizard know which account to look up by default and if i use any other accounts that work it rejects and it, giving the impression it is only using one account the local admin.

Re: invalid windows credentials

Posted: Tue Jul 14, 2020 4:44 pm
by isiticov
Hello,

The wizard just uses GetUserName() Windows API to get the current user name for this field in wizard's UI. But you can enter anything you want into this field. So you can always enter manually the proper user name. And this will be used to set the task's credentials.

Re: invalid windows credentials

Posted: Tue Jul 14, 2020 8:51 pm
by rbaroniunas
Every time i enter any windows user name and password it tells me invalid credentials not allowing me to go further.

Re: invalid windows credentials

Posted: Wed Jul 15, 2020 2:12 am
by isiticov
You're using a demo project from VCL Scheduling Agent delivery, am I right?
Are you able to create "Quick Demo Tasks" from "Quick Demos" menu on toolbar?
Is you active account has administrative privileges? May be you can't set task's user credentials due to limited rights on the current account?

Re: invalid windows credentials

Posted: Wed Jul 15, 2020 7:09 pm
by rbaroniunas
No, i am using it in my production application and using the latest version.

It fails in saTask unit

pRegisteredTask := itf.RegisterTaskDefinition(Name, FTaskDefinition,
TASK_CREATE_OR_UPDATE, AAccountName, APassword,
TASK_LOGON_PASSWORD, '');

This raises error EOSERROR, What does that mean ?

FTaskManager.CurrentFolderPath = '\'

Re: invalid windows credentials

Posted: Wed Jul 15, 2020 7:43 pm
by rbaroniunas
I uninstalled and resintalled getting the EOSError in SATASK Unit. No message as to why.

Re: invalid windows credentials

Posted: Wed Jul 15, 2020 7:53 pm
by rbaroniunas
Apparently it seems that there is an issue if you use the local default admin, it does not work and returns a EOSERROR

I tried trapping it but it was blank.

There must be a Windows 10 thing about it.

Re: invalid windows credentials

Posted: Thu Jul 16, 2020 1:59 am
by isiticov
Can you try to temporary modify the mentioned code in saTask.pas unit as the following:

Code: Select all

      try
        pRegisteredTask := itf.RegisterTaskDefinition(Name, FTaskDefinition,
          TASK_CREATE_OR_UPDATE, AAccountName, APassword,
          TASK_LOGON_PASSWORD, '');
      except
        on E: EOSError do
        begin
          ShowMessage(Format('%s'#13#10'Error code: %d', [E.Message, E.ErrorCode]));
          raise;
        end;
      end;
and add Dialogs to uses and let me know the message displayed. This will help to detect what kind of problem is there.
Or you can modify wizard's code and enclose FTask.SetAccountInformation(wsAccount, wsPassword); into similar try/except block to detect the error message and error code.

Re: invalid windows credentials

Posted: Thu Jul 16, 2020 1:49 pm
by rbaroniunas
It gave me a error code 5 which is access denied. This just recently started since using the new update. What UAC permission do i need to adjust towards ? I do not want the application that i developed to be executed as administrator otherwise clients will complain about that.

Re: invalid windows credentials

Posted: Thu Jul 16, 2020 2:12 pm
by rbaroniunas
One more piece, i ran it with Administrator rights and set to create the task with the highest privilege, it allows to be used without the error code. What would i need to adjust in the UAC to bypass this ?

Re: invalid windows credentials

Posted: Thu Jul 16, 2020 2:14 pm
by isiticov
What kind of trigger do you try to use for this task?
Just some notes from MSDN:
Only a member of the Administrators group can create a task with a boot trigger.
Also:
You cannot register a task that has more privileges than the account requesting the registration.
https://docs.microsoft.com/en-us/window ... ning-tasks
In short: you can't create a task with "administrator" settings when running under non-admin user.
This doesn't mean that you must use "Run as Admin" to run your application to add admin tasks, just current OS user shall have admin rights.
So if you run your application under "limited" user then you are unable to add tasks that contain any admin related settings.

Re: invalid windows credentials

Posted: Thu Jul 16, 2020 2:17 pm
by isiticov
rbaroniunas wrote: Thu Jul 16, 2020 2:12 pm set to create the task with the highest privilege, it allows to be used without the error code. What would i need to adjust in the UAC to bypass this ?
Highest privilege setting requires admin rights for the user.