Exemple #1
0
 internal void RemoveService(string name)
 {
     using (var impersonator = new Impersonator(this.adminUser))
         using (var serviceControlManagerHandle = OpenServiceControlManager(this.hostName))
             using (var serviceHandle = this.OpenService(serviceControlManagerHandle, name))
             {
                 this.DeleteService(serviceHandle);
             }
 }
Exemple #2
0
 internal void InstallService(
     string name,
     string description,
     string executablePath,
     NetworkCredential logOnAccount)
 {
     using (var impersonator = new Impersonator(this.adminUser))
         using (var serviceControlManagerHandle = OpenServiceControlManager(this.hostName))
             using (var serviceHandle = this.CreateService(serviceControlManagerHandle, name, executablePath, logOnAccount))
             {
                 this.UpdateDescription(serviceHandle, description);
                 this.UpdateFailureActions(serviceHandle);
             }
 }