Question

I am using Cassia to connect my C# code to our network of terminal servers. If I run the program as an Administrator user it works fine. However when I load the same code up as a service with the Local System user and Cassia makes a WTSEnumerateSessions call I get a Win32Exception (0x80004005) "No more data is available".

From this issue on the Cassia tracker I saw it can be a permissions issue. So on the remote server I am querying I set "Full Control" permissions for the computer account of the machine I am connecting from but it did not fix the issue.

Does anyone have any other suggestions other than running the service under a user account that has Administrative privileges instead of under the Local System account?

Was it helpful?

Solution

I spend so long banging my head on this and I solved it right when I was about to submit the question.

In case anyone else encounters this you must restart the Remote Desktop Services service for the permission changes to take affect, you will not be able to query the service until after the service has been restarted.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top