简要咨询咨询QQ网站导航网站搜索手机站点联系我们设为首页加入收藏 

WMI 创建系统服务的实现代码(Automatic)

来源:易贤网   阅读:852 次  日期:2014-05-09 16:54:36

温馨提示:易贤网小编为您整理了“WMI 创建系统服务的实现代码(Automatic)”,方便广大网友查阅!

代码如下:

Const OWN_PROCESS = &H10

Const ERR_CONTROL = &H2

Const INTERACTIVE = False

ServiceName = "TestService"

DisplayName = "This is a test service."

InstallPath = "c:\windows\system32\Test.exe"

Set ObjWMI = GetObject("winmgmts:" & "{impersonationLevel=impersonate, (Security)}!\\.\root\cimv2")

Set ObjSvr = ObjWMI.Get("Win32_Service")

Return = ObjSvr.Create(ServiceName, DisplayName, InstallPath, OWN_PROCESS, ERR_CONTROL, "Automatic", INTERACTIVE, "LocalSystem", "")

If (Return = 0) Then

Wscript.Echo "Service create success."

Wscript.Echo "ServiceName: " & ServiceName

Wscript.Echo "DisplayName: " & DisplayName

Wscript.Echo "InstallPath: " & InstallPath

Wscript.Echo ""

Else

Wscript.Echo "Service create failure(" & Return & ")."

Wscript.Quit(Return)

End If

Wscript.Quit

更多信息请查看IT技术专栏

更多信息请查看脚本栏目
点此处就本文及相关问题在本站进行非正式的简要咨询(便捷快速)】     【点此处查询各地各类考试咨询QQ号码及交流群
上一篇:VBS 十六进制异或加密实现代码
下一篇:VBE decoder
易贤网手机网站地址:WMI 创建系统服务的实现代码(Automatic)
由于各方面情况的不断调整与变化,易贤网提供的所有考试信息和咨询回复仅供参考,敬请考生以权威部门公布的正式信息和咨询为准!