PDA

View Full Version : HCA as a service.... sort of....


ewelin
Oct 19, 2009, 11:55 PM
Well I was tinkering with my WHS unit tonight as I moved my magicjack onto it and set that up to run as a service. So I got to thinking I should try getting HCA to run as a service again.... So here's what I've got so far...

I had my WHS unit setup to autologin to the admin account and start HCA very similar as outlined in this thread.

First thing I did was shut down HCA. I then used the great AnyService Installer (Review (http://www.wegotserved.com/2008/12/08/add-in-review-anyservice-installer/) -- Download (http://forum.wegotserved.com/index.php?/topic/8566-any-service-installer/)) to create the service. I had the Windows Server 2003 Resource Kit already installed so I just directed AnyService Installer to it's installed path. I then set the application as C:\Program Files\Home Control Assistant Plus\Program\HCA.exe. I named my service simply HCA-Service. I then switched the Mode to Advanced so I could enter in the Administrator user name and password. I then clicked create and the service was created. Since it's using the user name and password, it'll load the file just as it was last loaded by the Administrator account. I then started the service and waited a few minutes for a schedule task to fire and it did without issue, right on time.

Now... unfortunately when the service is running, you can not interact with HCA, you have to shut down the service, and start HCA normally. To overcome this I thought a simple bat file which would shut down the service with net stop HCA-Service then start the HCA program. This isn't ideal... but it works. Just have to remember to shut down HCA and start the HCA-Service. Also one has to make sure to adjust their programs to perform correctly upon HCA restart as you'll be restart HCA more frequently this way.

I tried setting HCA-Service to use the local system and have it interact with the desktop, but when I load my HCA file, the HCA icon in the taskbar would disappear. I was able to load a test HCA file I had but when viewing folders, the devices appeared to have the WHS's desktop background as the icon. So it was completely unusable.

So now I guess I just need to figure out an easy way of interacting with HCA when I RDP in

ewelin
Oct 20, 2009, 01:08 AM
Actually the more I think about this... I think I need to get HCA to run under Local System rather than the Administrator account... just not sure how to go about that...

mjl
Oct 24, 2009, 02:36 PM
I don't thnk you can have a service directly run a GUI - I think you need to use a client/server approach such as a web based interface. In order for this to work cleanly, HCA would need to be fully implemented as a client/server architecture.

I think the best you can do is have auto-login and run HCA at login on the console - then use a program like VNC or RDP to grab the console. I believe that you can use the windows task scheduler to cause HCA to start at login if you need more control than the startup folder. You can use the task schedule to run a program at boot time and under different credentials, but I don't know what would happen to the GUI - I think it must run after login for the GUI to work.

Actually the more I think about this... I think I need to get HCA to run under Local System rather than the Administrator account... just not sure how to go about that...

ewelin
Oct 25, 2009, 01:20 PM
If you enable interact with desktop then the service does interact witht he desktop... If I enable that option on the magicjack software, I can then use the MJ GUI if I restart the service. If I disable that option, then the GUI is never shown, in both cases the software runs as designed and I can use my phone without issue.

After a couple emails with the HCA staff, I figured out the registry settings that need to be adjusted and hopefully with those changes HCA can run as a service and interact with the desktop. I just haven't had time to test anything so far. Idealy what I'd like is to remove the need to have to autologin, as WHS, by design, is suppose to run everything as a service and not actually have a user logged in. I don't use the HCA Web Interface as I find it non-user friendly so I still need to interact with the HCA GUI from time to time. In addition, most of what I do on the GUI is stuff the Web Interface can't do.

Right now I have my WHS box setup to autologin, then I have to use VNC to remote connect to do any changes. RDP doesn't work as WHS is based off of server 2003 and RDP connections are treated like a new session, even if it's for a user already logged on. So RDPing in starts a second session of HCA and that session of HCA is not usable.

mjl
Oct 25, 2009, 03:23 PM
Check this out -this might help:

http://support.microsoft.com/kb/278845 - How to Connect to and Shadow the Console Session with Windows Server 2003 Terminal Services

I did want to add that I also use VNC when I need to manage a console - VNC is just much easier to set up and doesn't require me to make registry/policy changes. We are not allowed to use VNC at work so at work I need to use mstsc with the -console option.


If you enable interact with desktop then the service does interact witht he desktop... If I enable that option on the magicjack software, I can then use the MJ GUI if I restart the service. If I disable that option, then the GUI is never shown, in both cases the software runs as designed and I can use my phone without issue.

After a couple emails with the HCA staff, I figured out the registry settings that need to be adjusted and hopefully with those changes HCA can run as a service and interact with the desktop. I just haven't had time to test anything so far. Idealy what I'd like is to remove the need to have to autologin, as WHS, by design, is suppose to run everything as a service and not actually have a user logged in. I don't use the HCA Web Interface as I find it non-user friendly so I still need to interact with the HCA GUI from time to time. In addition, most of what I do on the GUI is stuff the Web Interface can't do.

Right now I have my WHS box setup to autologin, then I have to use VNC to remote connect to do any changes. RDP doesn't work as WHS is based off of server 2003 and RDP connections are treated like a new session, even if it's for a user already logged on. So RDPing in starts a second session of HCA and that session of HCA is not usable.

skippy76
Dec 31, 2010, 10:04 AM
I'm going to be setting my HCA Server up today as a Service on WHS, hopefully I can get this to work.

mjl
Jan 01, 2011, 06:48 PM
I'm running 3 windows home servers now (not for HCA but as backup servers only) - To remote in, I set up an RDP file with the parameters I want to use (WHS1.rdp), and then I set up a batch file with the following command syntax on my Windows 7 workstation (MUL01). It opens the server 2003 console session from the WHS box in an RDP window on my windows 7 workstation. I never recall if the /admin or -console switch is required so I use both unless it errors out. Also, the RDP file is configured to save the login information and logs in as the default Administrator account on the Windows home server - this is important since if you use any other account, the default admin account will be logged out - the default admin account (Administrator) is what WHS uses if you log in using the connector software. I don't change it since I don't want to break the connector software, and I don't expose these home servers to the Internet. If you set the WHS up to auto-login, it should run stuff just fine even though there is actually no console connected - then if you run this RDP with the same credentials, it just connects to the current login:

start /b /D "./" mstsc \\MJL01\Users\jim.BLANKITSECURITY\Desktop\RDP\WHS1 .rdp /admin -console >nul


Also, there are other apps which claim to allow processes to run as a service on WHS. I downloaded one called "AnyServiceInstaller" but I have not had a chance to test it yet.

http://forum.wegotserved.com/index.php/topic/8566-any-service-installer/