IntControl (1009, p1, 0, 0, 0)
Gets name of current service.
If the current script is running as a service, this function returns the name of the service. Otherwise it returns a blank string ("").
"P1" specifies which name to return:
p1 Meaning
0 Returns the service name (the actual registry key name)
1 Returns the display name (the name shown in Control Panel)
svcname = IntControl(1009, 0, 0, 0, 0) Message("Service name",svcname)