VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Starting, Pausing, and Stopping NT Services

Troy Blake  (3 Submissions)   Windows System Services   Visual Basic 3.0   Intermediate   Wed 3rd February 2021

You can use ADSI to manage local and
remote services. This code shows
and describes the different methods
and properties ADSI provides for
services. Please vote and leave your
comments for this submission.

Assumes
The ADSI Service Object supports two COM interfaces, IADsService and IADsServiceOperations. The properties of the IADsService interface are listed below: Property Description ------------------------------------------------------------------------------------- Dependencies The list of services you need to start before you can start this service. DisplayName The friendly name that is displayed for this service. ErrorControl The severity of the alert if the service does not start. HostComputer The ADsPath string of the host of this service. LoadOrderGroup Name of the load order group of which this service is a member. Path Path and filename of the executable file for this service. ServiceAccountName Name of the account that this service uses for authentication. ServiceAccountPath The ADsPath string for the user account this service is using. ServiceType The description of the service type on the host computer. StartType One of five possible types that determines when this service starts. StartupParameters Parameters passed to the service executable file. Version Version information of the service. The IADsServiceOperations service settings are listed below: Property Description ------------------------------------------------------------------------------------- Status The current operational state of the service. Start Starts the service. Stop Stops the service. Pause Pauses the service. Continue Resumes the paused service. SetPassword Sets the password for the Service Account. The following example of VB code lists the running services on a computer with some common properties. Insert the following code into your project. Place a combobox onto the form named cboService, and a command button named cmdStop. Make a reference to the ActiveDS.TLB in the project references under "Active DS Type Library". This VB code example loads a form displaying a combobox and a command button. The combobox displays all running services. The user may select one of these listed services and click on the Stop button to stop the running service. It does not handle errors or refresh the combobox. Based on some code found on MSDN that discussed scripting support for services.

Rate Starting, Pausing, and Stopping NT Services (3(3 Vote))
Starting, Pausing, and Stopping NT Services.bas

Starting, Pausing, and Stopping NT Services Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters