Jump to content
Sign in to follow this  

Showing "Application as service"

Recommended Posts


Ok so im trying to automate an app running as a service. I am using ServiceShell to make a standard app run as a windows service. That seems to be working fine because the service starts and i can see that its running by looking at task manager/Processes

The service says its running under the SYSTEM user. Naturally this is hidden from view so my real question is once my script runs and starts the app as a service is there a way to @sw_show the application.

Opt("TrayIconDebug", 1)  ; Puts debug in the tooltip
While 1
If Not WinExists("Login", "") Then
  ControlClick("Login", "&Login", "[CLASSNN:WindowsForms10.BUTTON.app.0.3ce0bb81]")
Until Not WinExists("Login", "")

This is the EXE that is being run as a service, ultimately i would like to have the last "Sleep(1000)" piece of code actually make the application visible to the user logged in, or can i not do this?

Share this post

Link to post
Share on other sites

Hi, chachew. I have done something similar in the past, to create a tooltip utility that starts as a service. As it runs as System, in order to make it visible to the logged in user you need to check the option to interect with the desktop in the services console. I ended up using Microsoft's SRVANY.exe, which makes the creation of the service a bit easier.

√-1 2^3 ∑ π, and it was delicious!

Share this post

Link to post
Share on other sites

I have had this issue before too.

I had to use a free app called srvany and have the service point to that. I then create a reg key:

RegWrite("HKLMSYSTEMCurrentControlSetServicesServiceNameParameters", "Application", "REG_SZ", "C:WindowsSystem32AppLocation.exe")

This then allows my script to run.

The srvany file can be found via this link:


Hope that helps.

Share this post

Link to post
Share on other sites

@jazzyjeff Yea i have tried the Srvany.exe and the problem i was running into was that when the service tries to start, the "Interactive Services Detection" service kicks in and wants my to "View" the process and interact with it..

@JLogan I also tried this and that kind of produces the same issue as stated above with jazzyjeff. If i turn that off, service straight up fails. When ON i get the "View Details" message.

With this ServiceShell app i can sucessfully get the service created and it will start/stop normally without issues. I just need to figure out how to "Show" it. @JLogan, how were you able to show the gui via tooltip that you were referring too?

Share this post

Link to post
Share on other sites

Hi, chachew. In my case, the utility sat in the system tray, just something the customer wanted so users could click on the image and be able to relay system information to their Helpdesk (I don't ask, I just do what they pay me to do). Below is the code. I just compiled this code, then wrapped it with SRVANY to make it start on login, once the system detects "explorer.exe" running, otherwise the service tried to start too soon and returned rubbish.

#include <GUIConstantsEx.au3>

Opt("TrayMenuMode", 3)
$strComputer = @ComputerName
Global $strNameOfUser
Global $strUserDomain
Global $_user
Global $_domain

;On Startup, wait until the Process "explorer.exe" exists in the Logged In User context.

;Call the _WMI function to return the Logged In User's Name and Domain.

Func _WMI()

$objWMIService = ObjGet("winmgmts:" _
    & "{impersonationLevel=impersonate}!" _
    & $strComputer & "rootcimv2")

$colProcessList = $objWMIService.ExecQuery _
    ("Select * from Win32_Process")

For $objProcess in $colProcessList
  $colProperties = $objProcess.GetOwner( _

  If $objProcess.Name = "explorer.exe" Then



;Called by _WMI function. This function actually create the System Tray icon, using data gathered by WMI call.
Func _test()

TrayCreateItem("Account: " & $strNameOfUser)
TrayCreateItem("Hostname: " & @ComputerName)
TrayCreateItem("Domain: " & $strUserDomain)
TrayCreateItem("Resolution: " & @DesktopWidth & "x" & @DesktopHeight)

$aboutItem  = TrayCreateItem("About")


TraySetToolTip("Helpdesk Utility")

While 1
    $msg = TrayGetMsg()
        Case $msg = 0
        Case $msg = $aboutItem
            Msgbox(64,"About","Helpdesk Tooltip Utility" & @CRLF & "Version 0.1b, September 2011")
  Case $msg = $GUI_EVENT_CLOSE

  • Like 1

√-1 2^3 ∑ π, and it was delicious!

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this