remote access with version 1

Apr 25, 2012 at 8:14 AM


I had checked with schtasks for rights and I manage to read task from Windows 7 desktop to Windows 7 and Windows XP using both versions of schtasks.

When I try to use TaskService ts = new TaskService(serverName, userName, domainName, password, false) it works from 7 to 7, but if I use the same with true to read on Windows XP it give a wrong userName or Password error. Those one I had copied from the working schtasks.

Is there additional rights required by this wrapper or do we need more steps to read Windows XP tasks from Windows 7 ?

Sorry if it was already asked but I hadn't found out what I should do.

Thanks in advance for any hint.


Apr 25, 2012 at 10:07 PM

Have you tried not specifying anything for the last parameter or always leaving it false? That will select the best pattern for the connection. Also check to make sure your Local Security Policy on both systems allows remote connections.

Apr 27, 2012 at 12:39 PM

Thank you for your fast reply!

I had tried both parameters and it's true I have an "Access denied" permission with true. I guess there is still a right problem somewhere and I had been confused by the previous error message...

Remote Connections are already allowed for everyone and I had added the "run as task" right on both computer (I had tested for everyone too).

Is there any additional right required ?

When I use XP schtasks executable domain isn't needed like in this wrapper, could it be a reason why it only works with it ?

Of course UAC is turned off.


Apr 27, 2012 at 5:08 PM

Try opening the Task Scheduler MMC on your Windows 7 machine and then select the option to "Connect to Another Computer...". Try different combinations of credentials until you get one that connects. If you can't connect there, it may be a limitation of some other security configuration. If you can connect there, you should be able to take the user, domain and password and plug them into the TaskService constructor.

Apr 30, 2012 at 3:27 PM

Thanks again,

I guess it must be a limitation especially after reading

It seems we can't go on XP from 7 and I don't have /V1 option in schtasks.

I guess I'll have to use XP executable to work around this...

Apr 30, 2012 at 4:55 PM

I don't have an XP box to try this on, but I was looking at the dependencies and API calls of schtasks.exe and see that it calls WNetAddConnection2. Can someone try either using that API to connect to the XP box first, or by going to a command line and use "NET USE \\<server> <password> /USER:<domain\username>" before calling the library? This is a long shot, but sometime those work.