检查服务是否在 WiX 中运行 [英] Check if service is running in WiX

查看:43
本文介绍了检查服务是否在 WiX 中运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我在客户的计算机上遇到了问题.我们的安装程序会在安装和卸载过程中挂起.最终我发现 winmgmt 服务没有运行,这导致了问题.由于某种原因,它被禁用了.

Recently I had a problem in a costumer's computer. Our installer would hang during install and uninstall. Eventually I found out that the winmgmt service wasn't running, and that was causing the problem. For some reason it was disabled.

我想为我们的安装程序添加一个检查,以保证安装开始时服务正在运行.如果它没有运行,最好带有一个有用的错误消息.

I would like to add a check to our installer, to guarantee that the service is running when installation begins. Preferably, with a helful error message if it isn't running.

我知道我可以使用自定义操作来执行此检查,从 C 程序调用 QueryServiceStatusEx.它也可以在 VBS 中以某种方式完成.但如果可能的话,我想避免自定义操作.我们在杀毒软件和对 WSH 的依赖方面遇到了一些问题.

I know I can do this check with a custom action, calling QueryServiceStatusEx from a C program. It can probably be done in some way in VBS too. But i would like to avoid custom actions, if possible. We had some problems with antiviruses, and dependency with WSH.

所以,简而言之:如何在 WiX 中检查服务是否正在运行?

So, in short: How can I check if a service is running, in WiX?

(我对 WiX 没有太多经验.编写安装程序的人离开了公司,现在我负责维护)

(I don't have much experience with WiX. The guy who wrote the installer left the company and now I do the maintenance)

谢谢!

推荐答案

Windows Installer 没有内置任何内容来检查服务的状态.您将需要一个 CustomAction.由于您发现不应使用脚本 CustomActions,请参阅:http://blogs.msdn.com/robmen/archive/2004/05/20/136530.aspx

There is nothing built into the Windows Installer to check the status of a service. You will need a CustomAction. As you've found script CustomActions should not be used, see: http://blogs.msdn.com/robmen/archive/2004/05/20/136530.aspx

这篇关于检查服务是否在 WiX 中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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