No navigation frame on the left?  Click here.

Service status

 

This code fragment determines whether the current process is running interactively or as a service (services running in a real user account have a SID with SECURITY_SERVICE_RID in their token; console processes have a SID with SECURITY_INTERACTIVE_RID; services running as BUILTIN\SYSTEM [LocalSystem] have neither). If the process is a LocalSystem service, the fragment checks for interactive access to the desktop, too.

Kudos to Rohan Philips for sharing this!

is_svc.txt, 7 KB