You are here

CreatService.vbs and RemoveService.vbs implement in the launcher

1 post / 0 new
kingscom
Offline
Last seen: 11 years 1 month ago
Joined: 2012-10-23 21:22
CreatService.vbs and RemoveService.vbs implement in the launcher

I am not a programmer, i just come across this scrip on the web, i am checking if the portable.com launcher will add this scrip for service apps

create service script save as CreatService.vbs
=============================================
Const OWN_PROCESS = 16
Const NOT_INTERACTIVE = False
Const NORMAL_ERROR_CONTROL = 2

strComputer = "."
Set objWMIService = GetObject("winmgmts:" & _
"{impersonationLevel=Impersonate}!\\" & strComputer & "\root\cimv2")

Set objService = objWMIService.Get("Win32_BaseService")
errReturn = objService.Create("DbService", _
"NAME", _
"C:\WINDOWS\PROGRAM.EXE", _
OWN_PROCESS, _
NORMAL_ERROR_CONTROL, _
"Manual", _
NOT_INTERACTIVE, _
"NT AUTHORITY\LocalService", "")

=======================================

remove service script save as RemoveService.vbs
====================================================
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colListOfServices = objWMIService.ExecQuery _
("Select * from Win32_Service Where Name = 'SERVICE_NAME'")
For Each objService in colListOfServices
objService.StopService()
objService.Delete()
Next