16

I've searched through the internet, but haven't found any solution in c#. Does anybody know how to give user right to log on as a Service in c#?

MaksymD
  • 314
  • 1
  • 4
  • 16
  • 1
    found it on this stack question: http://stackoverflow.com/questions/3891623/c-sharp-granting-log-on-as-service-permission-to-a-windows-user – Will Bowman Jan 28 '12 at 01:48

2 Answers2

6

EDIT: I found an article on CodeProject with sample code that shows exactly how to do this!

I assume you've already found this KB that shows how to do it with native code. I'm looking for a C# way as well.

BlueMonkMN
  • 25,079
  • 9
  • 80
  • 146
GuyBehindtheGuy
  • 1,368
  • 2
  • 17
  • 36
-1

I tried in vain to find this. The way I did it in the end was to package the NTRights executable with my application and then launch it as a separate process.

NTRights can be found on the server 2003 resource kti and its usage is documented here: http://support.microsoft.com/kb/315276

No More Hacks
  • 299
  • 4
  • 14