这篇文章主要介绍WMI如何创建系统服务,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!代码如下:Const OWN_PROCESS = &H10Const ERR_CONTROL = &H2Const
这篇文章主要介绍WMI如何创建系统服务,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!
代码如下:
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
以上是“WMI如何创建系统服务”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注编程网精选频道!
--结束END--
本文标题: WMI如何创建系统服务
本文链接: https://lsjlt.com/news/253297.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0