Wrox Programmer Forums
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 26th, 2005, 11:27 AM
Authorized User
Join Date: Sep 2003
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to prabodh_mishra
Default Win 2k3 service

Hi all,

can anybody help me to create a service in Win 2k3 with VB

thanks in advance

Old October 27th, 2005, 02:37 AM
Friend of Wrox
Join Date: Nov 2003
Posts: 141
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to acdsky


I had a look at this topic on the net and came accross some code. I havent tried it but maybe give this a shot:

 For Installing a service: - This example is installing a service called "Personal Database" with the path to the .exe

Const OWN_PROCESS = 16
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objService = objWMIService.Get("Win32_BaseService")
errReturn = objService.Create ("DbService", "Personnel Database", _
  "c:\windows\system32\db.exe", OWN_PROCESS ,2 ,"Automatic" , _
      NOT_INTERACTIVE ,".\LocalSystem" ,"")

To Remove the service:

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colListOfServices = objWMIService.ExecQuery _
    ("SELECT * FROM Win32_Service WHERE Name = 'DbService'")
For Each objService in colListOfServices


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to access web service in win forms saravanan.k .NET Web Services 2 May 5th, 2007 06:49 AM
specifing the time intraval in win service srkarthik_82 General .NET 0 January 8th, 2007 05:24 AM
Start win.. service in folder other than System32 zaheersharief General .NET 2 April 18th, 2005 12:50 AM
Installing PHP on Win 2K3 Server Maxood Beginning PHP 7 July 7th, 2004 07:58 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.