views:

625

answers:

1

Hello,

I have a console application that i would like to run as 'NT AUTHORITY\NetworkService', but i cant remember how to do so - the only reason is that i will be hosting my service in a windows service, but for kerberos authentication testing i want to use the spn that is already at the domain (it does have delegation enabled)

In short i can simply convert it from a console app to a windows service, but i was hoping to keep from that.

Does anyone know how to do this?

+1  A: 

I don't know how accurate it is, but it is suggested that this might not be possible - see here.

It might be simplest to port it into a service... for debugging purposes, it is fairly easy to write code that can work either as a service or as a console exe (making it easy to debug, albeit in the wrong identity). I do this all the time...

Here's an example of this; search in the code for the switches:

case "-c": 
case "-console":

i.e. with "-c", it runs the code directly, rather than starting the service infrastructure. The code also shows how to have the exe act as a self-installer, which can be very handy.

Marc Gravell