我试图使用 Microsoft.Sdc.Tasks.ServiceProcess.Exists
来检查服务是否存在。还有,虽然使用它的文档中没有例子。任何人有一个?
I'm trying to use the Microsoft.Sdc.Tasks.ServiceProcess.Exists
to check whether or not a service exists. There is no example of using it in the documentation though. Anyone have one?
我还没有实际使用该生产我自己,我不知道您的版本(我有2.1.3155.0版本的副本),并根据所附的.chm帮助文件的任务具有以下属性:
I've not actually used this in production myself, and I'm not sure which version you have (I have a copy of Release 2.1.3155.0) and according to the accompanying .chm help file the Task has the following properties:
DoesExist返回true,如果指定的服务存在 IsDisabled如果该服务被禁用,则返回TRUE 在服务名称标识服务系统的简称。的服务名称需要被设置为标识的服务给系统,例如'W3SVC'短名称。
The ServiceName needs to be set to "The short name that identifies the service to the system, e.g. 'W3SVC'".
您可能想给它一个知名的服务一试(如MSSQLSERVER),并检查其它两个属性的结果(DoesExist / IsDisabled)。
You might want to give it a try with a well known service (e.g. mssqlserver) and check the result of the other two properties (DoesExist/IsDisabled).
更新:下面是一个示例(工程):
Update: Here's a sample (works):
导入任务,然后调用(例如)
Import the tasks, then call (e.g.)
< Microsoft.Sdc.Tasks.ServiceProcess.Exists 服务名称=服务器> <输出TaskParameter =DoesExist属性名=存在/> < /Microsoft.Sdc.Tasks.ServiceProcess.Exists>
< Microsoft.Sdc.Tasks.ServiceProcess.Exists ServiceName="Server"> < Output TaskParameter="DoesExist" PropertyName="Exists" /> < /Microsoft.Sdc.Tasks.ServiceProcess.Exists >
&LT;消息文本=服务存在?$(存在)/>
< Message Text="Service exists? $(Exists)" />
上一篇:NullPointerException异常复选框共享preferences复选框、异常、NullPointerException、preferences
下一篇:哪里LocalFileSystem.PERSISTENT点?LocalFileSystem、PERSISTENT