I have created a service for myself to start various processes upon logon. I know that I could have just added a registry value, but I fancied doing it via code, that way I can take the service with me and create logs etc.
What I don't want is for the process to start for anybody other than myself, so I thought about putting the following code in the OnStart method:
if (WindowsIdentity.GetCurrent().Name.ToString() == myUserName)
However when I done a quick test on a normal Windows App I found that the form would initially load, then exit. As there is a good deal of processing within my code I really dont want it to do anything unless it's me who is logged in. Is there anyway that I can make sure that it won't activate any other code unless I'm the logged in user?