您好,登錄后才能下訂單哦!
這篇文章主要介紹WMI如何創(chuàng)建系統(tǒng)服務,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!
代碼如下:
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如何創(chuàng)建系統(tǒng)服務”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識,歡迎關(guān)注億速云行業(yè)資訊頻道!
免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。