安装使用给定的用户名在远程机器上一个窗口服务 [英] Installing a windows service on remote machine using given username

查看:203
本文介绍了安装使用给定的用户名在远程机器上一个窗口服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是远程计算机,在这里我需要提供用户名和密码,就应运行?安装在C#编写(以标准方式)一个窗口服务的最佳方式

What is the best way to install a windows service written in C# (in the standard way) on a remote machine, where I need to provide the username and password it should run as?

我要MSBuild中运行它的集成测试的一部分。

I am going to run it from MSBuild as part of integration tests.

编辑:我没有一个MSI,我不希望创建一个

I don't have an msi and I don't want to create one.

推荐答案

您可以使用 SC 命令。

SC.EXE \\ remotecomputer创建newservice binpath = C:\ WINDOWS \ SYSTEM32 \ Newserv.exe开始=自动OBJ =域\用户名密码= PWD

(注意空格等号后的迹象是很重要的)

(Note the spaces after the equals signs are important)

Creates a service entry in the registry and Service Database.
SYNTAX: 
sc create [service name] [binPath= ] <option1> <option2>...
CREATE OPTIONS:
NOTE: The option name includes the equal sign.
 type= <own|share|interact|kernel|filesys|rec>
       (default = own)
 start= <boot|system|auto|demand|disabled>
       (default = demand)
 error= <normal|severe|critical|ignore>
       (default = normal)
 binPath= <BinaryPathName>
 group= <LoadOrderGroup>
 tag= <yes|no>
 depend= <Dependencies(separated by / (forward slash))>
 obj= <AccountName|ObjectName>
       (default = LocalSystem)
 DisplayName= <display name>
 password= <password> 

这篇关于安装使用给定的用户名在远程机器上一个窗口服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆