Results 1 to 1 of 1

Thread: How to create window service using VBScript with specified servicename!(Help !!!!!!!)

  1. #1
    Join Date
    Jul 2004
    Location
    Singapore
    Posts
    113

    How to create window service using VBScript with specified servicename!(Help !!!!!!!)

    Hi,
    I want to create use VBScrpt to add new new window service.

    The following is what I have done now:
    Set WshShell = CreateObject("WScript.Shell")
    command = "aaaaa.exe install"
    Return = WshShell.Run(command, TRUE)


    Then I use the following script to change the property of the service

    Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
    Set colServiceList = objWMIService.ExecQuery("Select * from Win32_Service where Name = 'aaaaa'")
    For Each objService in colServiceList
    errReturnCode = objService.Change(sDisplayName,NULL,iServiceType,iErrorControl,sStartMode,bDesktopInteract,NULL,NULL,sLoadOrderGroup,NULL,NULL)
    errReturn = objService.StartService()
    Next


    But in this way, the name of created service is the name of file. I can not specify the servername.
    Can anyone tell me how to create a window service with a specified name.

    Thanks
    Last edited by linefusion; 10-18-2004 at 11:20 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •