开发者

Best way to automate Windows Service deployment/install to multiple remote endpoints? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 2 years ago.

Improve this question

I'm looking for the best开发者_开发知识库 method of automated deployment available for 'Windows Services'. I've looked into AppFabric, however this seems very much geared towards web-services/IIS and WCF.

I've also looked into MSDeploy but this again doesn't seem to really cover all the functionality I was looking for.

So as an example I have a .NET solution with multiple projects/windows services. I would like to have these packages remotely deployed to multiple servers and then have the Windows services remotely installed. All from one script/machine. Without having to have a user login to the respective servers and manually install.

Any suggestions of software capable of this?


I've programmed tools to handle this for more than just a basic script example. I'll talk about basic scripting examples though.

A way to address this by batch script is by invoking PsExec (one of the SysInternals tools). You can use PsExec to do the remote execution of tasks. The credentials you'll need to specify will need to be a local administrator on the remote machine. For example:

PsExec \\computername -u adminuser -p adminuserpassword somecommand somecommandarguments

If I wanted to copy a file between two directories, I could do the following:

PsExec \\computername -u adminuser -p adminuserpassword xcopy "C:\TestFile.txt" "C:\MyDir\TestFile.txt" /i /e /r /y

I like to download the SysInternals tools to a TOOLS directory and add that to my PATH environment variable so I don't need to use the full path to PsExec.

You can combine this with wrapping the Windows Service in an MSI for packaging and installing. In the MSI package, you will be able to define how to install the windows service so that it starts up with Windows, manually, or however else you prefer. You can also set up the user account to run it under as well. I always prefer to manually start the service. Use the command line tool MSIEXEC to run the MSI package. You can chain these commands together to do the copy and deployment like so:

PsExec \\computername -u adminuser -p adminuserpassword xcopy "\\buildserver\DeploymentPackages\MyWinService-v1\MyWinService.msi" "C:\Updates\MyWinService.msi" /i /e /r /y

PsExec \\computername -u adminuser -p adminuserpassword MSIEXEC /i "C:\Updates\MyWinService.msi" INSTALLDIR="C:\Program Files (x86)\MyWinService"

PsExec \\computername -u adminuser -p adminuserpassword sc start "MyWinService"

You won't need PsExec to execute SC.exe on the remote computer since it has the option to specify the machine.

Hopefully this helps get you some where. I'm including the links to the SysInternals tools and Windows Installer XML (WiX) to build MSI packages from inside Visual Studio.

PsExec from the SysInternals Suite

Windows Installer XML (WiX)


You can do this with kwatee. It will take care of copying your files over the network to any number of computers and running remote actions which you can configure to register/deregister and start/stop the services. The only catch is that you need to have either telnet/ftp or ssh/scp installed on the targets.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜