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
標(biāo)簽:四平 西安 鶴壁 銅川 文山 湖州 邢臺(tái)
巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《WMI 創(chuàng)建系統(tǒng)服務(wù)的實(shí)現(xiàn)代碼(Automatic)》,本文關(guān)鍵詞 WMI,創(chuàng)建,系統(tǒng),服務(wù),的,實(shí)現(xiàn),;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。