6
A
回答
4
你没有提到你使用的是什么语言。更可能的是,windows install utility可以处理它。
2
如果我正确理解你的问题,你首先需要从VSTS中创建一个安装程序。它已经一段时间,因为我做了一个,但它基本上是这样的:
http://csharpcomputing.com/Tutorials/Lesson22.htm
一旦你创建了一个安装程序,您可以使用PowerShell自动化。
如果你确实想PowerShell来为您服务的安装程序,有可能是通过使用ServiceInstaller Class自动从PowerShell中的Windows服务的安装方式。
18
这里有一个安装脚本,我写的消毒版本。应该证明你需要做的一切:
## delete existing service
# have to use WMI for much of this, native cmdlets are incomplete
$service = Get-WmiObject -Class Win32_Service -Filter "Name = 'My Service'"
if ($service -ne $null)
{
$service | stop-service
$service.Delete() | out-null
}
## run installutil
# 'frameworkdir' env var apparently isn't present on Win2003...
$installUtil = join-path $env:SystemRoot Microsoft.NET\Framework\v2.0.50727\installutil.exe
$serviceExe = join-path $messageServerPath MyService.exe
$installUtilLog = join-path $messageServerPath InstallUtil.log
& $installUtil $serviceExe /logfile="$installUtilLog" | write-verbose
$service = Get-WmiObject -Class Win32_Service -Filter "Name = 'My Service'"
# change credentials if necessary
if ($user -ne "" -and $password -ne "")
{ $service.change($null, $null, $null, $null, $null, $null, $user, $password, $null, $null, $null) | out-null }
# activate
$service | set-service -startuptype Automatic -passthru | start-service
write-verbose "Successfully started service $($service.name)"
相关问题
- 1. 在安装Windows服务之前卸载
- 2. 如何创建安装Windows服务以卸载然后安装服务?
- 3. Windows服务的安装/卸载Windows中10
- 4. Powershell在远程计算机上安装/卸载Windows服务
- 5. Windows服务的有条件安装/卸载
- 6. 批处理脚本安装或卸载.NET Windows服务
- 7. 安装的产品与卸载Windows服务时的安装源错误不符
- 8. 在卸载WIX中创建的安装程序时未卸下Windows服务
- 9. 服务安装程序在卸载时不会删除服务
- 10. 服务运行时,无法安装或卸载XAMPP服务! Apache
- 11. Windows服务安装
- 12. 安装windows服务
- 13. 在Windows上安装/卸载USB磁盘
- 14. .NET安装项目卸载安装文件夹在卸载
- 15. Windows安装程序错误卸载服务(无法打开键未知)
- 16. 卸载C#Windows服务 - 使用卸载程序
- 17. 更新C#Windows服务而不卸载
- 18. 自终止或卸载Windows服务
- 19. 无法安装Windows服务
- 20. 安装.NET Windows服务
- 21. 如何安装Windows服务
- 22. Windows服务安装程序
- 23. Windows服务安装项目
- 24. 远程安装windows服务
- 25. 安装Windows服务无法
- 26. MSDeploy安装windows服务?
- 27. 远程安装Windows服务
- 28. VB.net Windows服务未安装
- 29. 使用visual studio 2013安装程序项目安装和卸载窗口服务
- 30. Inno安装程序:卸载Dll服务器
我正在使用C#。还有什么想法? – George2 2009-06-26 07:59:09