Beispiel #1
0
 public static void UninstallService()
 {
     try
     {
         IntegratedServiceInstaller.Uninstall(PSService.PSServiceName);
     }
     catch
     {
     }
 }
Beispiel #2
0
        public static void InstallService(ServiceAccount account, ServiceStartMode startMode, string username, string password)
        {
            if (IsServiceInstalled())
            {
                UninstallService();
            }

            try
            {
                IntegratedServiceInstaller.Install(Assembly.GetExecutingAssembly().Location, PSService.PSServiceName, PSService.PSServiceDisplayName, PSService.PSServiceDescription, account, startMode, username, password);
            }
            catch
            {
            }
        }