Archive: Remote Installation of Win32 Services


Remote Installation of Win32 Services
Hi,

I am evaluating a software installer tool and need some more information about NSIS. Could anybody please answer the following questions:


a) I need to install Win32 Services on NT an W2K. There are different binaries for each OS since they are compiled with different compiler switches. Can this be done with NSIS? How are security context treated (a service runs as System or under a specific user account)

b) Can I do remote installs? E.G. I have a central server holding different versions of a service executable. I like to install such an exe to a remote server

c) Is there support for an unattended mode. This means can I run the installer in the background without any user interactivity?

d) Is it possible to start the installer from some of my own code? E.G. I have a CORBA based server, that should start a software distribution to a specific server when requested by any of its client which could be a Web Application or a Java based GUI application.

e) Are there any samples for a Win32 service installation script? (Similar to what Apache is using to install the Windows version of TOMCAT 4.x)

Many thanks for your support.

Thomas


1) The Service DLL, the SysInfo DLL and the IsAdmin DLL should help you.
2) You can copy from network drivers using CopyFiles.
3) Yes, silent mode. Use SilentInstall silent and unless you pop a message box the user won't see a thing.
4) I don't understand. Do you want to execute it?
5) Not that I know of. As far as I know the service itself should know how to install and uninstall itself when registered or unregistered. If this is not the case with your services, than I am sure we can work something out. Just tell me and I will look a solution for you. As far as I know it should be a simple use of WriteRegStr.


Originally posted by kichik
and unless you pop a message box the user won't see a thing.
4) I don't understand. Do you want to execute it?
Well this is sort of the key point... We have written a large distributed application which consists of many Win32 servers in a corporate network. We use CORBA as our internal communication protocol. The application has agents that run on NT or W2k and soon .NET servers. These agents are self-distributing. We use a sybase DB server that stores a list of jobs to be executed. These jobs are dynamically generated by other parts of our system when they receive data from other input systems such as a mainframe, UNIX box etc (very complex...) A job record contains beside other things a machine name and the sort of job to execute. We have written middleware that acts as job dispatcher. If a job needs to be dispatched to a specific server process on a specific machine it first needs to check if our server is installed and running there. If not it first has to install it on the remote machine. Then it needs to start the service. Our services are self configuring at start-up. They connect to the database server and retrieve the configuration. Once they are ready, they can receive CORBA calls.

This is quite a cool system. You can simply install our central services and middleware on one or two servers at a central location. After that, the system distributes itself automatically as required (as soon as there are jobs to be processed on a remote machine). This may happen any time, 24h a day, 365 days a year. Thats why it needs to run unattended. So far we had our own Software distribution system. We developed our own primitive programming language using Sandstones VisualParse++. However the server has become a big beast and there is a lot of functionality built-in we do not need anymore. So I am looking for a very simple solution which allows me to simply remote-install my middleware on large enterprise networks.

Basically when my dispatcher server realizes that it should dispatch a job to a server that is missing our service, it simply installes it first. To do that, it should grab a predefined software package (can be a zip file) and extract it to a predefined directory on the remote server. Then it should register and start the service. This can be done using some Win32 API's. (A few years ago I have written DLL's to extend the functionality of InstallShield to exactly do that.) When the service starts, it configures itself and notifies the central dispatcher that it is ready to receive jobs and process them.

So I need a tool that does this remote installation for me. Basically it should handle things like DLL's in use etc. It should be able to extract the correct binary (depending on the target machines OS). It should not automatically reboot a machine (not very nice if hundreds or users are connected to it....) etc. but should send a notification to an administrator that the server needs to be rebooted. Also it should be able to perform server upgrades. Sometimes we release a new version of such a server process. We should be able to upgrade an installed base of existing servers.

Of course I can change all of my parser logic (was written by a former employee of mine) but that means a time consuming process. So I am looking for something less time-consuming. If NSIS fits to my model I could also spend some hours to extend it if necessary.

Another alternative is to use Microsofts Setup API. I am simply trying to find out, what is the best solution for me.

edited by kichik, not everything is quote of me :)

I'm not sure how using WriteRegStr you could specify the password for a service running under a specific user account. AFAIK the Service Control Manager does something fishy with the password so that it can fall back on a previous one if a new one fails. You might find that only the SYSTEM account has the right to manipulate some of the service entries in this case.

P.S. None of this is certain, just my thoughts based on my own experience with services although I haven't really had to tackle these issues.


Originally posted by tbednarz
Basically when my dispatcher server realizes that it should dispatch a job to a server that is missing our service, it simply installes it first. To do that, it should grab a predefined software package (can be a zip file) and extract it to a predefined directory on the remote server. Then it should register and start the service. This can be done using some Win32 API's. (A few years ago I have written DLL's to extend the functionality of InstallShield to exactly do that.) When the service starts, it configures itself and notifies the central dispatcher that it is ready to receive jobs and process them.
I am sorry it took me so long to answer again.
I have never done such a thing, so I have no idea how to make a program execute on another computer, but if you can do it using Win32 APIs, you can do it with, just like before, with an extension DLL. Have a look at Contrib\ExDLL for an example extension DLL for NSIS.