Search code examples
command-linevbscriptwindows-services

Vbscript to change windows service startuptype


I am using the below command line code to change the start up type of some of my services to automatic-delayed.

sc config *servicename*  start= delayed-auto

Is there a way to do this in VBscript? Or can the above command line be converted to VBScript?


Solution

  • Use Run Method

    Set WshShell = WScript.CreateObject("WScript.Shell")
    WshShell.Run "CMD /C sc config *servicename*  start= delayed-auto", 0, True