Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to connect to a remote machine but I always have access denied error #43

Closed
first100 opened this issue Dec 20, 2017 · 16 comments
Closed
Assignees

Comments

@first100
Copy link

Hello,
im trying to connect to a remote machine to get all task and im using:

using (TaskService ts = new TaskService(computer,user,domain,password)) { EnumFolderTasks(ts.RootFolder); }
but i have this error:
The request is not supported. (Exception from HRESULT: 0x80070032)
or access denied error, but the credentials is right.

Can anyone help me?
Thanks

@dahall
Copy link
Owner

dahall commented Dec 20, 2017

I'd suggest two things:

  1. Make sure you have followed the instructions in the documentation for opening both sides of the connection.
  2. Try using the TaskSchedulerConfig tool I wrote to help troubleshoot this exact kind of scenario. There is a ClickOnce install link at the bottom of the page.

@first100
Copy link
Author

Thank you for your reply, i have followed the instructions in documentation and now execute the TaskSchedulerConfig, i trying to enumerate task from local machin with Windows 10 pro to remote machines with win 2003 or win 2008 server. I always has this error "The request is not supported. (Exception from HRESULT: 0x80070032)"

@dahall
Copy link
Owner

dahall commented Dec 21, 2017

Do you get the exception on the TaskService constructor or elsewhere? Also, the WS2003 will always be V1 so you may have more luck by specifying true for the forceV1 parameter of the TaskService constructor.

@first100
Copy link
Author

The exception is in the constructor , i have now tried on Win Server 2012 R2 (with true and then with false) but the error is same .
capture

Thanks.

@dahall
Copy link
Owner

dahall commented Jan 9, 2018

Are user, domain or password equal to NULL?

@ChrisonSimtian
Copy link

Hi dahall, I've experienced the same issue as described above .
Your validation tool didnt find any issues and the method gets a valid username together with the correct password.

The lib seems to work fine on machines that dont belong to an active directory domain, but as soon as I try it on a machine that is in a domain, the above error comes up.

Any ideas?

PS: Ive handed over the userId in several variations together with the domains name, none seemed to work. Neither did handing over just the username.

@dahall
Copy link
Owner

dahall commented Jan 23, 2018

When running the Diagnostic tool, make sure you are running "As Administrator" and running on both sides of the connection. There are failures that can only be detected on one side or the other with elevated permissions. You should also, at the end of the first run, click on "Troubleshoot connecting to a remote computer" and go through those steps.

@ChrisonSimtian: I have run this tool in an AD environment for many years. Often there are firewall, access list, or policy problems on one side of the connection.

@dahall
Copy link
Owner

dahall commented Jan 23, 2018

Also, after running the tool, if any of the issues are "Not fixed", you can click on "View detailed information", find the error in question and see if there is "Requires consent" status. If so, you can click on the ">" (Play) button to the far right to fix that error as well.

@Anastasius80
Copy link

I have the same error on my site. I used the tool (above) and checked all. Everything is ok.

I used followning command:

new TaskService($@"\{HostFqdn}", _adminUsername, _adminDomain, _adminPassword);

I got the error, after that i tried to use following command:

new TaskService($@"\{HostFqdn}");

and run the program with "run as" and used the "admin user". Now it works, but i don't want to run the program with the user directly, i want to use the first command.

Any ideas?

@dahall
Copy link
Owner

dahall commented Feb 22, 2018

@Anastasius80: When running the tool, did you also (at the end) run the "Test Remote Connections" button? Also, did you try running the tool on both the client side host and the remote host?

If so, and they all checked out, then I'm out of ideas. Microsoft has not documented all the conditions that have to be in place for remote connections to work for their underlying ITaskService to connect. The tool tests for all those I have found on my own. I have found, like you, that:

  • Connections work best when using the client host token (no username)
  • Firewalls cause big problems on the client and remote host
  • Connecting from one OS version to another has more problems than connecting from like to like
  • User privileges on both sides of the connection play a significant role.

@Anastasius80
Copy link

Anastasius80 commented Feb 23, 2018

@dahall thanks for your response. My solution is now, that i used the client host token:

• Connections work best when using the client host token (no username)

I tested all (both sides) with the tool, and found no errors, every button is clicked :)

Thank you for your help!

@dahall dahall self-assigned this Mar 2, 2018
@dahall dahall closed this as completed Sep 12, 2018
@dahall
Copy link
Owner

dahall commented Nov 15, 2018 via email

@Hung-Yang
Copy link

Hung-Yang commented Dec 4, 2018

Hello,

thank for you to create this project , and i meet some problem as below.

im trying to connect to a remote machine by same code and same IIS machine as below , and using different version of Task Scheduler, then i get the different response.

TaskService ts = new TaskService(workstation, userName, domain, password, true);

when using version 2.8.6.0 will get response as incorrect user name or password.

and when i change to version 2.5.28 , then i get the right TaskService back.

But i still want to use the new version, so what can i do to fixed it?

thank you!

@dahall
Copy link
Owner

dahall commented Dec 4, 2018

What are the Windows versions of the two machines?

@dahall
Copy link
Owner

dahall commented Dec 4, 2018

And. what are the Windows versions of the host machines (where the library is executed)?

@Hung-Yang
Copy link

What are the Windows versions of the two machines?

Server slite is windows server 2012 R2 and remote site is server 2003
and library used in 2012R2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants