Using alternate credentials to manage service

gatoraidab

New member
Joined
Nov 8, 2012
Messages
1
Programming Experience
1-3
I'm currently trying to rewrite my program that I created, and I'm wanting to be able to pass credentials to a remote computer to manage the services. The account on the other computer is a local account, and I do not want to be able to use a domain account. I saw that you can use the processinstaller reference but that is only for installing a service. I want to be able to manage the service.

This is what I currently have.

VB.NET:
        Dim sc As New System.ServiceProcess.ServiceController("LPT:One Job Queue Engine")
        'This sets the Machine Name/IP Address
        sc.MachineName = "************"
        'This tells the service to stop
        sc.Stop()
        'This tells the program to wait until the service is stopped
        sc.WaitForStatus(ServiceProcess.ServiceControllerStatus.Stopped)
        'This starts the service once it has stopped
        sc.Start()


Any help will be greatly appreciated.
 

Latest posts

Back
Top